/[escript]/trunk/escript/src/DataC.cpp
ViewVC logotype

Contents of /trunk/escript/src/DataC.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (10 years, 3 months ago) by ksteube
File size: 3763 byte(s)
Copyright updated in all files

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

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26