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

Function combine

src/meshTools/sets/faceSources/regionToFace/regionToFace.C:113–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111
112
113void Foam::regionToFace::combine(topoSet& set, const bool add) const
114{
115 Info<< " Loading subset " << setName_ << " to delimit search region."
116 << endl;
117 faceSet subSet(mesh_, setName_);
118
119 indirectPrimitivePatch patch
120 (
121 IndirectList<face>(mesh_.faces(), subSet.toc()),
122 mesh_.points()
123 );
124
125 mappedPatchBase::nearInfo ni
126 (
127 pointIndexHit(false, Zero, -1),
128 Tuple2<scalar, label>
129 (
130 sqr(GREAT),
131 Pstream::myProcNo()
132 )
133 );
134
135 forAll(patch, i)
136 {
137 const point& fc = patch.faceCentres()[i];
138 scalar d2 = magSqr(fc-nearPoint_);
139
140 if (!ni.first().hit() || d2 < ni.second().first())
141 {
142 ni.second().first() = d2;
143 ni.first().setHit();
144 ni.first().setPoint(fc);
145 ni.first().setIndex(i);
146 }
147 }
148
149 // Globally reduce
150 combineReduce(ni, mappedPatchBase::nearestEqOp());
151
152 Info<< " Found nearest face at " << ni.first().rawPoint()
153 << " on processor " << ni.second().second()
154 << " face " << ni.first().index()
155 << " distance " << Foam::sqrt(ni.second().first()) << endl;
156
157 labelList faceRegion(patch.size(), -1);
158 markZone
159 (
160 patch,
161 ni.second().second(), // proci
162 ni.first().index(), // start face
163 0, // currentZone
164 faceRegion
165 );
166
167 forAll(faceRegion, facei)
168 {
169 if (faceRegion[facei] == 0)
170 {

Callers 1

applyToSetFunction · 0.70

Calls 14

combineReduceFunction · 0.85
nearestEqOpClass · 0.85
sqrtFunction · 0.85
addOrDeleteFunction · 0.85
setIndexMethod · 0.80
markZoneFunction · 0.70
sqrFunction · 0.50
forAllFunction · 0.50
magSqrFunction · 0.50
hitMethod · 0.45
firstMethod · 0.45
setHitMethod · 0.45

Tested by

no test coverage detected