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

Annotation of /trunk/escript/src/DataC.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3911 - (hide annotations)
Thu Jun 14 01:01:03 2012 UTC (7 years, 5 months ago) by jfenwick
File MIME type: text/plain
File size: 5790 byte(s)
Copyright changes
1 ksteube 1312
2     /*******************************************************
3 ksteube 1811 *
4 jfenwick 3911 * Copyright (c) 2003-2012 by University of Queensland
5 ksteube 1811 * Earth Systems Science Computational Center (ESSCC)
6     * http://www.uq.edu.au/esscc
7     *
8     * Primary Business: Queensland, Australia
9     * Licensed under the Open Software License version 3.0
10     * http://www.opensource.org/licenses/osl-3.0.php
11     *
12     *******************************************************/
13 ksteube 1312
14 ksteube 1811
15 jgs 82 #if !defined escript_DataC_20040611_H
16     #define escript_DataC_20040611_H
17 woo409 757 #include "system_dep.h"
18 jgs 82
19     /**
20     \brief
21     Provide a wrapper around a Data object so Data may be accessed from C.
22    
23     Description:
24     Provide a wrapper around a Data object so Data may be accessed from C.
25    
26     */
27     struct escriptDataC {
28     void* m_dataPtr;
29     };
30    
31 gross 1034 typedef struct escriptDataC escriptDataC;
32 jgs 82
33     /**
34     \brief
35     Return the function space type code.
36     \param data Input - C wrapper for Data.
37     */
38 woo409 757 ESCRIPT_DLL_API int getFunctionSpaceType(escriptDataC* data);
39 jgs 82
40     /**
41     \brief
42     sets the int variable _fs_ the function space type of _data_ if the data are not empty.
43     \param _fs_ Input/Output - variable to be updated.
44     \param _data_ Input - C wrapper for Data.
45     */
46     #define updateFunctionSpaceType(_fs_,_data_) _fs_=(isEmpty(_data_) ? _fs_ : getFunctionSpaceType(_data_))
47    
48     /**
49     \brief
50     is true if the function space type of _data_ is equal to _fs_ or is empty
51     \param _fs_ Input - function space type to checked against
52     \param _data_ Input - C wrapper for Data.
53     */
54 jgs 102 #define functionSpaceTypeEqual(_fs_,_data_) ( (isEmpty(_data_) || _fs_==getFunctionSpaceType(_data_)) ) ? 1 : 0
55 jgs 82
56     /**
57     \brief
58     Returns the true if the data are empty or data is NULL.
59     \param data Input - C wrapper for Data.
60     */
61 woo409 757 ESCRIPT_DLL_API int isEmpty(escriptDataC* data);
62 jgs 82
63     /**
64     \brief
65     Return true if the input shape matches the data point shape for data
66     \param data Input - C wrapper for Data.
67     \param rank Input - number of dimensions.
68     \param dimensions Input -
69     */
70 woo409 757 ESCRIPT_DLL_API int isDataPointShapeEqual(escriptDataC* data, int rank, int* dimensions);
71 jgs 82 /**
72     \brief
73     Return true if the number of data points per sample and the number
74     of samples equal the input values. In the case that data is empty or NULL,
75     true is returned.
76     \param data Input - C wrapper for Data.
77 jgs 121 \param numDataPointsPerSample Input - number of data points per sample
78     \param numSamples Input - number of samples
79 jgs 82 */
80 woo409 757 ESCRIPT_DLL_API int numSamplesEqual(escriptDataC* data, int numDataPointsPerSample,
81 jgs 82 int numSamples);
82    
83     /**
84     \brief
85 ksteube 1312 Returns the number of data points per sample
86     \param data Input - C wrapper for Data.
87     */
88     ESCRIPT_DLL_API int getNumDataPointsPerSample(escriptDataC* data);
89    
90     /**
91     \brief
92 jgs 82 Returns the rank of the point data for the data.
93     \param data Input - C wrapper for Data.
94     */
95 woo409 757 ESCRIPT_DLL_API int getDataPointRank(escriptDataC* data);
96 jgs 82
97     /**
98     \brief
99 jgs 121 Returns the value of the i-th component of the shape of the point data.
100 jgs 82 \param data Input - C wrapper for Data.
101 jgs 121 \param i Input - index of shape component.
102 jgs 82 */
103 woo409 757 ESCRIPT_DLL_API int getDataPointShape(escriptDataC* data,int i);
104 jgs 82
105     /**
106     \brief
107     Return the number of doubles needed for each data point.
108     \param data Input - C wrapper for Data.
109     */
110 woo409 757 ESCRIPT_DLL_API int getDataPointSize(escriptDataC* data);
111 jfenwick 2271
112     /*
113 jgs 82 \brief
114     Return the number of doubles stored for the Data object.
115     Argument data may be NULL, in which case 0 is returnd.
116     \param data Input - C wrapper for Data.
117 jfenwick 2271
118     This function has been removed because it does not make sense for LazyData
119 jgs 82 */
120 jfenwick 2271 /*ESCRIPT_DLL_API int getLength(escriptDataC* data);*/
121    
122 jgs 82 /**
123     \brief
124 jfenwick 2271 Return true if data can be treated as expanded.
125    
126 jgs 82 Argument data may be NULL, in which case false is returnd.
127     \param data Input - C wrapper for Data.
128 jfenwick 2271 \return true if data is expanded or the data is lazy but would resolve to expanded. False otherwise.
129 jgs 82 */
130 woo409 757 ESCRIPT_DLL_API int isExpanded(escriptDataC* data);
131 jfenwick 2519
132 jgs 82 /**
133     \brief
134     Return a pointer to the data for the given sample number.
135     if data is empty NULL is returned.
136     data may be NULL, in which case NULL is returnd.
137     \param data Input - C wrapper for Data.
138     \param sampleNo Input - The sample number.
139 jfenwick 2519
140 jgs 82 */
141 jfenwick 2770 ESCRIPT_DLL_API double __const * getSampleDataRO(escriptDataC* data, int sampleNo);
142 jfenwick 2271 /* Placement of __const might be important. See .cpp */
143    
144    
145     ESCRIPT_DLL_API double* getSampleDataRW(escriptDataC* data, int sampleNo);
146    
147    
148 ksteube 1312 /**
149     \brief
150     Return a pointer to the data for the given sample number.
151 jfenwick 2271 Fast version of getSampledataRO: does no error checking.
152 ksteube 1312 \param data Input - C wrapper for Data.
153     \param sampleNo Input - The sample number.
154 jfenwick 2519
155 ksteube 1312 */
156 jfenwick 2770 ESCRIPT_DLL_API double __const* getSampleDataROFast(escriptDataC* data, int sampleNo);
157 jfenwick 2271
158     /**
159     \brief
160     Return a pointer to the data for the given sample number.
161     Fast version of getSampledataRW: does no error checking.
162     \param data Input - C wrapper for Data.
163     \param sampleNo Input - The sample number.
164     */
165     ESCRIPT_DLL_API double* getSampleDataRWFast(escriptDataC* data, int sampleNo);
166    
167    
168     /**
169 jfenwick 2384 \brief
170     Return getSampleDataRWFast(escriptDataC* data, 0) if there are samples.
171     if not, returns NULL.
172     \warning This function calls requireWrite if there are samples so do not use in parallel sections.
173     \warning Please do not use this in new code.
174     \param data Input - C wrapper for Data.
175     */
176     ESCRIPT_DLL_API double* getDataRW(escriptDataC* data);
177    
178    
179     /**
180 jfenwick 2271 \brief Ensure that this object is ready for writing.
181     It will be resolved and copied if it is currently shared.
182     Use only in single threaded sections of code.
183     Do not create new Data objects based on this one between this call and
184     writing to the object.
185     */
186     ESCRIPT_DLL_API void requireWrite(escriptDataC* data);
187    
188 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26