/[escript]/trunk-mpi-branch/escript/src/DataC.cpp
ViewVC logotype

Contents of /trunk-mpi-branch/escript/src/DataC.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1223 - (show annotations)
Fri Aug 3 02:40:39 2007 UTC (11 years, 8 months ago) by gross
File size: 3953 byte(s)
first attemt towards an improved MPI version.  

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26