/[escript]/branches/subworld2/escriptcore/src/DataC.h
ViewVC logotype

Contents of /branches/subworld2/escriptcore/src/DataC.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5504 - (show annotations)
Wed Mar 4 22:58:13 2015 UTC (4 years, 1 month ago) by jfenwick
File MIME type: text/plain
File size: 5501 byte(s)
Again with a more up to date copy


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2015 by 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
18 #if !defined escript_DataC_20040611_H
19 #define escript_DataC_20040611_H
20 #include "system_dep.h"
21
22 #include "Data.h"
23
24
25
26 /**
27 \brief
28 Return the function space type code.
29 \param data Input - C wrapper for Data.
30 */
31 ESCRIPT_DLL_API int getFunctionSpaceType(const escript::Data* data);
32
33 /**
34 \brief
35 sets the int variable _FS to the function space type of _DATA if the data
36 object is not empty.
37 \param _FS Input/Output - variable to be updated.
38 \param _DATA Input - C wrapper for Data.
39 */
40 #define updateFunctionSpaceType(_FS,_DATA) _FS=(isEmpty(_DATA) ? _FS : getFunctionSpaceType(_DATA))
41
42 /**
43 \brief
44 returns true if the function space type of _DATA is equal to _FS or is empty
45 \param _FS Input - function space type to checked against
46 \param _DATA Input - C wrapper for Data.
47 */
48 #define functionSpaceTypeEqual(_FS,_DATA) ( (isEmpty(_DATA) || _FS==getFunctionSpaceType(_DATA)) ) ? 1 : 0
49
50 /**
51 \brief
52 Returns the true if the data are empty or data is NULL.
53 \param data Input - C wrapper for Data.
54 */
55 ESCRIPT_DLL_API int isEmpty(const escript::Data* data);
56
57 /**
58 \brief
59 Return true if the input shape matches the data point shape for data
60 \param data Input - C wrapper for Data.
61 \param rank Input - number of dimensions.
62 \param dimensions Input -
63 */
64 ESCRIPT_DLL_API int isDataPointShapeEqual(const escript::Data* data, int rank, const int* dimensions);
65 /**
66 \brief
67 Return true if the number of data points per sample and the number
68 of samples equal the input values. In the case that data is empty or NULL,
69 true is returned.
70 \param data Input - C wrapper for Data.
71 \param numDataPointsPerSample Input - number of data points per sample
72 \param numSamples Input - number of samples
73 */
74 ESCRIPT_DLL_API int numSamplesEqual(const escript::Data* data, int numDataPointsPerSample,
75 dim_t numSamples);
76
77 /**
78 \brief
79 Returns the number of data points per sample
80 \param data Input - C wrapper for Data.
81 */
82 ESCRIPT_DLL_API int getNumDataPointsPerSample(const escript::Data* data);
83
84 /**
85 \brief
86 Returns the rank of the point data for the data.
87 \param data Input - C wrapper for Data.
88 */
89 ESCRIPT_DLL_API int getDataPointRank(const escript::Data* data);
90
91 /**
92 \brief
93 Returns the value of the i-th component of the shape of the point data.
94 \param data Input - C wrapper for Data.
95 \param i Input - index of shape component.
96 */
97 ESCRIPT_DLL_API int getDataPointShape(const escript::Data* data, int i);
98
99 /**
100 \brief
101 Return the number of doubles needed for each data point.
102 \param data Input - C wrapper for Data.
103 */
104 ESCRIPT_DLL_API int getDataPointSize(const escript::Data* data);
105
106 /**
107 \brief
108 Return true if data can be treated as expanded.
109
110 Argument data may be NULL, in which case false is returnd.
111 \param data Input - C wrapper for Data.
112 \return true if data is expanded or the data is lazy but would resolve to expanded. False otherwise.
113 */
114 ESCRIPT_DLL_API int isExpanded(const escript::Data* data);
115
116 /**
117 \brief
118 Return a pointer to the data for the given sample number.
119 if data is empty NULL is returned.
120 data may be NULL, in which case NULL is returnd.
121 \param data Input - C wrapper for Data.
122 \param sampleNo Input - The sample number.
123
124 */
125 ESCRIPT_DLL_API double const * getSampleDataRO(const escript::Data* data, int sampleNo);
126 /* Placement of __const might be important. See .cpp */
127
128
129 ESCRIPT_DLL_API double* getSampleDataRW(escript::Data* data, int sampleNo);
130
131
132 /**
133 \brief
134 Return a pointer to the data for the given sample number.
135 Fast version of getSampledataRO: does no error checking.
136 \param data Input - C wrapper for Data.
137 \param sampleNo Input - The sample number.
138
139 */
140 ESCRIPT_DLL_API double const* getSampleDataROFast(const escript::Data* data, int sampleNo);
141
142 /**
143 \brief
144 Return a pointer to the data for the given sample number.
145 Fast version of getSampledataRW: does no error checking.
146 \param data Input - C wrapper for Data.
147 \param sampleNo Input - The sample number.
148 */
149 ESCRIPT_DLL_API double* getSampleDataRWFast(escript::Data* data, int sampleNo);
150
151
152 /**
153 \brief
154 Return getSampleDataRWFast(escriptDataC* data, 0) if there are samples.
155 if not, returns NULL.
156 \warning This function calls requireWrite if there are samples so do not use in parallel sections.
157 \warning Please do not use this in new code.
158 \param data Input - C wrapper for Data.
159 */
160 ESCRIPT_DLL_API double* getDataRW(escript::Data* data);
161
162
163 /**
164 \brief Ensure that this object is ready for writing.
165 It will be resolved and copied if it is currently shared.
166 Use only in single threaded sections of code.
167 Do not create new Data objects based on this one between this call and
168 writing to the object.
169 */
170 ESCRIPT_DLL_API void requireWrite(escript::Data* data);
171
172 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26