MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / countPointRegions

Function countPointRegions

src/meshTools/regionSplit/localPointRegion.C:101–239  ·  view source on GitHub ↗

Count regions per point

Source from the content-addressed store, hash-verified

99
100// Count regions per point
101void Foam::localPointRegion::countPointRegions
102(
103 const polyMesh& mesh,
104 const boolList& candidatePoint,
105 const Map<label>& candidateFace,
106 faceList& minRegion
107)
108{
109 // Almost all will have only one so only
110 // populate Map if more than one.
111 labelList minPointRegion(mesh.nPoints(), -1);
112 // From global point to local (multi-region) point numbering
113 meshPointMap_.resize(candidateFace.size()/100);
114 // From local (multi-region) point to regions
115 DynamicList<labelList> pointRegions(meshPointMap_.size());
116
117 // From faces with any duplicated point on it to local face
118 meshFaceMap_.resize(meshPointMap_.size());
119
120 forAllConstIter(Map<label>, candidateFace, iter)
121 {
122 label facei = iter.key();
123
124 if (!mesh.isInternalFace(facei))
125 {
126 const face& f = mesh.faces()[facei];
127
128 if (minRegion[facei].empty())
129 {
130 FatalErrorInFunction
131 << "Face from candidateFace without minRegion set." << endl
132 << "Face:" << facei << " fc:" << mesh.faceCentres()[facei]
133 << " verts:" << f << abort(FatalError);
134 }
135
136 forAll(f, fp)
137 {
138 label pointi = f[fp];
139
140 // Even points which were not candidates for splitting might
141 // be on multiple baffles that are being split so check.
142
143 if (candidatePoint[pointi])
144 {
145 label region = minRegion[facei][fp];
146
147 if (minPointRegion[pointi] == -1)
148 {
149 minPointRegion[pointi] = region;
150 }
151 else if (minPointRegion[pointi] != region)
152 {
153 // Multiple regions for this point. Add.
154 Map<label>::iterator iter = meshPointMap_.find(pointi);
155 if (iter != meshPointMap_.end())
156 {
157 labelList& regions = pointRegions[iter()];
158 if (findIndex(regions, region) == -1)

Callers 1

calcPointRegionsFunction · 0.85

Calls 15

findIndexFunction · 0.85
isInternalFaceMethod · 0.80
shrinkMethod · 0.80
forAllConstIterFunction · 0.50
abortFunction · 0.50
forAllFunction · 0.50
transferFunction · 0.50
resizeMethod · 0.45
sizeMethod · 0.45
keyMethod · 0.45
facesMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected