OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
TwoDMeshTopology.h
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset:4 -*-
2 
3 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
4 // Access Protocol.
5 
6 // Copyright (c) 2002,2003,2011,2012 OPeNDAP, Inc.
7 // Authors: Nathan Potter <ndp@opendap.org>
8 // James Gallagher <jgallagher@opendap.org>
9 // Scott Moe <smeest1@gmail.com>
10 // Bill Howe <billhowe@cs.washington.edu>
11 //
12 // This library is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU Lesser General Public
14 // License as published by the Free Software Foundation; either
15 // version 2.1 of the License, or (at your option) any later version.
16 //
17 // This library is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public
23 // License along with this library; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 //
26 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
27 
28 #ifndef _TwoDMeshTopology_h
29 #define _TwoDMeshTopology_h 1
30 
31 #include <gridfields/type.h>
32 #include <gridfields/gridfield.h>
33 #include <gridfields/grid.h>
34 #include <gridfields/cellarray.h>
35 
36 using namespace std;
37 using namespace libdap;
38 
39 namespace libdap {
40  class BaseType;
41  class Array;
42  class MeshDataVariable;
43  class Grid;
44 }
45 
46 namespace ugrid {
47 
53 {
54 
55 private:
61  BaseType *d_myMeshVar;
62 
69  string dimension;
70 
71 
72 
73 
74 
83  vector<libdap::Array *> *nodeCoordinateArrays;
84  string nodeDimensionName;
85  int nodeCount;
86 
118  libdap::Array *faceNodeConnectivityArray;
119  libdap::Array::Dim_iter fncNodesDim, fncFacesDim;
120  string faceDimensionName;
121  int faceCount;
122 
123  vector<MeshDataVariable *> *rangeDataArrays;
124 
137  //string edgeNodeConnectivityArrayName;
138 
149  //string faceEdgeConnectivityArrayName;
150  //Array *faceEdgeConnectivityArray;
151 
163  //string faceFaceConnectivityArrayName;
164  //Array *faceFaceConnectivityArray;
165 
176  vector<string> *faceCoordinateNames;
177  vector<libdap::Array *> *faceCoordinateArrays;
178 
189  //vector<string> *edgeCoordinateNames;
190  //vector<Array *> *edgeCoordinateArrays;
191 
192  GF::Grid *gridTopology;
193  GF::GridField *d_inputGridField;
194  GF::GridField *resultGridField;
195 
196  vector <int *> *sharedIntArrays;
197  vector<float *> *sharedFloatArrays;
198 
199  vector<GF::Array *> gfArrays;
200 
201  GF::Node *fncCellArray;
202 
203  bool _initialized;
204 
205 
206  void ingestFaceNodeConnectivityArray(libdap::BaseType *meshTopology, libdap::DDS *dds);
207  void ingestNodeCoordinateArrays(libdap::BaseType *meshTopology, libdap::DDS *dds);
208  void ingestFaceCoordinateArrays(libdap::BaseType *meshTopology, libdap::DDS *dds);
209 
210  GF::Node *getFncArrayAsGFCells(libdap::Array *fncVar);
211  int getStartIndex(libdap::Array *array);
212  GF::CellArray *getFaceNodeConnectivityCells();
213 
214  libdap::Array *getGFAttributeAsDapArray(libdap::Array *sourceArray, locationType rank, GF::GridField *resultGridField);
215  libdap::Array *getGridFieldCellArrayAsDapArray(GF::GridField *resultGridField, libdap::Array *sourceFcnArray);
216  libdap::Array *getNewFncDapArray(libdap::Array *templateArray, int N);
217 
218 
219  void setNodeCoordinateDimension(MeshDataVariable *mdv);
220  void setFaceCoordinateDimension(MeshDataVariable *mdv);
221 
222 public:
223  TwoDMeshTopology(string meshVarName, DDS &dds);
225  ~TwoDMeshTopology();
226  void init(string meshVarName, libdap::DDS *dds);
227  // void addDataVariable(MeshDataVariable *mdt);
228  string name(){ return getMeshVariable()->name();}
229  libdap::BaseType *getMeshVariable(){ return d_myMeshVar; }
230 
231  void buildBasicGfTopology();
232  void applyRestrictOperator(locationType loc, string filterExpression);
233  // void buildRestrictedGfTopology(locationType loc, string filterExpression);
234  // void buildGridFieldsTopology();
235 
236  int getInputGridSize(locationType location);
237  int getResultGridSize(locationType location);
238  // void convertResultGridFieldToDapObjects(vector<libdap::BaseType *> *results);
239  void convertResultGridFieldStructureToDapObjects(vector<libdap::BaseType *> *results);
240  // void convertResultRangeVarsToDapObjects(vector<BaseType *> *results);
241  // void restrictRange(vector<libdap::BaseType *> *results);
242  // libdap::Array *restrictDapArray(libdap::Array*, libdap::Array::Dim_iter locationCoordinateDim, locationType gridLocation);
243  void setLocationCoordinateDimension(MeshDataVariable *mdv);
244 
245  void addIndexVariable(locationType location);
246  void getResultIndex(locationType location, void *target);
247 
248  // void getResultGFAttributeValues(libdap::Array *templateArray, locationType rank, void *target);
249  void getResultGFAttributeValues(string attrName, libdap::Type type, locationType rank, void *target);
250 };
251 
252 } // namespace ugrid
253 
254 #endif // _TwoDMeshTopology_h
libdap::BaseType * getMeshVariable()
STL namespace.
static class NCMLUtil overview
locationType
Definition: LocationType.h:31
CURL * init(char *error_buffer)
Get's a new instance of CURL* and performs basic configuration of that instance.
Definition: curl_utils.cc:426
Identifies the location/rank/dimension that various grid components are associated with...