/[escript]/branches/trilinos_from_5897/escriptcore/src/DataC.cpp
ViewVC logotype

Contents of /branches/trilinos_from_5897/escriptcore/src/DataC.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5963 - (show annotations)
Mon Feb 22 06:59:27 2016 UTC (3 years, 4 months ago) by caltinay
File size: 3498 byte(s)
sync and fix.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
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 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 #define ESNEEDPYTHON
18 #include "esysUtils/first.h"
19
20 #include "DataC.h"
21
22 #include "Data.h"
23 #include "DataTypes.h"
24
25 int getFunctionSpaceType(const escript::Data* data)
26 {
27 return data->getFunctionSpace().getTypeCode();
28 }
29
30
31 int isDataPointShapeEqual(const escript::Data* data, int rank, const int* dimensions)
32 {
33 if (data == 0) {
34 return 1;
35 } else {
36 return data->isDataPointShapeEqual(rank, dimensions);
37 }
38 }
39
40 int getNumDataPointsPerSample(const escript::Data* data)
41 {
42 if (data == 0) {
43 return 0;
44 } else {
45 if (data->isEmpty()) {
46 return 0;
47 } else {
48 return (data->getNumDataPointsPerSample());
49 }
50 }
51 }
52
53 int numSamplesEqual(const escript::Data* data, int numDataPointsPerSample,
54 escript::DataTypes::dim_t numSamples)
55 {
56 if (data == 0) {
57 return 1;
58 } else {
59 return data->numSamplesEqual(numDataPointsPerSample, numSamples);
60 }
61 }
62
63 int getDataPointRank(const escript::Data* data)
64 {
65 if (data == (const escript::Data*)0) {
66 return 0;
67 } else {
68 return data->getDataPointRank();
69 }
70 }
71
72 int getDataPointShape(const escript::Data* data,int i)
73 {
74 if (data == 0) {
75 return 0;
76 } else {
77 int rank = data->getDataPointRank();
78 if (i<0 || i>=rank) {
79 return 1;
80 } else {
81 const escript::DataTypes::ShapeType& view=data->getDataPointShape();
82 return view[i];
83 }
84 }
85 }
86
87 int getDataPointSize(const escript::Data* data)
88 {
89 return data->getDataPointSize();
90 }
91
92 int getLength(const escript::Data* data)
93 {
94 return data->getLength();
95 }
96
97 int isExpanded(const escript::Data* data)
98 {
99 if (data == 0) {
100 return false;
101 } else {
102 if (data->isEmpty()) {
103 return false;
104 } else {
105 return data->actsExpanded();
106 }
107 }
108 }
109
110 int isEmpty(const escript::Data* data)
111 {
112 if (data == 0) {
113 return true;
114 } else {
115 return data->isEmpty();
116 }
117 }
118
119 double const* getSampleDataRO(const escript::Data* data, int sampleNo)
120 {
121 if (data == 0) {
122 return NULL;
123 } else {
124 if (data->isEmpty()) {
125 return NULL;
126 } else {
127 return data->getSampleDataRO(sampleNo);
128 }
129 }
130 }
131
132 double* getSampleDataRW(escript::Data* data, int sampleNo)
133 {
134 if (data == 0) {
135 return NULL;
136 } else {
137 if (data->isEmpty()) {
138 return NULL;
139 } else {
140 return data->getSampleDataRW(sampleNo);
141 }
142 }
143 }
144
145 const double* getSampleDataROFast(const escript::Data* data, int sampleNo)
146 {
147 return data->getSampleDataRO(sampleNo);
148 }
149
150 double* getSampleDataRWFast(escript::Data* data, int sampleNo)
151 {
152 return data->getSampleDataRW(sampleNo);
153 }
154
155 double* getDataRW(escript::Data* data)
156 {
157
158 if (data->getNumSamples()>0)
159 {
160 requireWrite(data);
161 return getSampleDataRWFast(data,0);
162 }
163 return 0;
164 }
165
166
167 void requireWrite(escript::Data* data)
168 {
169 if (data == 0) {
170 return;
171 } else {
172 data->requireWrite();
173 }
174 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26