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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 615 - (show annotations)
Wed Mar 22 02:12:00 2006 UTC (13 years, 11 months ago) by elspeth
File MIME type: text/plain
File size: 3966 byte(s)
More copyright information.

1 /* $Id$ */
2 /*
3 ************************************************************
4 * Copyright 2006 by ACcESS MNRF *
5 * *
6 * http://www.access.edu.au *
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 ************************************************************
12 */
13
14 #if !defined escript_DataC_20040611_H
15 #define escript_DataC_20040611_H
16
17 #define ESCRIPT_MAX_DATA_RANK 4
18 /**
19 \brief
20 Provide a wrapper around a Data object so Data may be accessed from C.
21
22 Description:
23 Provide a wrapper around a Data object so Data may be accessed from C.
24
25 */
26 struct escriptDataC {
27 void* m_dataPtr;
28 };
29
30 typedef struct escriptDataC escriptDataC;
31
32 /**
33 \brief
34 Return the function space type code.
35 \param data Input - C wrapper for Data.
36 */
37 int getFunctionSpaceType(escriptDataC* data);
38
39 /**
40 \brief
41 sets the int variable _fs_ the function space type of _data_ if the data are not empty.
42 \param _fs_ Input/Output - variable to be updated.
43 \param _data_ Input - C wrapper for Data.
44 */
45 #define updateFunctionSpaceType(_fs_,_data_) _fs_=(isEmpty(_data_) ? _fs_ : getFunctionSpaceType(_data_))
46
47 /**
48 \brief
49 is true if the function space type of _data_ is equal to _fs_ or is empty
50 \param _fs_ Input - function space type to checked against
51 \param _data_ Input - C wrapper for Data.
52 */
53 #define functionSpaceTypeEqual(_fs_,_data_) ( (isEmpty(_data_) || _fs_==getFunctionSpaceType(_data_)) ) ? 1 : 0
54
55 /**
56 \brief
57 Returns the true if the data are empty or data is NULL.
58 \param data Input - C wrapper for Data.
59 */
60 int isEmpty(escriptDataC* data);
61
62 /**
63 \brief
64 Return true if the input shape matches the data point shape for data
65 \param data Input - C wrapper for Data.
66 \param rank Input - number of dimensions.
67 \param dimensions Input -
68 */
69 int isDataPointShapeEqual(escriptDataC* data, int rank, int* dimensions);
70 /**
71 \brief
72 Return true if the number of data points per sample and the number
73 of samples equal the input values. In the case that data is empty or NULL,
74 true is returned.
75 \param data Input - C wrapper for Data.
76 \param numDataPointsPerSample Input - number of data points per sample
77 \param numSamples Input - number of samples
78 */
79 int numSamplesEqual(escriptDataC* data, int numDataPointsPerSample,
80 int numSamples);
81
82 /**
83 \brief
84 Returns the rank of the point data for the data.
85 \param data Input - C wrapper for Data.
86 */
87 int getDataPointRank(escriptDataC* data);
88
89 /**
90 \brief
91 Returns the value of the i-th component of the shape of the point data.
92 \param data Input - C wrapper for Data.
93 \param i Input - index of shape component.
94 */
95 int getDataPointShape(escriptDataC* data,int i);
96
97 /**
98 \brief
99 Return the number of doubles needed for each data point.
100 \param data Input - C wrapper for Data.
101 */
102 int getDataPointSize(escriptDataC* data);
103 /**
104 \brief
105 Return the number of doubles stored for the Data object.
106 Argument data may be NULL, in which case 0 is returnd.
107 \param data Input - C wrapper for Data.
108 */
109 int getLength(escriptDataC* data);
110 /**
111 \brief
112 Return true if data is expanded.
113 Argument data may be NULL, in which case false is returnd.
114 \param data Input - C wrapper for Data.
115 */
116 int isExpanded(escriptDataC* data);
117 /**
118 \brief
119 Return a pointer to the data for the given sample number.
120 if data is empty NULL is returned.
121 data may be NULL, in which case NULL is returnd.
122 \param data Input - C wrapper for Data.
123 \param sampleNo Input - The sample number.
124 */
125 double* getSampleData(escriptDataC* data, int sampleNo);
126
127 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26