1 |
|
2 |
/* $Id$ */ |
3 |
|
4 |
/******************************************************* |
5 |
* |
6 |
* Copyright 2003-2007 by ACceSS MNRF |
7 |
* Copyright 2007 by University of Queensland |
8 |
* |
9 |
* http://esscc.uq.edu.au |
10 |
* Primary Business: Queensland, Australia |
11 |
* Licensed under the Open Software License version 3.0 |
12 |
* http://www.opensource.org/licenses/osl-3.0.php |
13 |
* |
14 |
*******************************************************/ |
15 |
|
16 |
extern "C" { |
17 |
#include "DataC.h" |
18 |
} |
19 |
|
20 |
#include "Data.h" |
21 |
#include "DataArrayView.h" |
22 |
|
23 |
int getFunctionSpaceType(struct escriptDataC* data) |
24 |
{ |
25 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
26 |
return temp->getFunctionSpace().getTypeCode(); |
27 |
} |
28 |
|
29 |
|
30 |
int isDataPointShapeEqual(struct escriptDataC* data, int rank, int* dimensions) |
31 |
{ |
32 |
if (data == (struct escriptDataC*)0) { |
33 |
return true; |
34 |
} else { |
35 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
36 |
if (temp->isEmpty()) { |
37 |
return true; |
38 |
} else { |
39 |
escript::DataArrayView::ShapeType givenShape(&dimensions[0],&dimensions[rank]); |
40 |
return (temp->getPointDataView().getShape()==givenShape); |
41 |
} |
42 |
} |
43 |
} |
44 |
|
45 |
int getNumDataPointsPerSample(struct escriptDataC* data) |
46 |
{ |
47 |
if (data == (struct escriptDataC*)0) { |
48 |
return 0; |
49 |
} else { |
50 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
51 |
if (temp->isEmpty()) { |
52 |
return 0; |
53 |
} else { |
54 |
return (temp->getNumDataPointsPerSample()); |
55 |
} |
56 |
} |
57 |
} |
58 |
|
59 |
int numSamplesEqual(struct escriptDataC* data, int numDataPointsPerSample, |
60 |
int numSamples) |
61 |
{ |
62 |
if (data == (struct escriptDataC*)0) { |
63 |
return true; |
64 |
} else { |
65 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
66 |
if (temp->isEmpty()) { |
67 |
return true; |
68 |
} else { |
69 |
int result=(numDataPointsPerSample==temp->getNumDataPointsPerSample()); |
70 |
result=result && (numSamples==temp->getNumSamples()); |
71 |
return result; |
72 |
} |
73 |
} |
74 |
} |
75 |
|
76 |
int getDataPointRank(struct escriptDataC* data) |
77 |
{ |
78 |
if (data == (struct escriptDataC*)0) { |
79 |
return 0; |
80 |
} else { |
81 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
82 |
return temp->getDataPointRank(); |
83 |
} |
84 |
} |
85 |
|
86 |
int getDataPointShape(struct escriptDataC* data,int i) |
87 |
{ |
88 |
if (data == (struct escriptDataC*)0) { |
89 |
return 0; |
90 |
} else { |
91 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
92 |
int rank = temp->getDataPointRank(); |
93 |
if (i<0 || i>=rank) { |
94 |
return 1; |
95 |
} else { |
96 |
const escript::DataArrayView::ShapeType view=temp->getDataPointShape(); |
97 |
return view[i]; |
98 |
} |
99 |
} |
100 |
} |
101 |
|
102 |
int getDataPointSize(struct escriptDataC* data) |
103 |
{ |
104 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
105 |
return temp->getDataPointSize(); |
106 |
} |
107 |
|
108 |
int getLength(struct escriptDataC* data) |
109 |
{ |
110 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
111 |
return temp->getLength(); |
112 |
} |
113 |
|
114 |
int isExpanded(struct escriptDataC* data) |
115 |
{ |
116 |
if (data == (struct escriptDataC*)0) { |
117 |
return false; |
118 |
} else { |
119 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
120 |
if (temp->isEmpty()) { |
121 |
return false; |
122 |
} else { |
123 |
return temp->isExpanded(); |
124 |
} |
125 |
} |
126 |
} |
127 |
|
128 |
int isEmpty(escriptDataC* data) |
129 |
{ |
130 |
if (data == (struct escriptDataC*)0) { |
131 |
return true; |
132 |
} else { |
133 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
134 |
return temp->isEmpty(); |
135 |
} |
136 |
} |
137 |
|
138 |
|
139 |
double* getSampleData(struct escriptDataC* data, int sampleNo) |
140 |
{ |
141 |
if (data == (struct escriptDataC*)0) { |
142 |
return NULL; |
143 |
} else { |
144 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
145 |
if (temp->isEmpty()) { |
146 |
return NULL; |
147 |
} else { |
148 |
return temp->getSampleData(sampleNo); |
149 |
} |
150 |
} |
151 |
} |
152 |
|
153 |
double* getSampleDataFast(struct escriptDataC* data, int sampleNo) |
154 |
{ |
155 |
escript::Data* temp=(escript::Data*)(data->m_dataPtr); |
156 |
return temp->getSampleData(sampleNo); |
157 |
} |