Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
moab::Intx2MeshEdges Class Reference

#include <Intx2MeshEdges.hpp>

+ Inheritance diagram for moab::Intx2MeshEdges:
+ Collaboration diagram for moab::Intx2MeshEdges:

Public Member Functions

 Intx2MeshEdges (Interface *mbimpl, IntxAreaUtils::AreaMethod amethod=IntxAreaUtils::lHuiller)
 
virtual ~Intx2MeshEdges ()
 
ErrorCode EdgeSplits (double areaTolerance)
 
- Public Member Functions inherited from moab::Intx2MeshOnSphere
 Intx2MeshOnSphere (Interface *mbimpl, IntxAreaUtils::AreaMethod amethod=IntxAreaUtils::lHuiller)
 
virtual ~Intx2MeshOnSphere ()
 
void set_radius_source_mesh (double radius)
 
void set_radius_destination_mesh (double radius)
 
double setup_tgt_cell (EntityHandle tgt, int &nsTgt)
 
ErrorCode computeIntersectionBetweenTgtAndSrc (EntityHandle tgt, EntityHandle src, double *P, int &nP, double &area, int markb[MAXEDGES], int markr[MAXEDGES], int &nsSrc, int &nsTgt, bool check_boxes_first=false)
 
ErrorCode findNodes (EntityHandle tgt, int nsTgt, EntityHandle src, int nsSrc, double *iP, int nP)
 
ErrorCode update_tracer_data (EntityHandle out_set, Tag &tagElem, Tag &tagArea)
 
- Public Member Functions inherited from moab::Intx2Mesh
 Intx2Mesh (Interface *mbimpl)
 
virtual ~Intx2Mesh ()
 
ErrorCode intersect_meshes (EntityHandle mbs1, EntityHandle mbs2, EntityHandle &outputSet)
 
ErrorCode intersect_meshes_kdtree (EntityHandle mbset1, EntityHandle mbset2, EntityHandle &outputSet)
 
virtual ErrorCode FindMaxEdgesInSet (EntityHandle eset, int &max_edges)
 
virtual ErrorCode FindMaxEdges (EntityHandle set1, EntityHandle set2)
 
virtual ErrorCode createTags ()
 
virtual ErrorCode filterByMask (Range &cells)
 
ErrorCode DetermineOrderedNeighbors (EntityHandle inputSet, int max_edges, Tag &neighTag)
 
void set_error_tolerance (double eps)
 
void clean ()
 
void set_box_error (double berror)
 
ErrorCode create_departure_mesh_2nd_alg (EntityHandle &euler_set, EntityHandle &covering_lagr_set)
 
ErrorCode create_departure_mesh_3rd_alg (EntityHandle &lagr_set, EntityHandle &covering_set)
 
void correct_polygon (EntityHandle *foundIds, int &nP)
 

Private Member Functions

ErrorCode orderSubEdges (std::vector< EntityHandle > &subEdges, std::vector< EntityHandle > &VerticesSubEdges, const EntityHandle *connEdge, std::vector< EntityHandle > &chainVertices, std::vector< int > &polygonIds, Tag otherParentTag)
 

Private Attributes

std::map< EntityHandle, std::vector< EntityHandle > > edgeVertices
 
std::map< EntityHandle, std::vector< int > > edgePolygons
 
Range recoveredCells
 

Additional Inherited Members

- Public Attributes inherited from moab::Intx2MeshOnSphere
const IntxAreaUtils::AreaMethod areaMethod
 
- Protected Attributes inherited from moab::Intx2Mesh
Interfacemb
 
EntityHandle mbs1
 
EntityHandle mbs2
 
Range rs1
 
Range rs2
 
EntityHandle outSet
 
Tag gid
 
Tag TgtFlagTag
 
Range TgtEdges
 
Tag tgtParentTag
 
Tag srcParentTag
 
Tag countTag
 
Tag srcNeighTag
 
Tag tgtNeighTag
 
Tag neighTgtEdgeTag
 
Tag orgSendProcTag
 
