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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 113 - (show annotations)
Mon Feb 28 07:06:33 2005 UTC (14 years, 7 months ago) by jgs
Original Path: trunk/esys2/escript/src/Data/DataC.cpp
File size: 3827 byte(s)
*** empty log message ***

1 // $Id$
2 /*
3 ******************************************************************************
4 * *
5 * COPYRIGHT ACcESS 2004 - All Rights Reserved *
6 * *
7 * This software is the property of ACcESS. No part of this code *
8 * may be copied in any form or by any means without the expressed written *
9 * consent of ACcESS. Copying, use or modification of this software *
10 * by any unauthorised person is illegal unless that person has a software *
11 * license agreement with ACcESS. *
12 * *
13 ******************************************************************************
14 */
15
16 extern "C" {
17 #include "escript/Data/DataC.h"
18 }
19
20 #include "escript/Data/Data.h"
21 #include "escript/Data/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 numSamplesEqual(struct escriptDataC* data, int numDataPointsPerSample,
46 int numSamples)
47 {
48 if (data == (struct escriptDataC*)0) {
49 return true;
50 } else {
51 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
52 if (temp->isEmpty()) {
53 return true;
54 } else {
55 int result=(numDataPointsPerSample==temp->getNumDataPointsPerSample());
56 result=result && (numSamples==temp->getNumSamples());
57 return result;
58 }
59 }
60 }
61
62 int getDataPointRank(struct escriptDataC* data)
63 {
64 if (data == (struct escriptDataC*)0) {
65 return 0;
66 } else {
67 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
68 return temp->getDataPointRank();
69 }
70 }
71
72 int getDataPointShape(struct escriptDataC* data,int i)
73 {
74 if (data == (struct escriptDataC*)0) {
75 return 0;
76 } else {
77 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
78 int rank = temp->getDataPointRank();
79 if (i<0 || i>=rank) {
80 return 1;
81 } else {
82 const escript::DataArrayView::ShapeType view=temp->getDataPointShape();
83 return view[i];
84 }
85 }
86 }
87
88 int getDataPointSize(struct escriptDataC* data)
89 {
90 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
91 return temp->getDataPointSize();
92 }
93
94 int getLength(struct escriptDataC* data)
95 {
96 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
97 return temp->getLength();
98 }
99
100 int isExpanded(struct escriptDataC* data)
101 {
102 if (data == (struct escriptDataC*)0) {
103 return false;
104 } else {
105 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
106 if (temp->isEmpty()) {
107 return false;
108 } else {
109 return temp->isExpanded();
110 }
111 }
112 }
113
114 int isEmpty(escriptDataC* data)
115 {
116 if (data == (struct escriptDataC*)0) {
117 return true;
118 } else {
119 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
120 return temp->isEmpty();
121 }
122 }
123
124
125 double* getSampleData(struct escriptDataC* data, int sampleNo)
126 {
127 if (data == (struct escriptDataC*)0) {
128 return NULL;
129 } else {
130 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
131 if (temp->isEmpty()) {
132 return NULL;
133 } else {
134 return temp->getSampleData(sampleNo);
135 }
136 }
137 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26