28 #ifndef _UgridUtilities_h
29 #define _UgridUtilities_h 1
31 #include <gridfields/array.h>
45 #define CF_ROLE "cf_role"
46 #define CF_STANDARD_NAME "standard_name"
47 #define UGRID_MESH_TOPOLOGY "mesh_topology"
48 #define UGRID_NODE_COORDINATES "node_coordinates"
49 #define UGRID_FACE_NODE_CONNECTIVITY "face_node_connectivity"
51 #define UGRID_TOPOLOGY_DIMENSION "topology_dimension"
52 #define UGRID_LOCATION "location"
53 #define UGRID_GRID_LOCATION "grid_location"
54 #define UGRID_NODE "node"
55 #define UGRID_EDGE "edge"
56 #define UGRID_FACE "face"
57 #define UGRID_MESH "mesh"
58 #define UGRID_START_INDEX "start_index"
63 #define UGRID_EDGE_NODE_CONNECTIVITY "edge_node_connectivity"
66 #define UGRID_FACE_COORDINATES "face_coordinates"
67 #define UGRID_EDGE_COORDINATES "edge_coordinates"
68 #define UGRID_FACE_EDGE_CONNECTIVITY "face_edge_connectivity"
69 #define UGRID_FACE_FACE_CONNECTIVITY "face_face_connectivity"
71 GF::Array *
extractGridFieldArray(libdap::Array *a, vector<int*> *sharedIntArrays, vector<float*> *sharedFloatArrays);
72 GF::Array *
newGFIndexArray(
string name,
long size, vector<int*> *sharedIntArrays);
78 int length = a->length();
80 DODS *src =
new DODS[length];
84 T *dest =
new T[length];
86 for (
int i = 0; i < length; ++i)
101 if ((a->type() == dods_array_c && !a->var()->is_simple_type())
102 || a->var()->type() == dods_str_c || a->var()->type() == dods_url_c)
103 throw Error(malformed_expr,
104 "The function requires a DAP numeric-type array argument.");
113 throw InternalErr(__FILE__, __LINE__,
114 string(
"The Array '") + a->name()
115 +
"'does not contain values. send_read_p() not called?");
123 switch (a->var()->type()) {
125 return extract_array_helper<dods_byte, T>(a);
128 return extract_array_helper<dods_uint16, T>(a);
131 return extract_array_helper<dods_int16, T>(a);
134 return extract_array_helper<dods_uint32, T>(a);
137 return extract_array_helper<dods_int32, T>(a);
141 return extract_array_helper<dods_float32, T>(a);
144 return extract_array_helper<dods_float64, T>(a);
147 throw InternalErr(__FILE__, __LINE__,
148 "The argument list built by the CE parser contained an unsupported numeric type.");
162 vector<string> split(
const string &s,
char delim);
163 vector<string> &split(
const string &s,
char delim, vector<string> &elems);
175 #endif // _UgridUtilities_h
libdap::Type getGridfieldsReturnType(libdap::Type type)
GF::Array * extractGridFieldArray(libdap::Array *a, vector< int * > *sharedIntArrays, vector< float * > *sharedFloatArrays)
Extract data from a DAP array and return those values in a gridfields array.
GF::Array * newGFIndexArray(string name, long size, vector< int * > *sharedIntArrays)
static class NCMLUtil overview
int getNfrom3byNArray(libdap::Array *array)
Retrieves the size of the second dimension from a 3xN array.
bool checkAttributeValue(libdap::BaseType *bt, string aName, string aValue)
T * extractArray(libdap::Array *a)
Given a pointer to an Array that holds a numeric type, extract the values and return in an array of T...
T * extract_array_helper(libdap::Array *a)
DAP Array data extraction helper method.
string getAttributeValue(libdap::BaseType *bt, string aName)
bool matchesCfRoleOrStandardName(libdap::BaseType *bt, string aValue)