Tag imaskTag
 for coverage mesh, will store the original sender More...
 
const EntityHandletgtConn
 
const EntityHandlesrcConn
 
CartVect tgtCoords [MAXEDGES]
 
CartVect srcCoords [MAXEDGES]
 
double tgtCoords2D [MAXEDGES2]
 
double srcCoords2D [MAXEDGES2]
 
std::vector< std::vector< EntityHandle > * > extraNodesVec
 
double epsilon_1
 
double epsilon_area
 
std::vector< double > allBoxes
 
double box_error
 
EntityHandle localRoot
 
Range localEnts
 
unsigned int my_rank
 
int max_edges_1
 
int max_edges_2
 
int counting
 

Detailed Description

Definition at line 37 of file Intx2MeshEdges.hpp.

Constructor & Destructor Documentation

◆ Intx2MeshEdges()

moab::Intx2MeshEdges::Intx2MeshEdges ( Interface mbimpl,
IntxAreaUtils::AreaMethod  amethod = IntxAreaUtils::lHuiller 
)

Definition at line 16 of file Intx2MeshEdges.cpp.

17  : Intx2MeshOnSphere( mbimpl, amethod )
18 {
19 }

◆ ~Intx2MeshEdges()

moab::Intx2MeshEdges::~Intx2MeshEdges ( )
virtual

Definition at line 21 of file Intx2MeshEdges.cpp.

22 {
23  // TODO Auto-generated destructor stub
24 }

Member Function Documentation

◆ EdgeSplits()

ErrorCode moab::Intx2MeshEdges::EdgeSplits ( double  areaTolerance)

Definition at line 87 of file Intx2MeshEdges.cpp.

