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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (show annotations)
Tue Dec 14 05:39:33 2004 UTC (15 years ago) by jgs
File size: 3636 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)
73 {
74 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
75 const escript::DataArrayView::ShapeType view=temp->getDataPointShape();
76 return (int*) &(view[0]);
77 }
78
79 int getDataPointSize(struct escriptDataC* data)
80 {
81 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
82 return temp->getDataPointSize();
83 }
84
85 int getLength(struct escriptDataC* data)
86 {
87 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
88 return temp->getLength();
89 }
90
91 int isExpanded(struct escriptDataC* data)
92 {
93 if (data == (struct escriptDataC*)0) {
94 return false;
95 } else {
96 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
97 if (temp->isEmpty()) {
98 return false;
99 } else {
100 return temp->isExpanded();
101 }
102 }
103 }
104
105 int isEmpty(escriptDataC* data)
106 {
107 if (data == (struct escriptDataC*)0) {
108 return true;
109 } else {
110 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
111 return temp->isEmpty();
112 }
113 }
114
115
116 double* getSampleData(struct escriptDataC* data, int sampleNo)
117 {
118 if (data == (struct escriptDataC*)0) {
119 return NULL;
120 } else {
121 escript::Data* temp=(escript::Data*)(data->m_dataPtr);
122 if (temp->isEmpty()) {
123 return NULL;
124 } else {
125 return temp->getSampleData(sampleNo);
126 }
127 }
128 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26