triSurfaceMetaData.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "triSurfaceMetaData.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
38 {
39  metaDict_.clear();
40 
41  metaDict_.add("nPoints", surf_.points().size());
42  metaDict_.add("nFacets", surf_.facets().size());
43  metaDict_.add("nPatches", surf_.patches().size());
44  metaDict_.add("nFeatureEdges", surf_.featureEdges().size());
45 
47 
48  //- store nformation about surface patches
49  labelList nInPatch(surf_.patches().size(), 0);
50  forAll(surf_, triI)
51  ++nInPatch[surf_[triI].region()];
52 
53  forAll(surf_.patches(), patchI)
54  {
55  const geometricSurfacePatch& patch = surf_.patches()[patchI];
56 
57  dictionary pDict;
58  pDict.add("type", patch.geometricType());
59  pDict.add("nFacets", nInPatch[patchI]);
60 
61  dict.add(patch.name(), pDict);
62  }
63 
64  metaDict_.add("patches", dict);
65 
66  //- store information about point subsets
67  DynList<label> subsetIds;
68  surf_.pointSubsetIndices(subsetIds);
69  dict.clear();
70  forAll(subsetIds, i)
71  {
72  dictionary sDict;
73 
74  labelLongList inSubset;
75  surf_.pointsInSubset(subsetIds[i], inSubset);
76  sDict.add("nPoints", inSubset.size());
77 
78  dict.add(surf_.pointSubsetName(subsetIds[i]), sDict);
79  }
80 
81  metaDict_.add("pointSubsets", dict);
82 
83  //- store information about facet subsets
84  subsetIds.clear();
85  surf_.facetSubsetIndices(subsetIds);
86  dict.clear();
87  forAll(subsetIds, i)
88  {
89  dictionary sDict;
90 
91  labelLongList inSubset;
92  surf_.facetsInSubset(subsetIds[i], inSubset);
93  sDict.add("nFacets", inSubset.size());
94 
95  dict.add(surf_.facetSubsetName(subsetIds[i]), sDict);
96  }
97 
98  metaDict_.add("facetSubsets", dict);
99 
100  //- store information about feature edge subsets
101  subsetIds.clear();
102  surf_.edgeSubsetIndices(subsetIds);
103  dict.clear();
104  forAll(subsetIds, i)
105  {
106  dictionary sDict;
107 
108  labelLongList inSubset;
109  surf_.edgesInSubset(subsetIds[i], inSubset);
110  sDict.add("nEdges", inSubset.size());
111 
112  dict.add(surf_.edgeSubsetName(subsetIds[i]), sDict);
113  }
114 
115  metaDict_.add("featureEdgeSubsets", dict);
116 }
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
121 :
122  surf_(surface),
123  metaDict_()
124 {
125  createMetaData();
126 }
127 
129 {}
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // ************************************************************************* //
Foam::triSurfPoints::pointsInSubset
void pointsInSubset(const label, ListType &) const
Definition: triSurfPointsI.H:117
Foam::triSurfPoints::pointSubsetName
word pointSubsetName(const label) const
Definition: triSurfPoints.C:84
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::triSurfPoints::points
const pointField & points() const
access to points
Definition: triSurfPointsI.H:44
Foam::triSurfFeatureEdges::edgesInSubset
void edgesInSubset(const label, ListType &) const
Definition: triSurfFeatureEdgesI.H:118
Foam::geometricSurfacePatch
The geometricSurfacePatch is like patchIdentifier but for surfaces. Holds type, name and index.
Definition: geometricSurfacePatch.H:53
Foam::LongList::size
label size() const
Size of the active part of the list.
Definition: LongListI.H:203
Foam::triSurfFeatureEdges::featureEdges
const edgeLongList & featureEdges() const
access to feature edges
Definition: triSurfFeatureEdgesI.H:44
Foam::triSurfaceMetaData::metaDict_
dictionary metaDict_
patches/subsets for removal
Definition: triSurfaceMetaData.H:61
Foam::LongList< label >
Foam::geometricSurfacePatch::geometricType
const word & geometricType() const
Return the type of the patch.
Definition: geometricSurfacePatch.H:113
Foam::triSurfaceMetaData::surf_
const triSurf & surf_
const reference to triSurf
Definition: triSurfaceMetaData.H:58
Foam::triSurfFacets::patches
const geometricSurfacePatchList & patches() const
access to patches
Definition: triSurfFacetsI.H:49
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::DynList< label >
Foam::triSurfPoints::pointSubsetIndices
void pointSubsetIndices(DynList< label > &) const
Definition: triSurfPointsI.H:102
Foam::triSurfFeatureEdges::edgeSubsetIndices
void edgeSubsetIndices(DynList< label > &) const
Definition: triSurfFeatureEdgesI.H:101
Foam::triSurfFacets::facetSubsetIndices
void facetSubsetIndices(DynList< label > &) const
Definition: triSurfFacetsI.H:105
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::triSurfaceMetaData::~triSurfaceMetaData
~triSurfaceMetaData()
Definition: triSurfaceMetaData.C:128
Foam::surface
Definition: surface.H:55
Foam::triSurfaceMetaData::createMetaData
void createMetaData()
create dictionary with meta data
Definition: triSurfaceMetaData.C:37
Foam::triSurfFacets::facets
const LongList< labelledTri > & facets() const
access to facets
Definition: triSurfFacetsI.H:44
Foam::triSurfFacets::facetSubsetName
word facetSubsetName(const label) const
Definition: triSurfFacets.C:135
Foam::triSurfFacets::facetsInSubset
void facetsInSubset(const label, ListType &) const
Definition: triSurfFacetsI.H:120
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::triSurfFeatureEdges::edgeSubsetName
word edgeSubsetName(const label) const
Definition: triSurfFeatureEdges.C:84
Foam::triSurf
Definition: triSurf.H:59
Foam::dictionary::clear
void clear()
Clear the dictionary.
Definition: dictionary.C:1050
Foam::geometricSurfacePatch::name
const word & name() const
Return name.
Definition: geometricSurfacePatch.H:101
Foam::DynList::clear
void clear()
Clear the list, i.e. set next free to zero.
Definition: DynListI.H:279
Foam::dictionary::add
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:729
Foam::triSurfaceMetaData::triSurfaceMetaData
triSurfaceMetaData(const triSurfaceMetaData &)
Disallow default bitwise copy construct.
triSurfaceMetaData.H