88 {
89 
90  Tag parentTag, otherParentTag;
91  ErrorCode rval;
92 
93  rval = mb->tag_get_handle( "TargetParent", parentTag );MB_CHK_SET_ERR( rval, "can't get parent target tag in edge map" );
94  rval = mb->tag_get_handle( "SourceParent", otherParentTag );MB_CHK_SET_ERR( rval, "can't get parent source tag in edge map" );
95 
96  Tag fractionTag;
97  rval = mb->tag_get_handle( "EdgeRecoveryFraction", fractionTag );MB_CHK_SET_ERR( rval, "can't get tag for recovery fraction" );
98  Tag subTag;
99  rval = mb->tag_get_handle( "NumSubEnts", subTag );MB_CHK_SET_ERR( rval, "can't get tag NumSubEdges" );
100  Tag areaDiffTag;
101  rval = mb->tag_get_handle( "AreaDiff", areaDiffTag );MB_CHK_SET_ERR( rval, "can't get tag AreaDiff" );
102  Tag areaTag;
103  rval = mb->tag_get_handle( "Area", areaTag );MB_CHK_SET_ERR( rval, "can't get tag Area" );
104 
105  Range parentCells;
106  rval = mb->get_entities_by_dimension( mbs2, 2, parentCells );MB_CHK_SET_ERR( rval, "can't get parent cells" );
107  Range initialEdges;
108  // we will assume the edges are already included in the target mesh
109  // we do not want to create them
110  rval = mb->get_adjacencies( parentCells, 1, false, initialEdges, Interface::UNION );MB_CHK_SET_ERR( rval, "can't get parent edges" );
111  std::cout << " number of original input edges:" << initialEdges.size() << "\n";
112 
113  // get all polygons in the intx set
114  Range cells;
115  rval = mb->get_entities_by_dimension( outSet, 2, cells );MB_CHK_SET_ERR( rval, "can't get intersection cells" );
116  // create all edges adjacent to the cells in the intx set
117  // some might be original edges from edge or target meshes
118  Range intxEdges;
119  rval = mb->get_adjacencies( cells, 1, true, intxEdges, Interface::UNION );MB_CHK_SET_ERR( rval, "can't create adjacent intx edges " );
120  std::cout << " number of intx edges:" << intxEdges.size() << "\n";
121 
122  // first, identify input polygons that are recovered fully
123  // get global ids of the initial cells
124  std::vector< int > parentGids( parentCells.size() );
125  Tag gidTag = mb->globalId_tag();
126  rval = mb->tag_get_data( gidTag, parentCells, &parentGids[0] );MB_CHK_SET_ERR( rval, "can't get parent global ids" );
127  std::map< int, double > initAreas; // get areas of those initial cells
128  int i = 0;
129  std::vector< double > coords( 3 * 20 ); // enough vertices, at most 30, good for intx polygons too
130  int num_nodes = 0; // num nodes in cells
131  const EntityHandle* verts;
132  IntxAreaUtils areaAdaptor( IntxAreaUtils::lHuiller ); // GaussQuadrature , lHuiller
133  std::map< int, double > recoveredAreas; // get areas of from intersection cells
134  std::map< int, EntityHandle > mapFromGIDToParent;
135  std::map< int, std::vector< EntityHandle > > mapFromParentGIDToIntxCells;
136  for( Range::iterator it = parentCells.begin(); it != parentCells.end(); ++it, i++ )
137  {
138  EntityHandle parentCell = *it;
139  rval = mb->get_connectivity( parentCell, verts, num_nodes );MB_CHK_SET_ERR( rval, "can't get connectivity of parent cell" );
140  // get coordinates
141  rval = mb->get_coords( verts, num_nodes, &coords[0] );MB_CHK_SET_ERR( rval, "can't get coords of parent cell" );
142 
143  double area = areaAdaptor.area_spherical_polygon( &coords[0], num_nodes, 1. );
144  rval = mb->tag_set_data( areaTag, &parentCell, 1, &area );MB_CHK_SET_ERR( rval, "can't set area Tag on parent cell" );
145  int parentID = parentGids[i];
146  initAreas[parentID] = area;
147  recoveredAreas[parentID] = 0.;
148  mapFromGIDToParent[parentID] = parentCell;
149  mapFromParentGIDToIntxCells[parentID]; // just initialize it with empty vector
150  }
151 
152  for( Range::iterator it = cells.begin(); it != cells.end(); ++it )
153  {
154  EntityHandle cell = *it;
155  rval = mb->get_connectivity( cell, verts, num_nodes );MB_CHK_SET_ERR( rval, "can't get connectivity of intx cell" );
156  // get coordinates
157  rval = mb->get_coords( verts, num_nodes, &coords[0] );MB_CHK_SET_ERR( rval, "can't get coods of intx cell" );
158  double intx_area = areaAdaptor.area_spherical_polygon( &coords[0], num_nodes, 1. );
159  int parentID = 0;
160  rval = mb->tag_get_data( parentTag, &cell, 1, &parentID );MB_CHK_SET_ERR( rval, "can't get parent Tag" );
161  recoveredAreas[parentID] += intx_area;
162  mapFromParentGIDToIntxCells[parentID].push_back( cell );
163  }
164  int recovered = 0, notRecovered = 0;
165  //Range recoveredCells;
166  for( size_t j = 0; j < parentGids.size(); j++ )
167  {
168  int parentID = parentGids[j];
169  EntityHandle parentCell = parentCells[j];
170  double areaDiff = initAreas[parentID] - recoveredAreas[parentID];
171  rval = mb->tag_set_data( areaDiffTag, &parentCell, 1, &areaDiff );MB_CHK_SET_ERR( rval, "can't set diff area Tag" );
172  double numIntxcells = static_cast< double >( mapFromParentGIDToIntxCells[parentID].size() );
173  rval = mb->tag_set_data( subTag, &parentCell, 1, &numIntxcells );MB_CHK_SET_ERR( rval, "can't set num sub ents Tag" );
174  if( fabs( areaDiff ) < areaTolerance )
175  {
176  recovered++;
177  recoveredCells.insert( parentCells[j] ); // should we use a std::vector, that will be ordered already ?
178  }
179  else
180  notRecovered++;
181  }
182  std::cout << "recovered initial cells: " << recovered << " vs:" << notRecovered << " not recovered \n";
183  // initial edges that should be decomposable from intx edges
184  Range recoverableEdges;
185  rval = mb->get_adjacencies( recoveredCells, 1, false, recoverableEdges, Interface::UNION );MB_CHK_SET_ERR( rval, "can't get recoverable edges" );
186 
187  // now recover each edge, looking at intx polygons forming one of the adjacent cells, that is in initial recoverable set
188  int recoveredEdges = 0;
189  int unrecovered = 0;
190  int identity_edges = 0; // edges that are formed by one intx edge, itself, the original
191  std::map< EntityHandle, std::vector< EntityHandle > > mapEdges;
192  for( Range::iterator eit = recoverableEdges.begin(); eit != recoverableEdges.end(); ++eit )
193  {
194  EntityHandle initialEdge = *eit;
195  // if this edge is among intxEdges, we are done
196  int index = intxEdges.index( initialEdge );
197  if( index >= 0 )
198  {
199  mapEdges[initialEdge].push_back( initialEdge );
200  identity_edges++;
201  recoveredEdges++;
202  double numSubEdges = 1.;
203  rval = mb->tag_set_data( subTag, &initialEdge, 1, &numSubEdges );MB_CHK_SET_ERR( rval, "can't set num sub ents Tag" );
204  // get vertices and intx poly attached to it
205  int nve = 0;
206  const EntityHandle* connCell;
207  rval = mb->get_connectivity( initialEdge, connCell, nve );MB_CHK_SET_ERR( rval, "can't get connectivity of parent cell" );
208  edgeVertices[initialEdge].push_back( connCell[0] );
209  edgeVertices[initialEdge].push_back( connCell[1] );
210  // find cells in intx set adjacent to it, and get the other tag parent
211  Range adjPolys;
212  rval = mb->get_adjacencies( &initialEdge, 1, 2, false, adjPolys, Interface::UNION );MB_CHK_SET_ERR( rval, "can't get adj polys" );
213  adjPolys = subtract( adjPolys, parentCells );
214  if( adjPolys.empty() ) MB_CHK_SET_ERR( MB_FAILURE, "no adjacent intx cells" );
215  EntityHandle intxPoly = adjPolys[0];
216  // get its parent tag
217  int gid;
218  rval = mb->tag_get_data( otherParentTag, &intxPoly, 1, &gid );MB_CHK_SET_ERR( rval, "can't get global id from other tag" );
219  edgePolygons[initialEdge].push_back( gid );
220  continue; // no need to sweat it anymore
221  }
222  // get adjacent polygons; if there is an adj polygon in intx cells, we are done; if not, get one in the initial recoveredCells range
223  Range initialAdjCells;
224  rval = mb->get_adjacencies( &initialEdge, 1, 2, false, initialAdjCells, Interface::UNION );MB_CHK_SET_ERR( rval, "can't get adjacent initial cells" );
225  if( initialAdjCells.size() == 0 ) MB_CHK_SET_ERR( MB_FAILURE, "no adjacent initial cells" );
226  // intersect with recoveredCells
227  Range adjRecoveredInitialCell = intersect( initialAdjCells, recoveredCells );
228  if( adjRecoveredInitialCell.size() == 0 )
229  MB_CHK_SET_ERR( MB_FAILURE, "no adjacent initial cells that are recovered" );
230  // get all edges adjacent to intersection polygons that form one of the recovered initial cell
231  EntityHandle recoveredCell = adjRecoveredInitialCell[0]; // first one
232  int nv = 0;
233  const EntityHandle* connCell;
234  rval = mb->get_connectivity( recoveredCell, connCell, nv );MB_CHK_SET_ERR( rval, "can't get connectivity of parent cell" );
235  int cellGlobalId = 0;
236  rval = mb->tag_get_data( gidTag, &recoveredCell, 1, &cellGlobalId );MB_CHK_SET_ERR( rval, "can't get id of parent cell" );
237  // list of intx polygons in it:
238  std::vector< EntityHandle >& listIntxCells = mapFromParentGIDToIntxCells[cellGlobalId];
239  std::vector< EntityHandle > candidateEdges;
240  rval =
241  mb->get_adjacencies( &listIntxCells[0], listIntxCells.size(), 1, false, candidateEdges, Interface::UNION );MB_CHK_SET_ERR( rval, "can't get adj edges" );
242  // add all edges that have both vertices on the original edge
243  CartVect verticesOriginal[2];
244  const EntityHandle* connEdge;
245  int numVerts = 0;
246  rval = mb->get_connectivity( initialEdge, connEdge, numVerts );MB_CHK_SET_ERR( rval, "can't get connectivity of initial edge" );
247 
248  rval = mb->get_coords( connEdge, numVerts, verticesOriginal[0].array() );MB_CHK_SET_ERR( rval, "can't get coordinates of vertices of initial edge" );
249  // get gnomonic plane for the start of the edge
250  int gnomonicPlane = 0;
251  IntxUtils::decide_gnomonic_plane( verticesOriginal[0], gnomonicPlane );
252  double coords2D[6]; // coords in gnomonic plane, for interior point decision
253  rval = IntxUtils::gnomonic_projection( verticesOriginal[0], 1.0, gnomonicPlane, coords2D[0], coords2D[1] );MB_CHK_SET_ERR( rval, "can't get gnomonic coords" );
254  rval = IntxUtils::gnomonic_projection( verticesOriginal[1], 1.0, gnomonicPlane, coords2D[2], coords2D[3] );MB_CHK_SET_ERR( rval, "can't get gnomonic coords" );
255 
256  double edgeLength =
257  angle_robust( verticesOriginal[0], verticesOriginal[1] ); // distance on sphere of radius 1 is the angle
258  // loop now over candidateEdges
259  double recoveredLength = 0.;
260  std::vector< EntityHandle > VerticesSubEdges; // push all vertices here, so we can order the subedges later
261  for( size_t i = 0; i < candidateEdges.size(); i++ )
262  {
263  EntityHandle subedge = candidateEdges[i];
264  // get its vertex coordinates:
265  const EntityHandle* connEdge2;
266  rval = mb->get_connectivity( subedge, connEdge2, numVerts );MB_CHK_SET_ERR( rval, "can't get connectivity of candidate edge" );
267  CartVect verticesSubEdge[2];
268  rval = mb->get_coords( connEdge2, numVerts, verticesSubEdge[0].array() );MB_CHK_SET_ERR( rval, "can't get coordinates of vertices of initial edge" );
269  // decide if they are on the initial edge (form an angle)
270  bool onEdge = true;
271  for( int j = 0; j < 2 && onEdge; j++ )
272  {
273  rval =
274  IntxUtils::gnomonic_projection( verticesSubEdge[j], 1.0, gnomonicPlane, coords2D[4], coords2D[5] );MB_CHK_SET_ERR( rval, "can't get gnomonic coords of subedge" );
275  // area of triangle in gnomonic plane should be 0
276  double areaAbs = fabs( IntxUtils::area2D( &coords2D[0], &coords2D[2], &coords2D[4] ) );
277 
278  if( areaAbs > 1.e-14 ) onEdge = false;
279  }
280  if( onEdge )
281  {
282  double subEdgeLen = angle_robust( verticesSubEdge[0], verticesSubEdge[1] );
283  recoveredLength += subEdgeLen;
284  mapEdges[initialEdge].push_back( subedge );
285  VerticesSubEdges.push_back( connEdge2[0] );
286  VerticesSubEdges.push_back( connEdge2[1] );
287  }
288  }
289  double fraction = recoveredLength / edgeLength;
290  rval = mb->tag_set_data( fractionTag, &initialEdge, 1, &fraction );MB_CHK_SET_ERR( rval, "can't set fraction on initial edge" );
291  double numSubEdge = double( mapEdges[initialEdge].size() );
292  rval = mb->tag_set_data( subTag, &initialEdge, 1, &numSubEdge );MB_CHK_SET_ERR( rval, "can't set number of subedges on initial edge" );
293  // now , reorder the subedges to create a chain along the original edge
294  // if we cannot form a chain, it means we have a problem
295  // order subedges on the original edge, and find out their orientation
296  // set also the parent tag on the edge, either source or target parent
297  // in some cases, the parents can be both
298  rval = orderSubEdges( mapEdges[initialEdge], VerticesSubEdges, connEdge, edgeVertices[initialEdge],
299  edgePolygons[initialEdge], otherParentTag );
300  if( fabs( edgeLength - recoveredLength ) < 1.e-10 || rval == MB_SUCCESS )
301  recoveredEdges++;
302  else
303  {
304  mb->list_entity( initialEdge );
305  std::vector< EntityHandle >& listSubEdges = mapEdges[initialEdge];
306  double newCheckLength = 0;
307  CartVect vertices[2];
308  const EntityHandle* conn2;
309  int numVerts2 = 0;
310  rval = mb->get_connectivity( initialEdge, conn2, numVerts2 );MB_CHK_SET_ERR( rval, "can't get connectivity of initial edge " );
311  rval = mb->get_coords( conn2, numVerts2, vertices[0].array() );MB_CHK_SET_ERR( rval, "can't get coordinates of vertices of initial edge" );
312  double length2 = angle_robust( vertices[0], vertices[1] );
313  std::cout << std::setprecision( 14 );
314  std::cout << " initial edge:" << mb->id_from_handle( initialEdge ) << " v: " << conn2[0] << ", " << conn2[1]
315  << " len: " << length2 << "\n";
316  for( size_t j = 0; j < listSubEdges.size(); j++ )
317  {
318  EntityHandle subEdge = listSubEdges[j];
319  rval = mb->get_connectivity( subEdge, conn2, numVerts2 );MB_CHK_SET_ERR( rval, "can't get connectivity of subedge " );
320  rval = mb->get_coords( conn2, numVerts2, vertices[0].array() );MB_CHK_SET_ERR( rval, "can't get coordinates of vertices of subedge" );
321  length2 = angle_robust( vertices[0], vertices[1] );
322  newCheckLength += length2;
323  std::cout << " sub edge:" << mb->id_from_handle( subEdge ) << " v: " << conn2[0] << ", " << conn2[1]
324  << " len: " << length2 << "\n";
325  }
326  std::cout << " edge length:" << edgeLength << " newCheckLength:" << newCheckLength
327  << " diff:" << edgeLength - newCheckLength << " fraction:" << fraction
328  << " subedges:" << numSubEdge << "\n";
329  unrecovered++;
330  std::cout << std::setprecision( 7 );
331  }
332  }
333 
334  std::cout << " recoveredEdges:" << recoveredEdges << " identity edges:" << identity_edges
335  << " unrecovered edges:" << unrecovered << "\n";
336  return MB_SUCCESS;
337 }

