bes  Updated for version 3.20.6
TwoDMeshTopology.h
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 libdap;
37 
38 namespace libdap {
39 class BaseType;
40 class Array;
41 class MeshDataVariable;
42 class Grid;
43 }
44 
45 namespace ugrid {
46 
52 
53 private:
59  BaseType *d_meshVar;
60 
67  string dimension;
68 
77  vector<libdap::Array *> *nodeCoordinateArrays;
78  string nodeDimensionName;
79  int nodeCount;
80 
111  libdap::Array *faceNodeConnectivityArray;
112  libdap::Array::Dim_iter fncNodesDim, fncFacesDim;
113  string faceDimensionName;
114  int faceCount;
115 
116  vector<MeshDataVariable *> *rangeDataArrays;
117 
130  //string edgeNodeConnectivityArrayName;
141  //string faceEdgeConnectivityArrayName;
142  //Array *faceEdgeConnectivityArray;
154  //string faceFaceConnectivityArrayName;
155  //Array *faceFaceConnectivityArray;
166  // Not used. jhrg 4/15/15 vector<string> *faceCoordinateNames;
167  vector<libdap::Array *> *faceCoordinateArrays;
168 
179  //vector<string> *edgeCoordinateNames;
180  //vector<Array *> *edgeCoordinateArrays;
181  GF::Grid *gridTopology;
182  GF::GridField *d_inputGridField;
183  GF::GridField *resultGridField;
184 
185  vector<int *> *sharedIntArrays;
186  vector<float *> *sharedFloatArrays;
187 
188  vector<GF::Array *> gfArrays;
189 
190  GF::Node *fncCellArray;
191 
192  bool _initialized;
193 
194  void ingestFaceNodeConnectivityArray(libdap::BaseType *meshTopology, libdap::DDS *dds);
195  void ingestNodeCoordinateArrays(libdap::BaseType *meshTopology, libdap::DDS *dds);
196  void ingestFaceCoordinateArrays(libdap::BaseType *meshTopology, libdap::DDS *dds);
197 
198  GF::Node *getFncArrayAsGFCells(libdap::Array *fncVar);
199  int getStartIndex(libdap::Array *array);
200  GF::CellArray *getFaceNodeConnectivityCells();
201 
202  libdap::Array *getGFAttributeAsDapArray(libdap::Array *sourceArray, locationType rank,
203  GF::GridField *resultGridField);
204  libdap::Array *getGridFieldCellArrayAsDapArray(GF::GridField *resultGridField, libdap::Array *sourceFcnArray);
205  // libdap::Array *getNewFncDapArray(libdap::Array *templateArray, int N);
206 
207  void setNodeCoordinateDimension(MeshDataVariable *mdv);
208  void setFaceCoordinateDimension(MeshDataVariable *mdv);
209 
210 public:
212  ~TwoDMeshTopology();
213 
214  void init(string meshVarName, libdap::DDS *dds);
215 
216  string meshVarName() const
217  {
218  return getMeshVariable()->name();
219  }
220 
221  libdap::BaseType *getMeshVariable() const
222  {
223  return d_meshVar;
224  }
225 
226  void buildBasicGfTopology();
227  void applyRestrictOperator(locationType loc, string filterExpression);
228 
229  int getInputGridSize(locationType location);
230  int getResultGridSize(locationType location);
231 
232  void convertResultGridFieldStructureToDapObjects(vector<libdap::BaseType *> *results);
233 
234  void setLocationCoordinateDimension(MeshDataVariable *mdv);
235 
236  void addIndexVariable(locationType location);
237  void getResultIndex(locationType location, void *target);
238 
239  void getResultGFAttributeValues(string attrName, libdap::Type type, locationType rank, void *target);
240 };
241 
242 } // namespace ugrid
243 
244 #endif // _TwoDMeshTopology_h
ugrid::MeshDataVariable
Definition: MeshDataVariable.h:39
Type
Type
Type of JSON value.
Definition: cmr_module/rapidjson/rapidjson.h:603
libdap
Definition: BESDapFunctionResponseCache.h:35
ugrid::TwoDMeshTopology
Definition: TwoDMeshTopology.h:51