MeshLink
Computational geometry access
MeshString.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (c) 2019-2020 Pointwise, Inc.
4  * All rights reserved.
5  *
6  * This sample Pointwise source code is not supported by Pointwise, Inc.
7  * It is provided freely for demonstration purposes only.
8  * SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE.
9  *
10  ***************************************************************************/
11 
12 #ifndef MESH_STRING_CLASS
13 #define MESH_STRING_CLASS
14 
15 #include "Types.h"
16 #include "MeshTopo.h"
17 
18 #include <algorithm>
19 #include <map>
20 #include <string>
21 
22 /****************************************************************************
23  * MeshString class
24  ***************************************************************************/
33 class ML_STORAGE_CLASS MeshString : public MeshTopo {
34 public:
35  friend class MeshAssociativity;
36  friend class MeshModel;
37 
44  MeshString(
45  MLINT mid,
46  MLINT aref,
47  MLINT gref,
48  const std::string &name);
49 
57  MeshString(
58  const std::string &ref,
59  MLINT mid,
60  MLINT aref,
61  MLINT gref,
62  const std::string &name);
63 
73  virtual bool addEdge(MLINT i1, MLINT i2,
74  MLINT mid,
75  MLINT aref,
76  MLINT gref,
77  const std::string &name,
78  ParamVertex *pv1, ParamVertex *pv2, bool mapID);
79 
89  virtual bool addEdge(
90  const std::string &ref,
91  MLINT mid,
92  MLINT aref,
93  MLINT gref,
94  const std::string &name,
95  ParamVertex *pv1, ParamVertex *pv2, bool mapID);
96 
100  virtual MeshEdge *findEdgeByInds(MLINT i1, MLINT i2) const;
101 
105  virtual void deleteEdgeByInds(MLINT i1, MLINT i2);
106 
110  virtual MeshEdge * getMeshEdgeByName(const std::string &name) const;
111 
113  //
115  virtual MeshEdge * getMeshEdgeByRef(const std::string &ref) const;
116 
118  virtual MLINT getNumEdges() const;
119 
123  virtual void getMeshEdges(std::vector<const MeshEdge *> &edges) const;
124 
126  MeshString();
128  ~MeshString();
129 
131  virtual const std::string &getBaseName() const;
133  virtual MLUINT &getNameCounter();
134 
135 private:
138 
140  std::map<pwiFnvHash::FNVHash, MeshPoint*> pointMap_; // not the owner
145 
147  std::map<pwiFnvHash::FNVHash, MeshEdge*> edgeMap_; // not the owner
154 
157 };
158 
159 typedef std::map<std::string, MeshString *> MeshStringNameMap;
160 
161 #endif
162 
163 /****************************************************************************
164  *
165  * DISCLAIMER:
166  * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, POINTWISE DISCLAIMS
167  * ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED
168  * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
169  * PURPOSE, WITH REGARD TO THIS SCRIPT. TO THE MAXIMUM EXTENT PERMITTED
170  * BY APPLICABLE LAW, IN NO EVENT SHALL POINTWISE BE LIABLE TO ANY PARTY
171  * FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
172  * WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
173  * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE
174  * USE OF OR INABILITY TO USE THIS SCRIPT EVEN IF POINTWISE HAS BEEN
175  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE
176  * FAULT OR NEGLIGENCE OF POINTWISE.
177  *
178  ***************************************************************************/
void deleteEdgeByInds(MLINT i1, MLINT i2)
Delete an MeshEdge from the MeshModel by point indices.
std::map< std::string, MeshEdge * > MeshEdgeNameMap
Definition: MeshTopo.h:534
static MLUINT nameCounter_
The unique name counter for strings.
Definition: MeshString.h:137
std::map< pwiFnvHash::FNVHash, MeshPoint * > pointMap_
Map point index hash to point.
Definition: MeshString.h:140
MeshTopoIDToNameMap meshEdgeIDToNameMap_
Map edge unique ID to edge name.
Definition: MeshString.h:151
MeshTopoRefToNameMap meshEdgeRefToNameMap_
Map edge application-defined reference string th edge name.
Definition: MeshString.h:153
Storage for mesh topology and geometry associativity data.
MLUINT64 MLUINT
Standard unsigned integer - value depends on IS64BIT macro.
Definition: Types.h:122
bool addEdge(MLINT i1, MLINT i2, MLINT mid, MLINT aref, MLINT gref, std::string &name, ParamVertex *pv1, ParamVertex *pv2, bool mapID)
Add a MeshEdge to the MeshModel using indices.
MLINT getNumEdges() const
Return the number of edges in the MeshModel.
MLUINT edgeCounter_
Serial counter as edges are added to the string (zero-based)
Definition: MeshString.h:156
3D (volume) mesh topology
Definition: MeshModel.h:38
1D (curve) mesh topology
Definition: MeshString.h:33
MeshEdge * getMeshEdgeByRef(const std::string &ref) const
Find a MeshEdge by reference.
std::map< std::string, std::string > MeshTopoRefToNameMap
Definition: MeshTopo.h:308
std::map< std::string, MeshString * > MeshStringNameMap
Definition: MeshString.h:159
MeshPointNameMap meshPointNameMap_
Map point name to point.
Definition: MeshString.h:142
std::map< pwiFnvHash::FNVHash, MeshEdge * > edgeMap_
Map edge indices hash to edge.
Definition: MeshString.h:147
MeshTopoIDToNameMap meshPointIDToNameMap_
Map point ID to point name.
Definition: MeshString.h:144
std::map< MLINT, std::string > MeshTopoIDToNameMap
Definition: MeshTopo.h:304
virtual MLUINT & getNameCounter()
Returns the current value of the counter used for generating unique mesh entity names.
1-D (edge) mesh entity
Definition: MeshTopo.h:421
virtual const std::string & getBaseName() const
Returns the base name used for generating unique mesh entity names.
MeshEdge * getMeshEdgeByName(const std::string &name) const
Find a MeshEdge by name.
std::map< std::string, MeshPoint * > MeshPointNameMap
Definition: MeshTopo.h:408
MeshEdgeNameMap meshEdgeNameMap_
Map edge name to edge.
Definition: MeshString.h:149
MeshEdge * findEdgeByInds(MLINT i1, MLINT i2) const
Find an edge in the MeshString associativity data.
Base class for mesh topology entities.
Definition: MeshTopo.h:132
Parametric geometry data.
Definition: MeshTopo.h:69
MLINT64 MLINT
Standard integer - value depends on IS64BIT macro.
Definition: Types.h:120
void getMeshEdges(std::vector< const MeshEdge * > &edges) const
Return list of MeshEdge in the MeshModel.