References moab::angle_robust(), moab::IntxUtils::area2D(), moab::IntxAreaUtils::area_spherical_polygon(), moab::Range::begin(), moab::IntxUtils::decide_gnomonic_plane(), edgePolygons, edgeVertices, moab::Range::empty(), moab::Range::end(), ErrorCode, moab::Interface::get_adjacencies(), moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::Interface::get_entities_by_dimension(), moab::Intx2Mesh::gid, moab::Interface::globalId_tag(), moab::IntxUtils::gnomonic_projection(), moab::Interface::id_from_handle(), moab::index, moab::Range::index(), moab::Range::insert(), moab::intersect(), moab::IntxAreaUtils::lHuiller, moab::Interface::list_entity(), moab::Intx2Mesh::mb, MB_CHK_SET_ERR, MB_SUCCESS, moab::Intx2Mesh::mbs2, orderSubEdges(), moab::Intx2Mesh::outSet, recoveredCells, moab::Range::size(), moab::subtract(), moab::Interface::tag_get_data(), moab::Interface::tag_get_handle(), moab::Interface::tag_set_data(), and moab::Interface::UNION.

Referenced by main().

◆ orderSubEdges()

ErrorCode moab::Intx2MeshEdges::orderSubEdges ( std::vector< EntityHandle > &  subEdges,
std::vector< EntityHandle > &  VerticesSubEdges,
const EntityHandle connEdge,
std::vector< EntityHandle > &  chainVertices,
std::vector< int > &  polygonIds,
Tag  otherParentTag 
)
private

