extendedEdgeMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "extendedEdgeMesh.H"
27 #include "surfaceFeatures.H"
28 #include "triSurface.H"
29 #include "Random.H"
30 #include "Time.H"
31 #include "OBJstream.H"
32 #include "DynamicField.H"
33 #include "edgeMeshFormatsCore.H"
34 #include "IOmanip.H"
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40  defineTypeNameAndDebug(extendedEdgeMesh, 0);
41 
42  template<>
43  const char* Foam::NamedEnum
44  <
46  4
47  >::names[] =
48  {
49  "convex",
50  "concave",
51  "mixed",
52  "nonFeature"
53  };
54 
55  template<>
56  const char* Foam::NamedEnum
57  <
59  6
60  >::names[] =
61  {
62  "external",
63  "internal",
64  "flat",
65  "open",
66  "multiple",
67  "none"
68  };
69 
70  template<>
71  const char* Foam::NamedEnum
72  <
74  4
75  >::names[] =
76  {
77  "inside",
78  "outside",
79  "both",
80  "neither"
81  };
82 }
83 
86 
89 
92 
94  Foam::cos(degToRad(0.1));
95 
96 
98 
99 
101 
102 
104 
105 
107 
108 
110 {
111  return wordHashSet(*fileExtensionConstructorTablePtr_);
112 }
113 
114 
116 {
117  return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
118 }
119 
120 
121 
122 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
123 
125 (
126  const word& ext,
127  const bool verbose
128 )
129 {
130  return edgeMeshFormatsCore::checkSupport
131  (
132  readTypes(),
133  ext,
134  verbose,
135  "reading"
136  );
137 }
138 
139 
141 (
142  const word& ext,
143  const bool verbose
144 )
145 {
146  return edgeMeshFormatsCore::checkSupport
147  (
148  writeTypes(),
149  ext,
150  verbose,
151  "writing"
152  );
153 }
154 
155 
157 (
158  const fileName& name,
159  const bool verbose
160 )
161 {
162  word ext = name.ext();
163  if (ext == "gz")
164  {
165  ext = name.lessExt().ext();
166  }
167  return canReadType(ext, verbose);
168 }
169 
170 
171 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
172 
175 (
176  label ptI
177 ) const
178 {
179  labelList ptEds(pointEdges()[ptI]);
180 
181  label nPtEds = ptEds.size();
182  label nExternal = 0;
183  label nInternal = 0;
184 
185  if (nPtEds == 0)
186  {
187  // There are no edges attached to the point, this is a problem
188  return NONFEATURE;
189  }
190 
191  forAll(ptEds, i)
192  {
193  edgeStatus edStat = getEdgeStatus(ptEds[i]);
194 
195  if (edStat == EXTERNAL)
196  {
197  nExternal++;
198  }
199  else if (edStat == INTERNAL)
200  {
201  nInternal++;
202  }
203  }
204 
205  if (nExternal == nPtEds)
206  {
207  return CONVEX;
208  }
209  else if (nInternal == nPtEds)
210  {
211  return CONCAVE;
212  }
213  else
214  {
215  return MIXED;
216  }
217 }
218 
219 
222 (
223  const List<vector>& norms,
224  const labelList& edNorms,
225  const vector& fC0tofC1
226 )
227 {
228  label nEdNorms = edNorms.size();
229 
230  if (nEdNorms == 1)
231  {
232  return OPEN;
233  }
234  else if (nEdNorms == 2)
235  {
236  const vector& n0(norms[edNorms[0]]);
237  const vector& n1(norms[edNorms[1]]);
238 
239  if ((n0 & n1) > cosNormalAngleTol_)
240  {
241  return FLAT;
242  }
243  else if ((fC0tofC1 & n0) > 0.0)
244  {
245  return INTERNAL;
246  }
247  else
248  {
249  return EXTERNAL;
250  }
251  }
252  else if (nEdNorms > 2)
253  {
254  return MULTIPLE;
255  }
256  else
257  {
258  // There is a problem - the edge has no normals
259  return NONE;
260  }
261 }
262 
263 
264 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
265 
267 :
268  edgeMesh(pointField(0), edgeList(0)),
269  concaveStart_(0),
270  mixedStart_(0),
271  nonFeatureStart_(0),
272  internalStart_(0),
273  flatStart_(0),
274  openStart_(0),
275  multipleStart_(0),
276  normals_(0),
277  normalVolumeTypes_(0),
278  edgeDirections_(0),
279  normalDirections_(0),
280  edgeNormals_(0),
281  featurePointNormals_(0),
282  featurePointEdges_(0),
283  regionEdges_(0),
284  pointTree_(),
285  edgeTree_(),
286  edgeTreesByType_()
287 {}
288 
289 
291 (
292  const extendedEdgeMesh& fem
293 )
294 :
295  edgeMesh(fem),
297  mixedStart_(fem.mixedStart()),
300  flatStart_(fem.flatStart()),
301  openStart_(fem.openStart()),
303  normals_(fem.normals()),
307  edgeNormals_(fem.edgeNormals()),
310  regionEdges_(fem.regionEdges()),
311  pointTree_(),
312  edgeTree_(),
314 {}
315 
316 
318 {
319  is >> *this;
320 }
321 
322 
324 (
325  const Xfer<pointField>& pointLst,
326  const Xfer<edgeList>& edgeLst
327 )
328 :
329  edgeMesh(pointLst, edgeLst),
330  concaveStart_(0),
331  mixedStart_(0),
332  nonFeatureStart_(0),
333  internalStart_(0),
334  flatStart_(0),
335  openStart_(0),
336  multipleStart_(0),
337  normals_(0),
339  edgeDirections_(0),
341  edgeNormals_(0),
344  regionEdges_(0),
345  pointTree_(),
346  edgeTree_(),
348 {}
349 
350 
352 (
353  const surfaceFeatures& sFeat,
354  const boolList& surfBaffleRegions
355 )
356 :
357  edgeMesh(pointField(0), edgeList(0)),
358  concaveStart_(-1),
359  mixedStart_(-1),
360  nonFeatureStart_(-1),
361  internalStart_(-1),
362  flatStart_(-1),
363  openStart_(-1),
364  multipleStart_(-1),
365  normals_(0),
367  edgeDirections_(0),
369  edgeNormals_(0),
372  regionEdges_(0),
373  pointTree_(),
374  edgeTree_(),
376 {
377  // Extract and reorder the data from surfaceFeatures
378  const triSurface& surf = sFeat.surface();
379  const labelList& featureEdges = sFeat.featureEdges();
380  const labelList& featurePoints = sFeat.featurePoints();
381 
382  // Get a labelList of all the featureEdges that are region edges
383  const labelList regionFeatureEdges(identity(sFeat.nRegionEdges()));
384 
386  (
387  surf,
388  featureEdges,
389  regionFeatureEdges,
390  featurePoints
391  );
392 
393  const labelListList& edgeFaces = surf.edgeFaces();
394 
396 
397  // Noting when the normal of a face has been used so not to duplicate
398  labelList faceMap(surf.size(), -1);
399 
400  label nAdded = 0;
401 
402  forAll(featureEdges, i)
403  {
404  label sFEI = featureEdges[i];
405 
406  // Pick up the faces adjacent to the feature edge
407  const labelList& eFaces = edgeFaces[sFEI];
408 
409  forAll(eFaces, j)
410  {
411  label eFI = eFaces[j];
412 
413  // Check to see if the points have been already used
414  if (faceMap[eFI] == -1)
415  {
416  normalVolumeTypes_[nAdded++] =
417  (
418  surfBaffleRegions[surf[eFI].region()]
419  ? BOTH
420  : INSIDE
421  );
422 
423  faceMap[eFI] = nAdded - 1;
424  }
425  }
426  }
427 }
428 
429 
431 (
433  const labelList& featureEdges,
434  const labelList& regionFeatureEdges,
435  const labelList& featurePoints
436 )
437 :
438  edgeMesh(pointField(0), edgeList(0)),
439  concaveStart_(-1),
440  mixedStart_(-1),
441  nonFeatureStart_(-1),
442  internalStart_(-1),
443  flatStart_(-1),
444  openStart_(-1),
445  multipleStart_(-1),
446  normals_(0),
448  edgeDirections_(0),
450  edgeNormals_(0),
453  regionEdges_(0),
454  pointTree_(),
455  edgeTree_(),
457 {
459  (
460  surf,
461  featureEdges,
462  regionFeatureEdges,
463  featurePoints
464  );
465 }
466 
467 
469 (
470  const pointField& pts,
471  const edgeList& eds,
472  label concaveStart,
473  label mixedStart,
474  label nonFeatureStart,
475  label internalStart,
476  label flatStart,
477  label openStart,
478  label multipleStart,
479  const vectorField& normals,
480  const List<sideVolumeType>& normalVolumeTypes,
481  const vectorField& edgeDirections,
482  const labelListList& normalDirections,
483  const labelListList& edgeNormals,
484  const labelListList& featurePointNormals,
485  const labelListList& featurePointEdges,
486  const labelList& regionEdges
487 )
488 :
489  edgeMesh(pts, eds),
490  concaveStart_(concaveStart),
491  mixedStart_(mixedStart),
492  nonFeatureStart_(nonFeatureStart),
493  internalStart_(internalStart),
494  flatStart_(flatStart),
495  openStart_(openStart),
496  multipleStart_(multipleStart),
497  normals_(normals),
498  normalVolumeTypes_(normalVolumeTypes),
499  edgeDirections_(edgeDirections),
500  normalDirections_(normalDirections),
501  edgeNormals_(edgeNormals),
502  featurePointNormals_(featurePointNormals),
503  featurePointEdges_(featurePointEdges),
504  regionEdges_(regionEdges),
505  pointTree_(),
506  edgeTree_(),
508 {}
509 
510 
512 (
513  const fileName& name,
514  const word& ext
515 )
516 :
517  edgeMesh(pointField(0), edgeList(0)),
518  concaveStart_(0),
519  mixedStart_(0),
520  nonFeatureStart_(0),
521  internalStart_(0),
522  flatStart_(0),
523  openStart_(0),
524  multipleStart_(0),
525  normals_(0),
527  edgeDirections_(0),
529  edgeNormals_(0),
532  regionEdges_(0),
533  pointTree_(),
534  edgeTree_(),
536 {
537  read(name, ext);
538 }
539 
540 
542 :
543  edgeMesh(pointField(0), edgeList(0)),
544  concaveStart_(0),
545  mixedStart_(0),
546  nonFeatureStart_(0),
547  internalStart_(0),
548  flatStart_(0),
549  openStart_(0),
550  multipleStart_(0),
551  normals_(0),
553  edgeDirections_(0),
555  edgeNormals_(0),
558  regionEdges_(0),
559  pointTree_(),
560  edgeTree_(),
562 {
563  read(name);
564 }
565 
566 
567 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
568 
570 {}
571 
572 
573 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
574 
576 {
577  word ext = name.ext();
578  if (ext == "gz")
579  {
580  fileName unzipName = name.lessExt();
581  return read(unzipName, unzipName.ext());
582  }
583  else
584  {
585  return read(name, ext);
586  }
587 }
588 
589 
590 // Read from file in given format
592 (
593  const fileName& name,
594  const word& ext
595 )
596 {
597  // read via selector mechanism
598  transfer(New(name, ext)());
599  return true;
600 }
601 
602 
604 (
605  const point& sample,
606  scalar searchDistSqr,
607  pointIndexHit& info
608 ) const
609 {
610  info = pointTree().findNearest
611  (
612  sample,
613  searchDistSqr
614  );
615 }
616 
617 
619 (
620  const point& sample,
621  scalar searchDistSqr,
622  pointIndexHit& info
623 ) const
624 {
625  info = edgeTree().findNearest
626  (
627  sample,
628  searchDistSqr
629  );
630 }
631 
632 
634 (
635  const pointField& samples,
636  const scalarField& searchDistSqr,
637  List<pointIndexHit>& info
638 ) const
639 {
640  info.setSize(samples.size());
641 
642  forAll(samples, i)
643  {
645  (
646  samples[i],
647  searchDistSqr[i],
648  info[i]
649  );
650  }
651 }
652 
653 
655 (
656  const point& sample,
657  const scalarField& searchDistSqr,
658  List<pointIndexHit>& info
659 ) const
660 {
662 
663  info.setSize(edgeTrees.size());
664 
665  labelList sliceStarts(edgeTrees.size());
666 
667  sliceStarts[0] = externalStart_;
668  sliceStarts[1] = internalStart_;
669  sliceStarts[2] = flatStart_;
670  sliceStarts[3] = openStart_;
671  sliceStarts[4] = multipleStart_;
672 
673  forAll(edgeTrees, i)
674  {
675  info[i] = edgeTrees[i].findNearest
676  (
677  sample,
678  searchDistSqr[i]
679  );
680 
681  // The index returned by the indexedOctree is local to the slice of
682  // edges it was supplied with, return the index to the value in the
683  // complete edge list
684 
685  info[i].setIndex(info[i].index() + sliceStarts[i]);
686  }
687 }
688 
689 
691 (
692  const point& sample,
693  scalar searchRadiusSqr,
694  List<pointIndexHit>& info
695 ) const
696 {
697  // Pick up all the feature points that intersect the search sphere
698  labelList elems = pointTree().findSphere
699  (
700  sample,
701  searchRadiusSqr
702  );
703 
704  DynamicList<pointIndexHit> dynPointHit(elems.size());
705 
706  forAll(elems, elemI)
707  {
708  label index = elems[elemI];
709  label ptI = pointTree().shapes().pointLabels()[index];
710  const point& pt = points()[ptI];
711 
712  pointIndexHit nearHit(true, pt, index);
713 
714  dynPointHit.append(nearHit);
715  }
716 
717  info.transfer(dynPointHit);
718 }
719 
720 
722 (
723  const point& sample,
724  const scalar searchRadiusSqr,
725  List<pointIndexHit>& info
726 ) const
727 {
729 
730  info.setSize(edgeTrees.size());
731 
732  labelList sliceStarts(edgeTrees.size());
733 
734  sliceStarts[0] = externalStart_;
735  sliceStarts[1] = internalStart_;
736  sliceStarts[2] = flatStart_;
737  sliceStarts[3] = openStart_;
738  sliceStarts[4] = multipleStart_;
739 
740  DynamicList<pointIndexHit> dynEdgeHit(edgeTrees.size()*3);
741 
742  // Loop over all the feature edge types
743  forAll(edgeTrees, i)
744  {
745  // Pick up all the edges that intersect the search sphere
746  labelList elems = edgeTrees[i].findSphere
747  (
748  sample,
749  searchRadiusSqr
750  );
751 
752  forAll(elems, elemI)
753  {
754  label index = elems[elemI];
755  label edgeI = edgeTrees[i].shapes().edgeLabels()[index];
756  const edge& e = edges()[edgeI];
757 
758  pointHit hitPoint = e.line(points()).nearestDist(sample);
759 
760  label hitIndex = index + sliceStarts[i];
761 
762  pointIndexHit nearHit
763  (
764  hitPoint.hit(),
765  hitPoint.rawPoint(),
766  hitIndex
767  );
768 
769  dynEdgeHit.append(nearHit);
770  }
771  }
772 
773  info.transfer(dynEdgeHit);
774 }
775 
776 
779 {
780  if (pointTree_.empty())
781  {
782  Random rndGen(17301893);
783 
784  // Slightly extended bb. Slightly off-centred just so on symmetric
785  // geometry there are less face/edge aligned items.
786  treeBoundBox bb
787  (
788  treeBoundBox(points()).extend(rndGen, 1e-4)
789  );
790 
791  bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
792  bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
793 
794  const labelList featurePointLabels = identity(nonFeatureStart_);
795 
796  pointTree_.reset
797  (
799  (
801  (
802  points(),
803  featurePointLabels
804  ),
805  bb, // bb
806  8, // maxLevel
807  10, // leafsize
808  3.0 // duplicity
809  )
810  );
811  }
812 
813  return pointTree_();
814 }
815 
816 
819 {
820  if (edgeTree_.empty())
821  {
822  Random rndGen(17301893);
823 
824  // Slightly extended bb. Slightly off-centred just so on symmetric
825  // geometry there are less face/edge aligned items.
826  treeBoundBox bb
827  (
828  treeBoundBox(points()).extend(rndGen, 1e-4)
829  );
830 
831  bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
832  bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
833 
834  labelList allEdges(identity(edges().size()));
835 
836  edgeTree_.reset
837  (
839  (
841  (
842  false, // cachebb
843  edges(), // edges
844  points(), // points
845  allEdges // selected edges
846  ),
847  bb, // bb
848  8, // maxLevel
849  10, // leafsize
850  3.0 // duplicity
851  )
852  );
853  }
854 
855  return edgeTree_();
856 }
857 
858 
861 {
862  if (edgeTreesByType_.size() == 0)
863  {
864  edgeTreesByType_.setSize(nEdgeTypes);
865 
866  Random rndGen(872141);
867 
868  // Slightly extended bb. Slightly off-centred just so on symmetric
869  // geometry there are less face/edge aligned items.
870  treeBoundBox bb
871  (
872  treeBoundBox(points()).extend(rndGen, 1e-4)
873  );
874 
875  bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
876  bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
877 
878  labelListList sliceEdges(nEdgeTypes);
879 
880  // External edges
881  sliceEdges[0] =
883 
884  // Internal edges
885  sliceEdges[1] = identity(flatStart_ - internalStart_) + internalStart_;
886 
887  // Flat edges
888  sliceEdges[2] = identity(openStart_ - flatStart_) + flatStart_;
889 
890  // Open edges
891  sliceEdges[3] = identity(multipleStart_ - openStart_) + openStart_;
892 
893  // Multiple edges
894  sliceEdges[4] =
896 
898  {
899  edgeTreesByType_.set
900  (
901  i,
903  (
905  (
906  false, // cachebb
907  edges(), // edges
908  points(), // points
909  sliceEdges[i] // selected edges
910  ),
911  bb, // bb
912  8, // maxLevel
913  10, // leafsize
914  3.0 // duplicity
915  )
916  );
917  }
918  }
919 
920  return edgeTreesByType_;
921 }
922 
923 
925 {
926  edgeMesh::transfer(mesh);
927 
929  mixedStart_ = mesh.mixedStart_;
932  flatStart_ = mesh.flatStart_;
933  openStart_ = mesh.openStart_;
935  normals_.transfer(mesh.normals_);
943  pointTree_ = mesh.pointTree_;
944  edgeTree_ = mesh.edgeTree_;
945  edgeTreesByType_.transfer(mesh.edgeTreesByType_);
946 }
947 
948 
950 {
951  return xferMoveTo<extendedEdgeMesh, extendedEdgeMesh>(*this);
952 }
953 
954 
956 {
957  edgeMesh::clear();
958  concaveStart_ = 0;
959  mixedStart_ = 0;
960  nonFeatureStart_ = 0;
961  internalStart_ = 0;
962  flatStart_ = 0;
963  openStart_ = 0;
964  multipleStart_ = 0;
965  normals_.clear();
973  pointTree_.clear();
974  edgeTree_.clear();
975  edgeTreesByType_.clear();
976 }
977 
978 
980 {
981  // Points
982  // ~~~~~~
983 
984  // From current points into combined points
985  labelList reversePointMap(points().size());
986  labelList reverseFemPointMap(fem.points().size());
987 
988  label newPointi = 0;
989  for (label i = 0; i < concaveStart(); i++)
990  {
991  reversePointMap[i] = newPointi++;
992  }
993  for (label i = 0; i < fem.concaveStart(); i++)
994  {
995  reverseFemPointMap[i] = newPointi++;
996  }
997 
998  // Concave
999  label newConcaveStart = newPointi;
1000  for (label i = concaveStart(); i < mixedStart(); i++)
1001  {
1002  reversePointMap[i] = newPointi++;
1003  }
1004  for (label i = fem.concaveStart(); i < fem.mixedStart(); i++)
1005  {
1006  reverseFemPointMap[i] = newPointi++;
1007  }
1008 
1009  // Mixed
1010  label newMixedStart = newPointi;
1011  for (label i = mixedStart(); i < nonFeatureStart(); i++)
1012  {
1013  reversePointMap[i] = newPointi++;
1014  }
1015  for (label i = fem.mixedStart(); i < fem.nonFeatureStart(); i++)
1016  {
1017  reverseFemPointMap[i] = newPointi++;
1018  }
1019 
1020  // Non-feature
1021  label newNonFeatureStart = newPointi;
1022  for (label i = nonFeatureStart(); i < points().size(); i++)
1023  {
1024  reversePointMap[i] = newPointi++;
1025  }
1026  for (label i = fem.nonFeatureStart(); i < fem.points().size(); i++)
1027  {
1028  reverseFemPointMap[i] = newPointi++;
1029  }
1030 
1031  pointField newPoints(newPointi);
1032  newPoints.rmap(points(), reversePointMap);
1033  newPoints.rmap(fem.points(), reverseFemPointMap);
1034 
1035 
1036  // Edges
1037  // ~~~~~
1038 
1039  // From current edges into combined edges
1040  labelList reverseEdgeMap(edges().size());
1041  labelList reverseFemEdgeMap(fem.edges().size());
1042 
1043  // External
1044  label newEdgeI = 0;
1045  for (label i = 0; i < internalStart(); i++)
1046  {
1047  reverseEdgeMap[i] = newEdgeI++;
1048  }
1049  for (label i = 0; i < fem.internalStart(); i++)
1050  {
1051  reverseFemEdgeMap[i] = newEdgeI++;
1052  }
1053 
1054  // Internal
1055  label newInternalStart = newEdgeI;
1056  for (label i = internalStart(); i < flatStart(); i++)
1057  {
1058  reverseEdgeMap[i] = newEdgeI++;
1059  }
1060  for (label i = fem.internalStart(); i < fem.flatStart(); i++)
1061  {
1062  reverseFemEdgeMap[i] = newEdgeI++;
1063  }
1064 
1065  // Flat
1066  label newFlatStart = newEdgeI;
1067  for (label i = flatStart(); i < openStart(); i++)
1068  {
1069  reverseEdgeMap[i] = newEdgeI++;
1070  }
1071  for (label i = fem.flatStart(); i < fem.openStart(); i++)
1072  {
1073  reverseFemEdgeMap[i] = newEdgeI++;
1074  }
1075 
1076  // Open
1077  label newOpenStart = newEdgeI;
1078  for (label i = openStart(); i < multipleStart(); i++)
1079  {
1080  reverseEdgeMap[i] = newEdgeI++;
1081  }
1082  for (label i = fem.openStart(); i < fem.multipleStart(); i++)
1083  {
1084  reverseFemEdgeMap[i] = newEdgeI++;
1085  }
1086 
1087  // Multiple
1088  label newMultipleStart = newEdgeI;
1089  for (label i = multipleStart(); i < edges().size(); i++)
1090  {
1091  reverseEdgeMap[i] = newEdgeI++;
1092  }
1093  for (label i = fem.multipleStart(); i < fem.edges().size(); i++)
1094  {
1095  reverseFemEdgeMap[i] = newEdgeI++;
1096  }
1097 
1098  edgeList newEdges(newEdgeI);
1099  forAll(edges(), i)
1100  {
1101  const edge& e = edges()[i];
1102  newEdges[reverseEdgeMap[i]] = edge
1103  (
1104  reversePointMap[e[0]],
1105  reversePointMap[e[1]]
1106  );
1107  }
1108  forAll(fem.edges(), i)
1109  {
1110  const edge& e = fem.edges()[i];
1111  newEdges[reverseFemEdgeMap[i]] = edge
1112  (
1113  reverseFemPointMap[e[0]],
1114  reverseFemPointMap[e[1]]
1115  );
1116  }
1117 
1118  pointField newEdgeDirections(newEdgeI);
1119  newEdgeDirections.rmap(edgeDirections(), reverseEdgeMap);
1120  newEdgeDirections.rmap(fem.edgeDirections(), reverseFemEdgeMap);
1121 
1122 
1123 
1124 
1125  // Normals
1126  // ~~~~~~~
1127 
1128  // Combine normals
1129  DynamicField<point> newNormals(normals().size()+fem.normals().size());
1130  newNormals.append(normals());
1131  newNormals.append(fem.normals());
1132 
1133 
1134  // Combine and re-index into newNormals
1135  labelListList newEdgeNormals(edgeNormals().size()+fem.edgeNormals().size());
1136  UIndirectList<labelList>(newEdgeNormals, reverseEdgeMap) =
1137  edgeNormals();
1138  UIndirectList<labelList>(newEdgeNormals, reverseFemEdgeMap) =
1139  fem.edgeNormals();
1140  forAll(reverseFemEdgeMap, i)
1141  {
1142  label mapI = reverseFemEdgeMap[i];
1143  labelList& en = newEdgeNormals[mapI];
1144  forAll(en, j)
1145  {
1146  en[j] += normals().size();
1147  }
1148  }
1149 
1150 
1151  // Combine and re-index into newFeaturePointNormals
1152  labelListList newFeaturePointNormals
1153  (
1154  featurePointNormals().size()
1155  + fem.featurePointNormals().size()
1156  );
1157 
1158  // Note: featurePointNormals only go up to nonFeatureStart
1159  UIndirectList<labelList>
1160  (
1161  newFeaturePointNormals,
1162  SubList<label>(reversePointMap, featurePointNormals().size())
1163  ) = featurePointNormals();
1164  UIndirectList<labelList>
1165  (
1166  newFeaturePointNormals,
1167  SubList<label>(reverseFemPointMap, fem.featurePointNormals().size())
1168  ) = fem.featurePointNormals();
1169  forAll(fem.featurePointNormals(), i)
1170  {
1171  label mapI = reverseFemPointMap[i];
1172  labelList& fn = newFeaturePointNormals[mapI];
1173  forAll(fn, j)
1174  {
1175  fn[j] += normals().size();
1176  }
1177  }
1178 
1179 
1180  // Combine regionEdges
1181  DynamicList<label> newRegionEdges
1182  (
1183  regionEdges().size()
1184  + fem.regionEdges().size()
1185  );
1186  forAll(regionEdges(), i)
1187  {
1188  newRegionEdges.append(reverseEdgeMap[regionEdges()[i]]);
1189  }
1190  forAll(fem.regionEdges(), i)
1191  {
1192  newRegionEdges.append(reverseFemEdgeMap[fem.regionEdges()[i]]);
1193  }
1194 
1195 
1196  // Assign
1197  // ~~~~~~
1198 
1199  // Transfer
1200  concaveStart_ = newConcaveStart;
1201  mixedStart_ = newMixedStart;
1202  nonFeatureStart_ = newNonFeatureStart;
1203 
1204  // Reset points and edges
1205  reset(xferMove(newPoints), newEdges.xfer());
1206 
1207  // Transfer
1208  internalStart_ = newInternalStart;
1209  flatStart_ = newFlatStart;
1210  openStart_ = newOpenStart;
1211  multipleStart_ = newMultipleStart;
1212 
1213  edgeDirections_.transfer(newEdgeDirections);
1214 
1215  normals_.transfer(newNormals);
1216  edgeNormals_.transfer(newEdgeNormals);
1217  featurePointNormals_.transfer(newFeaturePointNormals);
1218 
1219  regionEdges_.transfer(newRegionEdges);
1220 
1221  pointTree_.clear();
1222  edgeTree_.clear();
1223  edgeTreesByType_.clear();
1224 }
1225 
1226 
1228 {
1229  // Points
1230  // ~~~~~~
1231 
1232  // From current points into new points
1233  labelList reversePointMap(identity(points().size()));
1234 
1235  // Flip convex and concave points
1236 
1237  label newPointi = 0;
1238  // Concave points become convex
1239  for (label i = concaveStart(); i < mixedStart(); i++)
1240  {
1241  reversePointMap[i] = newPointi++;
1242  }
1243  // Convex points become concave
1244  label newConcaveStart = newPointi;
1245  for (label i = 0; i < concaveStart(); i++)
1246  {
1247  reversePointMap[i] = newPointi++;
1248  }
1249 
1250 
1251  // Edges
1252  // ~~~~~~
1253 
1254  // From current edges into new edges
1255  labelList reverseEdgeMap(identity(edges().size()));
1256 
1257  // Flip external and internal edges
1258 
1259  label newEdgeI = 0;
1260  // Internal become external
1261  for (label i = internalStart(); i < flatStart(); i++)
1262  {
1263  reverseEdgeMap[i] = newEdgeI++;
1264  }
1265  // External become internal
1266  label newInternalStart = newEdgeI;
1267  for (label i = 0; i < internalStart(); i++)
1268  {
1269  reverseEdgeMap[i] = newEdgeI++;
1270  }
1271 
1272 
1273  pointField newPoints(points().size());
1274  newPoints.rmap(points(), reversePointMap);
1275 
1276  edgeList newEdges(edges().size());
1277  forAll(edges(), i)
1278  {
1279  const edge& e = edges()[i];
1280  newEdges[reverseEdgeMap[i]] = edge
1281  (
1282  reversePointMap[e[0]],
1283  reversePointMap[e[1]]
1284  );
1285  }
1286 
1287 
1288  // Normals are flipped
1289  // ~~~~~~~~~~~~~~~~~~~
1290 
1291  pointField newEdgeDirections(edges().size());
1292  newEdgeDirections.rmap(-1.0*edgeDirections(), reverseEdgeMap);
1293 
1294  pointField newNormals(-1.0*normals());
1295 
1296  labelListList newEdgeNormals(edgeNormals().size());
1297  UIndirectList<labelList>(newEdgeNormals, reverseEdgeMap) = edgeNormals();
1298 
1299  labelListList newFeaturePointNormals(featurePointNormals().size());
1300 
1301  // Note: featurePointNormals only go up to nonFeatureStart
1303  (
1304  newFeaturePointNormals,
1305  SubList<label>(reversePointMap, featurePointNormals().size())
1306  ) = featurePointNormals();
1307 
1308  labelList newRegionEdges(regionEdges().size());
1309  forAll(regionEdges(), i)
1310  {
1311  newRegionEdges[i] = reverseEdgeMap[regionEdges()[i]];
1312  }
1313 
1314  // Transfer
1315  concaveStart_ = newConcaveStart;
1316 
1317  // Reset points and edges
1318  reset(xferMove(newPoints), newEdges.xfer());
1319 
1320  // Transfer
1321  internalStart_ = newInternalStart;
1322 
1323  edgeDirections_.transfer(newEdgeDirections);
1324  normals_.transfer(newNormals);
1325  edgeNormals_.transfer(newEdgeNormals);
1326  featurePointNormals_.transfer(newFeaturePointNormals);
1327  regionEdges_.transfer(newRegionEdges);
1328 
1329  pointTree_.clear();
1330  edgeTree_.clear();
1331  edgeTreesByType_.clear();
1332 }
1333 
1334 
1337  const fileName& prefix
1338 ) const
1339 {
1340  Info<< nl << "Writing extendedEdgeMesh components to " << prefix
1341  << endl;
1342 
1343  edgeMesh::write(prefix + "_edgeMesh.obj");
1344 
1345  OBJstream convexFtPtStr(prefix + "_convexFeaturePts.obj");
1346  Info<< "Writing convex feature points to " << convexFtPtStr.name() << endl;
1347 
1348  for(label i = 0; i < concaveStart_; i++)
1349  {
1350  convexFtPtStr.write(points()[i]);
1351  }
1352 
1353  OBJstream concaveFtPtStr(prefix + "_concaveFeaturePts.obj");
1354  Info<< "Writing concave feature points to "
1355  << concaveFtPtStr.name() << endl;
1356 
1357  for(label i = concaveStart_; i < mixedStart_; i++)
1358  {
1359  convexFtPtStr.write(points()[i]);
1360  }
1361 
1362  OBJstream mixedFtPtStr(prefix + "_mixedFeaturePts.obj");
1363  Info<< "Writing mixed feature points to " << mixedFtPtStr.name() << endl;
1364 
1365  for(label i = mixedStart_; i < nonFeatureStart_; i++)
1366  {
1367  mixedFtPtStr.write(points()[i]);
1368  }
1369 
1370  OBJstream mixedFtPtStructureStr(prefix + "_mixedFeaturePtsStructure.obj");
1371  Info<< "Writing mixed feature point structure to "
1372  << mixedFtPtStructureStr.name() << endl;
1373 
1374  for(label i = mixedStart_; i < nonFeatureStart_; i++)
1375  {
1376  const labelList& ptEds = pointEdges()[i];
1377 
1378  forAll(ptEds, j)
1379  {
1380  const edge& e = edges()[ptEds[j]];
1381  mixedFtPtStructureStr.write
1382  (
1383  linePointRef(points()[e[0]],
1384  points()[e[1]])
1385  );
1386  }
1387  }
1388 
1389  OBJstream externalStr(prefix + "_externalEdges.obj");
1390  Info<< "Writing external edges to " << externalStr.name() << endl;
1391 
1392  for (label i = externalStart_; i < internalStart_; i++)
1393  {
1394  const edge& e = edges()[i];
1395  externalStr.write(linePointRef(points()[e[0]], points()[e[1]]));
1396  }
1397 
1398  OBJstream internalStr(prefix + "_internalEdges.obj");
1399  Info<< "Writing internal edges to " << internalStr.name() << endl;
1400 
1401  for (label i = internalStart_; i < flatStart_; i++)
1402  {
1403  const edge& e = edges()[i];
1404  internalStr.write(linePointRef(points()[e[0]], points()[e[1]]));
1405  }
1406 
1407  OBJstream flatStr(prefix + "_flatEdges.obj");
1408  Info<< "Writing flat edges to " << flatStr.name() << endl;
1409 
1410  for (label i = flatStart_; i < openStart_; i++)
1411  {
1412  const edge& e = edges()[i];
1413  flatStr.write(linePointRef(points()[e[0]], points()[e[1]]));
1414  }
1415 
1416  OBJstream openStr(prefix + "_openEdges.obj");
1417  Info<< "Writing open edges to " << openStr.name() << endl;
1418 
1419  for (label i = openStart_; i < multipleStart_; i++)
1420  {
1421  const edge& e = edges()[i];
1422  openStr.write(linePointRef(points()[e[0]], points()[e[1]]));
1423  }
1424 
1425  OBJstream multipleStr(prefix + "_multipleEdges.obj");
1426  Info<< "Writing multiple edges to " << multipleStr.name() << endl;
1427 
1428  for (label i = multipleStart_; i < edges().size(); i++)
1429  {
1430  const edge& e = edges()[i];
1431  multipleStr.write(linePointRef(points()[e[0]], points()[e[1]]));
1432  }
1433 
1434  OBJstream regionStr(prefix + "_regionEdges.obj");
1435  Info<< "Writing region edges to " << regionStr.name() << endl;
1436 
1437  forAll(regionEdges_, i)
1438  {
1439  const edge& e = edges()[regionEdges_[i]];
1440  regionStr.write(linePointRef(points()[e[0]], points()[e[1]]));
1441  }
1442 
1443  OBJstream edgeDirsStr(prefix + "_edgeDirections.obj");
1444  Info<< "Writing edge directions to " << edgeDirsStr.name() << endl;
1445 
1447  {
1448  const vector& eVec = edgeDirections_[i];
1449  const edge& e = edges()[i];
1450 
1451  edgeDirsStr.write
1452  (
1453  linePointRef(points()[e.start()], eVec + points()[e.start()])
1454  );
1455  }
1456 }
1457 
1458 
1460 {
1462 
1463  os << indent << "point classification :" << nl;
1464  os << incrIndent;
1465  os << indent << "convex feature points : "
1467  //<< setw(8) << convexStart_
1468  << nl;
1469  os << indent << "concave feature points : "
1470  << setw(8) << mixedStart_-concaveStart_
1471  //<< setw(8) << concaveStart_
1472  << nl;
1473  os << indent << "mixed feature points : "
1475  //<< setw(8) << mixedStart_
1476  << nl;
1477  os << indent << "other (non-feature) points : "
1478  << setw(8) << points().size()-nonFeatureStart_
1479  //<< setw(8) << nonFeatureStart_
1480  << nl;
1481  os << decrIndent;
1482 
1483  os << indent << "edge classification :" << nl;
1484  os << incrIndent;
1485  os << indent << "external (convex angle) edges : "
1487  //<< setw(8) << externalStart_
1488  << nl;
1489  os << indent << "internal (concave angle) edges : "
1490  << setw(8) << flatStart_-internalStart_
1491  //<< setw(8) << internalStart_
1492  << nl;
1493  os << indent << "flat region edges : "
1494  << setw(8) << openStart_-flatStart_
1495  //<< setw(8) << flatStart_
1496  << nl;
1497  os << indent << "open edges : "
1498  << setw(8) << multipleStart_-openStart_
1499  //<< setw(8) << openStart_
1500  << nl;
1501  os << indent << "multiply connected edges : "
1502  << setw(8) << edges().size()-multipleStart_
1503  //<< setw(8) << multipleStart_
1504  << nl;
1505  os << decrIndent;
1506 }
1507 
1508 
1509 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
1510 
1511 Foam::Istream& Foam::operator>>
1513  Istream& is,
1515 )
1516 {
1517  label type;
1518  is >> type;
1519 
1520  vt = static_cast<Foam::extendedEdgeMesh::sideVolumeType>(type);
1521 
1522  // Check state of Istream
1523  is.check("operator>>(Istream&, sideVolumeType&)");
1524 
1525  return is;
1526 }
1527 
1528 
1529 Foam::Ostream& Foam::operator<<
1531  Ostream& os,
1533 )
1534 {
1535  os << static_cast<label>(vt);
1536 
1537  return os;
1538 }
1539 
1540 
1542 {
1543  //fileFormats::extendedEdgeMeshFormat::write(os, em.points_, em.edges_);
1544  os << "// points" << nl
1545  << em.points() << nl
1546  << "// edges" << nl
1547  << em.edges() << nl
1548  << "// concaveStart mixedStart nonFeatureStart" << nl
1549  << em.concaveStart_ << token::SPACE
1550  << em.mixedStart_ << token::SPACE
1551  << em.nonFeatureStart_ << nl
1552  << "// internalStart flatStart openStart multipleStart" << nl
1553  << em.internalStart_ << token::SPACE
1554  << em.flatStart_ << token::SPACE
1555  << em.openStart_ << token::SPACE
1556  << em.multipleStart_ << nl
1557  << "// normals" << nl
1558  << em.normals_ << nl
1559  << "// normal volume types" << nl
1560  << em.normalVolumeTypes_ << nl
1561  << "// normalDirections" << nl
1562  << em.normalDirections_ << nl
1563  << "// edgeNormals" << nl
1564  << em.edgeNormals_ << nl
1565  << "// featurePointNormals" << nl
1566  << em.featurePointNormals_ << nl
1567  << "// featurePointEdges" << nl
1568  << em.featurePointEdges_ << nl
1569  << "// regionEdges" << nl
1570  << em.regionEdges_
1571  << endl;
1572 
1573  // Check state of Ostream
1574  os.check("Ostream& operator<<(Ostream&, const extendedEdgeMesh&)");
1575 
1576  return os;
1577 }
1578 
1579 
1581 {
1582  //fileFormats::extendedEdgeMeshFormat::read(is, em.points_, em.edges_);
1583  is >> static_cast<edgeMesh&>(em)
1584  >> em.concaveStart_
1585  >> em.mixedStart_
1586  >> em.nonFeatureStart_
1587  >> em.internalStart_
1588  >> em.flatStart_
1589  >> em.openStart_
1590  >> em.multipleStart_
1591  >> em.normals_
1592  >> em.normalVolumeTypes_
1593  >> em.normalDirections_
1594  >> em.edgeNormals_
1595  >> em.featurePointNormals_
1596  >> em.featurePointEdges_
1597  >> em.regionEdges_;
1598 
1599  // Check state of Istream
1600  is.check("Istream& operator>>(Istream&, extendedEdgeMesh&)");
1601 
1602  return is;
1603 }
1604 
1605 
1606 // ************************************************************************* //
label concaveStart() const
Return the index of the start of the concave feature points.
extendedEdgeMesh()
Construct null.
cachedRandom rndGen(label(0),-1)
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
static autoPtr< extendedEdgeMesh > New(const fileName &, const word &ext)
Select constructed from filename (explicit extension)
void transfer(edgeMesh &)
Transfer the contents of the argument and annul the argument.
Definition: edgeMesh.C:200
linePointRef line(const pointField &) const
Return edge line.
Definition: edgeI.H:169
A HashTable with keys but without contents.
Definition: HashSet.H:59
label nonFeatureStart() const
Return the index of the start of the non-feature points.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A class for handling file names.
Definition: fileName.H:69
Holds (reference to) pointField. Encapsulation of data needed for octree searches. Used for searching for nearest point. No bounding boxes around points. Only overlaps and calcNearest are implemented, rest makes little sense.
Definition: treeDataPoint.H:59
static wordHashSet readTypes()
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:223
vectorField normals_
Normals of the features, to be referred to by index by both feature.
const labelListList & featurePointEdges() const
Return the edge labels for a given feature point. Edges are.
const double e
Elementary charge.
Definition: doubleFloat.H:78
const point & min() const
Minimum describing the bounding box.
Definition: boundBoxI.H:54
static bool canWriteType(const word &ext, const bool verbose=false)
Can we write this file format type?
void allNearestFeatureEdges(const point &sample, const scalar searchRadiusSqr, List< pointIndexHit > &info) const
Find all the feature edges within searchDistSqr of sample.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
Definition: ListI.H:90
void writeObj(const fileName &prefix) const
Write all components of the extendedEdgeMesh as obj files.
void sortPointsAndEdges(const Patch &, const labelList &featureEdges, const labelList &regionFeatureEdges, const labelList &feaurePoints)
PtrList< indexedOctree< treeDataEdge > > edgeTreesByType_
Individual search trees for each type of edge.
label mixedStart_
Index of the start of the mixed type feature points.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
Description of feature edges and points.
const Point & rawPoint() const
Return point with no checking.
Definition: PointHit.H:158
label openStart_
Index of the start of the open feature edges.
const labelList & featurePoints() const
Return feature point list.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
static const Foam::NamedEnum< sideVolumeType, 4 > sideVolumeTypeNames_
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Holds data for octree to work on an edges subset.
Definition: treeDataEdge.H:53
const point & max() const
Maximum describing the bounding box.
Definition: boundBoxI.H:60
virtual void clear()
Clear all storage.
static const Foam::NamedEnum< edgeStatus, 6 > edgeStatusNames_
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
label concaveStart_
Index of the start of the concave feature points.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:53
List< sideVolumeType > normalVolumeTypes_
Type per normal: which side of normal to mesh.
void add(const extendedEdgeMesh &)
Add extendedEdgeMesh. No filtering of duplicates.
virtual Ostream & write(const char)
Write character.
Definition: OBJstream.C:82
void nearestFeatureEdgeByType(const point &sample, const scalarField &searchDistSqr, List< pointIndexHit > &info) const
Find the nearest point on each type of feature edge.
Initialise the NamedEnum HashTable from the static list of names.
Definition: NamedEnum.H:52
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
edgeMesh()
Construct null.
Definition: edgeMesh.C:123
label internalStart_
Index of the start of the internal feature edges.
labelListList normalDirections_
Starting directions for the edges.
const pointField & points() const
Return points.
Definition: edgeMeshI.H:39
const labelListList & featurePointNormals() const
Return the indices of the normals that are adjacent to the.
A list of faces which address into the list of points.
A List obtained as a section of another List.
Definition: SubList.H:53
void allNearestFeaturePoints(const point &sample, scalar searchRadiusSqr, List< pointIndexHit > &info) const
Find all the feature points within searchDistSqr of sample.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
void flipNormals()
Flip normals. All concave become convex, all internal external.
dynamicFvMesh & mesh
dimensionedScalar cos(const dimensionedScalar &ds)
line< point, const point & > linePointRef
Line using referred points.
Definition: linePointRef.H:45
labelList regionEdges_
Feature edges which are on the boundary between regions.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
List< edge > edgeList
Definition: edgeList.H:38
static label convexStart_
Index of the start of the convex feature points - static as 0.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:58
label multipleStart() const
Return the index of the start of the multiply-connected feature.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
static label nEdgeTypes
Number of possible feature edge types (i.e. number of slices)
void clear()
Clear the list, i.e. set size to zero.
Definition: List.C:356
A class for handling words, derived from string.
Definition: word.H:59
label flatStart_
Index of the start of the flat feature edges.
const indexedOctree< treeDataPoint > & pointTree() const
Demand driven construction of octree for feature points.
Istream & operator>>(Istream &, directionInfo &)
const indexedOctree< treeDataEdge > & edgeTree() const
Demand driven construction of octree for boundary edges.
bool read(const fileName &, const word &ext)
Read from file. Chooses reader based on explicit extension.
~extendedEdgeMesh()
Destructor.
sideVolumeType
Normals point to the outside.
static label externalStart_
Index of the start of the external feature edges - static as 0.
void transfer(extendedEdgeMesh &)
Transfer the contents of the argument and annul the argument.
Dynamically sized Field.
Definition: DynamicField.H:49
virtual void writeStats(Ostream &) const
Definition: edgeMeshIO.C:117
HashSet wordHashSet
A HashSet with word keys.
Definition: HashSet.H:207
autoPtr< indexedOctree< treeDataEdge > > edgeTree_
Search tree for all edges.
pointStatus classifyFeaturePoint(label ptI) const
Classify the type of feature point. Requires valid stored member.
Simple random number generator.
Definition: Random.H:49
const triSurface & surface() const
static scalar cosNormalAngleTol_
Angular closeness tolerance for treating normals as the same.
const PtrList< indexedOctree< treeDataEdge > > & edgeTreesByType() const
Demand driven construction of octree for boundary edges by type.
const labelList & regionEdges() const
Return the feature edges which are on the boundary between.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Istream and Ostream manipulators taking arguments.
label start() const
Return start vertex label.
Definition: edgeI.H:81
void nearestFeaturePoint(const point &sample, scalar searchDistSqr, pointIndexHit &info) const
Find nearest surface edge for the sample point.
OFstream which keeps track of vertices.
Definition: OBJstream.H:53
static const char nl
Definition: Ostream.H:262
defineTypeNameAndDebug(combustionModel, 0)
Points connected by edges.
Definition: edgeMesh.H:69
label openStart() const
Return the index of the start of the open feature edges.
fileName lessExt() const
Return file name without extension (part before last .)
Definition: fileName.C:268
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:237
virtual void writeStats(Ostream &os) const
Dump some information.
virtual void reset(const Xfer< pointField > &points, const Xfer< edgeList > &edges)
Reset primitive data (points, edges)
Definition: edgeMesh.C:178
const List< sideVolumeType > & normalVolumeTypes() const
Return.
label internalStart() const
Return the index of the start of the internal feature edges.
static edgeStatus classifyEdge(const List< vector > &norms, const labelList &edNorms, const vector &fC0tofC1)
Classify the type of feature edge. Requires face centre 0 to face.
static bool canReadType(const word &ext, const bool verbose=false)
Can we read this file format?
virtual void clear()
Clear all storage.
Definition: edgeMesh.C:169
void setSize(const label)
Reset size of List.
Definition: List.C:295
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Definition: Field.C:577
Xfer< extendedEdgeMesh > xfer()
Transfer contents to the Xfer container.
label nRegionEdges() const
Return number of region edges.
label multipleStart_
Index of the start of the multiply-connected feature edges.
vector point
Point is a vector.
Definition: point.H:41
static const Foam::NamedEnum< pointStatus, 4 > pointStatusNames_
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
label newPointi
Definition: readKivaGrid.H:501
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:62
label flatStart() const
Return the index of the start of the flat feature edges.
const vectorField & normals() const
Return the normals of the surfaces adjacent to the feature edges.
A List with indirect addressing.
Definition: fvMatrix.H:106
const labelListList & normalDirections() const
Ostream & operator<<(Ostream &, const ensightPart &)
static bool canRead(const fileName &, const bool verbose=false)
Can we read this file format?
word ext() const
Return file name extension (part after last .)
Definition: fileName.C:283
const edgeList & edges() const
Return edges.
Definition: edgeMeshI.H:45
const labelListList & edgeNormals() const
Return the indices of the normals that are adjacent to the.
static void write(const fileName &, const edgeMesh &)
Write to file.
Definition: edgeMeshIO.C:87
labelListList featurePointEdges_
Indices of feature edges attached to feature points. The edges are.
Standard boundBox + extra functionality for use in octree.
Definition: treeBoundBox.H:87
messageStream Info
static label nPointTypes
Number of possible point types (i.e. number of slices)
static wordHashSet writeTypes()
const labelListList & edgeFaces() const
Return edge-face addressing.
PointHit< Point > nearestDist(const Point &p) const
Return nearest distance to line from a given point.
Definition: lineI.H:95
bool hit() const
Is there a hit.
Definition: PointHit.H:120
label mixedStart() const
Return the index of the start of the mixed type feature points.
Omanip< int > setw(const int i)
Definition: IOmanip.H:199
labelListList featurePointNormals_
Indices of the normals that are adjacent to the feature points.
const vectorField & edgeDirections() const
Return the edgeDirection vectors.
labelListList edgeNormals_
Indices of the normals that are adjacent to the feature edges.
Triangulated surface description with patch information.
Definition: triSurface.H:65
label nonFeatureStart_
Index of the start of the non-feature points.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:230
vectorField edgeDirections_
Flat and open edges require the direction of the edge.
autoPtr< indexedOctree< treeDataPoint > > pointTree_
Search tree for all feature points.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Definition: List.C:365
const fileName & name() const
Return the name of the stream.
Definition: OFstream.H:118
DynamicField< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
const labelList & featureEdges() const
Return feature edge list.
void nearestFeatureEdge(const point &sample, scalar searchDistSqr, pointIndexHit &info) const
Find nearest surface edge for the sample point.
Holds feature edges/points of surface.
Namespace for OpenFOAM.
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
const labelListList & pointEdges() const
Return edges.
Definition: edgeMeshI.H:51