forked from i-RIC/iriclib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiriclib_cgnsfile_cc.cpp
154 lines (133 loc) · 4.08 KB
/
iriclib_cgnsfile_cc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include "error_macros.h"
#include "iriclib_cgnsfile.h"
#include "private/iriclib_cgnsfile_impl.h"
using namespace iRICLib;
int CgnsFile::CC_Read_Integer(const char *name, int* intvalue)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readArray("Value", Integer, 1, intvalue);
}
int CgnsFile::CC_Read_Real(const char *name, double* realvalue)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readArray("Value", RealDouble, 1, realvalue);
}
int CgnsFile::CC_Read_RealSingle(const char* name, float* realvalue)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readArrayAs("Value", RealSingle, 1, realvalue);
}
int CgnsFile::CC_Read_StringLen(const char *name, int* length)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readStringLen("Value", length);
}
int CgnsFile::CC_Read_String(const char *name, char* strvalue)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readString("Value", -1, strvalue);
}
int CgnsFile::CC_Read_FunctionalSize(const char *name, cgsize_t* size)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
int narrays;
ier = cg_narrays(&narrays);
RETURN_IF_ERR;
for (int i = 1; i <= narrays; ++i) {
char arrayname[Impl::NAME_MAXLENGTH];
DataType_t datatype;
int dim;
cgsize_t dimvec[Impl::MAX_DIMS];
ier = cg_array_info(i, arrayname, &datatype, &dim, dimvec);
*size = dimvec[0];
return 0;
}
return 1;
}
int CgnsFile::CC_Read_Functional(const char *name, double* x, double* y)
{
int ier;
ier = CC_Read_FunctionalWithName(name, "Param", x);
RETURN_IF_ERR;
ier = CC_Read_FunctionalWithName(name, "Value", y);
RETURN_IF_ERR;
return 0;
}
int CgnsFile::CC_Read_FunctionalWithName(const char *name, const char *paramname, double* data)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readArray(paramname, RealDouble, -1, data);
}
int CgnsFile::CC_Read_Functional_RealSingle(const char *name, float* x, float* y)
{
int ier;
ier = CC_Read_FunctionalWithName_RealSingle(name, "Param", x);
RETURN_IF_ERR;
ier = CC_Read_FunctionalWithName_RealSingle(name, "Value", y);
RETURN_IF_ERR;
return 0;
}
int CgnsFile::CC_Read_FunctionalWithName_RealSingle(const char* name, const char* paramname, float* data)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readArrayAs(paramname, RealSingle, -1, data);
}
int CgnsFile::CC_Read_FunctionalWithName_String(const char *name, const char *paramname, char* strvalue)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readString(paramname, -1, strvalue);
}
int CgnsFile::CC_Read_FunctionalWithName_StringLen(const char* name, const char* paramname, int* length)
{
int ier = impl->gotoCCChild(name);
RETURN_IF_ERR;
return Impl::readStringLen(paramname, length);
}
int CgnsFile::CC_Write_Integer(const char *name, int intvalue)
{
int ier = impl->gotoCCChildCreateIfNotExist(name);
RETURN_IF_ERR;
return Impl::writeArray("Value", Integer, 1, &intvalue);
}
int CgnsFile::CC_Write_Real(const char *name, double realvalue)
{
int ier = impl->gotoCCChildCreateIfNotExist(name);
RETURN_IF_ERR;
return Impl::writeArray("Value", RealDouble, 1, &realvalue);
}
int CgnsFile::CC_Write_String(const char *name, const char* strvalue)
{
int ier = impl->gotoCCChildCreateIfNotExist(name);
RETURN_IF_ERR;
return Impl::writeString("Value", strvalue);
}
int CgnsFile::CC_Write_Functional(const char *name, int length, double* realarray_x, double* realarray_y)
{
int ier;
ier = CC_Write_FunctionalWithName(name, "Param", length, realarray_x);
RETURN_IF_ERR;
ier = CC_Write_FunctionalWithName(name, "Value", length, realarray_y);
RETURN_IF_ERR;
return 0;
}
int CgnsFile::CC_Write_FunctionalWithName_String(const char* name, const char* paramname, const char* value)
{
int ier = impl->gotoCCChildCreateIfNotExist(name);
RETURN_IF_ERR;
return Impl::writeString(paramname, value);
}
int CgnsFile::CC_Write_FunctionalWithName(const char *name, const char* paramname, int length, double* data)
{
int ier = impl->gotoCCChildCreateIfNotExist(name);
RETURN_IF_ERR;
return Impl::writeArray(paramname, RealDouble, length, data);
}