Definition at line 27 of file Intx2MeshEdges.cpp.

33 {
34  int numEdges = (int)subEdges.size();
35  if( numEdges == 1 ) return MB_SUCCESS; // nothing to do
36 
37  EntityHandle currentVertex = connEdge[0]; // start vertex
38  chainVertices.push_back( currentVertex );
39  EntityHandle endVertex = connEdge[1];
40  std::vector< EntityHandle > chain;
41  std::vector< int > markedEdge( numEdges, 0 ); // 0 means not found yet; -1 or +1 for orientation
42  // start finding the current vertex, until we close the chain; double loop, we could be smarter :)
43  for( int i = 0; i < numEdges; i++ )
44  {
45  for( int j = 0; j < numEdges; j++ )
46  {
47  if( 0 != markedEdge[j] ) continue; // do not use it anymore
48  if( VerticesSubEdges[j * 2] == currentVertex )
49  {
50  currentVertex = VerticesSubEdges[j * 2 + 1];
51  chainVertices.push_back( currentVertex );
52  chain.push_back( subEdges[j] );
53  markedEdge[j] = 1; // positive
54  break; // break the j loop
55  }
56  if( VerticesSubEdges[j * 2 + 1] == currentVertex )
57  {
58  currentVertex = VerticesSubEdges[j * 2];
59  chainVertices.push_back( currentVertex );
60  chain.push_back( subEdges[j] );
61  markedEdge[j] = -1; // reversed
62  break; // break the j loop
63  }
64  }
65  }
66  if( (int)chain.size() == numEdges && currentVertex == endVertex )
67  {
68  subEdges = chain; // reordered list, no orientation saved; maybe we should ?
69  // from chain, form the list of original polygons that contain each subedge
70  // get the parent tag of 2 intx polys connected to each edge in chain
71  for( int j = 0; j < (int)chain.size(); j++ )
72  {
73  EntityHandle sEdge = chain[j];
74  std::vector< EntityHandle > intxPolys;
75  ErrorCode rval = mb->get_adjacencies( &sEdge, 1, 2, false, intxPolys, Interface::UNION );MB_CHK_ERR( rval );
76  EntityHandle onePolygon = intxPolys[0];
77  int global_id = 0;
78  rval = mb->tag_get_data( otherParentTag, &onePolygon, 1, &global_id );MB_CHK_ERR( rval );
79  polygonIds.push_back( global_id );
80  }
81  return MB_SUCCESS;
82  }
83  else
84  return MB_FAILURE; // we did not find a chain, do not change anything
85 }

References ErrorCode, moab::Interface::get_adjacencies(), moab::Intx2Mesh::mb, MB_CHK_ERR, MB_SUCCESS, moab::Interface::tag_get_data(), and moab::Interface::UNION.

Referenced by EdgeSplits().

Member Data Documentation

◆ edgePolygons

std::map< EntityHandle, std::vector< int > > moab::Intx2MeshEdges::edgePolygons
private

Definition at line 68 of file Intx2MeshEdges.hpp.

Referenced by EdgeSplits().

◆ edgeVertices

std::map< EntityHandle, std::vector< EntityHandle > > moab::Intx2MeshEdges::edgeVertices
private

Definition at line 66 of file Intx2MeshEdges.hpp.

Referenced by EdgeSplits().

◆ recoveredCells

Range moab::Intx2MeshEdges::recoveredCells
private

Definition at line 69 of file Intx2MeshEdges.hpp.

Referenced by EdgeSplits().


The documentation for this class was generated from the following files: