41 const label vertPerCell,
42 const label facePerCell,
43 const label maxVertPerFace,
44 const word& cellModelName
48 localFaces_(facePerCell),
49 faceSize_(facePerCell, -1),
50 pointMap_(vertPerCell),
51 faceMap_(facePerCell),
52 edgeFaces_(2*vertPerCell*vertPerCell),
53 pointFaceIndex_(vertPerCell),
54 vertLabels_(vertPerCell),
55 faceLabels_(facePerCell),
56 cellModelName_(cellModelName),
57 cellModelPtr_(nullptr)
61 f.setSize(maxVertPerFace);
66 faceIndices.setSize(facePerCell);
86 const label facei = myFaces[myFacei];
88 const face&
f = faces[facei];
89 face& localFace = localFaces_[myFacei];
92 faceSize_[myFacei] =
f.
size();
96 const label vertI =
f[localVertI];
98 const auto iter = localPoint_.cfind(vertI);
102 localFace[localVertI] = iter.val();
108 if (newVertI >= pointMap_.size())
114 localFace[localVertI] = newVertI;
115 localPoint_.insert(vertI, newVertI);
121 faceMap_[myFacei] = facei;
127 pointMap_[iter.val()] = iter.key();
141 forAll(localFaces_, localFacei)
143 const face&
f = localFaces_[localFacei];
145 label prevVertI = faceSize_[localFacei] - 1;
150 fp < faceSize_[localFacei];
154 label start =
f[prevVertI];
157 label key1 = edgeKey(numVert, start,
end);
158 label key2 = edgeKey(numVert,
end, start);
160 if (edgeFaces_[key1] == -1)
163 edgeFaces_[key1] = localFacei;
164 edgeFaces_[key2] = localFacei;
166 else if (edgeFaces_[key1+1] == -1)
169 edgeFaces_[key1+1] = localFacei;
170 edgeFaces_[key2+1] = localFacei;
175 <<
"edgeFaces_ full at entry:" << key1
176 <<
" for edge " << start <<
" " <<
end 189 for (
labelList& faceIndices : pointFaceIndex_)
194 forAll(localFaces_, localFacei)
196 const face&
f = localFaces_[localFacei];
201 fp < faceSize_[localFacei];
205 const label vert =
f[fp];
206 pointFaceIndex_[vert][localFacei] = fp;
217 const label localFacei
220 const label
key = edgeKey(numVert, v0, v1);
222 if (edgeFaces_[
key] == localFacei)
224 return edgeFaces_[
key+1];
226 else if (edgeFaces_[
key+1] == localFacei)
228 return edgeFaces_[
key];
232 <<
"edgeFaces_ does not contain:" << localFacei
233 <<
" for edge " << v0 <<
" " << v1 <<
" at key " <<
key 234 <<
" edgeFaces_[key, key+1]:" << edgeFaces_[
key]
235 <<
" , " << edgeFaces_[
key+1]
246 forAll(localFaces_, facei)
250 for (label fp = 0; fp < faceSize_[facei]; fp++)
252 os <<
' ' << localFaces_[facei][fp];
257 os <<
"Face map : " << faceMap_ <<
nl;
258 os <<
"Point map : " << pointMap_ <<
endl;
void size(const label n)
Older name for setAddressableSize.
A face is a list of labels corresponding to mesh vertices.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
cellMatcher(const cellMatcher &)=delete
No copy construct.
void calcEdgeAddressing(const label numVert)
Fill edge (start, end) to face number.
labelListList pointFaceIndex_
pointFaceIndex[localVertI][localFacei] is index in localFace
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
List< face > faceList
List of faces.
void calcPointFaceIndex()
Fill vertex/face to index in face data structure.
A class for handling words, derived from Foam::string.
label calcLocalFaces(const faceList &faces, const labelList &myFaces)
Calculates localFaces. Returns number of local vertices (or -1.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
faceList localFaces_
Faces using local vertex numbering.
OBJstream os(runTime.globalPath()/outputName)
label otherFace(const label numVert, const label v0, const label v1, const label localFacei) const
Given start,end of edge lookup both faces sharing it and return.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
void write(Ostream &os) const
List< label > labelList
A List of labels.
forAllConstIters(mixture.phases(), phase)