60const Foam::scalar Foam::perfectInterface::tol_ = 1
e-3;
67 const indirectPrimitivePatch&
pp
76 ctrs[patchFacei] =
pp[patchFacei].centre(
points);
85Foam::perfectInterface::perfectInterface
90 const word& faceZoneName,
91 const word& masterPatchName,
92 const word& slavePatchName
96 faceZoneID_(faceZoneName, mme.
mesh().faceZones()),
102Foam::perfectInterface::perfectInterface
114 mme.
mesh().faceZones()
138 Pout<<
"bool perfectInterface::changeTopology() const "
139 <<
"for object " <<
name() <<
" : "
140 <<
"Inactive" <<
endl;
160 const polyMesh&
mesh = topoChanger().mesh();
162 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
165 const edgeList& edges0 = pp0.edges();
168 const labelList& meshPts0 = pp0.meshPoints();
169 const labelList& meshPts1 = pp1.meshPoints();
174 scalar minLen = GREAT;
178 minLen =
min(minLen, edges0[edgeI].
mag(pts0));
180 scalar typDim = tol_*minLen;
184 Pout<<
"typDim:" << typDim <<
" edges0:" << edges0.size()
185 <<
" pts0:" << pts0.size() <<
" pts1:" << pts1.size()
186 <<
" pp0:" << pp0.size() <<
" pp1:" << pp1.size() <<
endl;
196 renumberPoints[i] = i;
213 <<
"Points on patch sides do not match to within tolerance "
219 renumberPoints[meshPts1[i]] = meshPts0[from1To0Points[i]];
231 calcFaceCentres(pp0),
232 calcFaceCentres(pp1),
241 <<
"Face centres of patch sides do not match to within tolerance "
256 label meshPointi = meshPts1[i];
258 if (meshPointi != renumberPoints[meshPointi])
262 affectedFaces.insert(
pFaces);
267 affectedFaces.erase(pp1.addressing()[i]);
275 label facei = pp0.addressing()[i];
277 if (affectedFaces.erase(facei))
280 <<
"Found face " << facei <<
" vertices "
281 <<
mesh.
faces()[facei] <<
" whose points are"
282 <<
" used both by master patch and slave patch" <<
endl;
288 for (
const label facei : affectedFaces)
296 newFace[fp] = renumberPoints[
f[fp]];
314 bool zoneFlip =
false;
320 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
344 label meshPointi = meshPts1[i];
346 if (meshPointi != renumberPoints[meshPointi])
356 label facei = pp1.addressing()[i];
369 label facei = pp0.addressing()[i];
377 newFace[fp] = renumberPoints[
f[fp]];
382 label pp1Facei = pp1.addressing()[from0To1Faces[i]];
410 newFace.reverseFace(),
430 Pout<<
"bool perfectInterface::setRefinement(polyTopoChange&) const : "
431 <<
"for object " <<
name() <<
" : "
432 <<
"masterPatchID_:" << masterPatchID_
433 <<
" slavePatchID_:" << slavePatchID_
434 <<
" faceZoneID_:" << faceZoneID_ <<
endl;
439 masterPatchID_.active()
440 && slavePatchID_.active()
441 && faceZoneID_.active()
479 faceZoneID_.update(
mesh.faceZones());
480 masterPatchID_.update(
mesh.boundaryMesh());
481 slavePatchID_.update(
mesh.boundaryMesh());
489 << faceZoneID_.name() <<
nl
490 << masterPatchID_.name() <<
nl
491 << slavePatchID_.name() <<
endl;
500 os.writeEntry(
"type",
type());
501 os.writeEntry(
"active", active());
502 os.writeEntry(
"faceZoneName", faceZoneID_.name());
503 os.writeEntry(
"masterPatchName", masterPatchID_.name());
504 os.writeEntry(
"slavePatchName", slavePatchID_.name());
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
label size() const noexcept
The number of elements in the list.
A List with indirect addressing.
const Addr & addressing() const noexcept
The list addressing.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
const Field< point_type > & localPoints() const
Return pointField of points in patch.
void size(const label n)
Older name for setAddressableSize.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A subset of mesh faces organised as a primitive patch.
label whichFace(const label meshFaceID) const
The local index of the given mesh face, -1 if not in the zone.
const boolList & flipMap() const noexcept
Return face flip map.
A face is a list of labels corresponding to mesh vertices.
face reverseFace() const
Return face with reverse direction.
A class for handling keywords in dictionaries.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Hack of attachDetach to couple patches when they perfectly align. Does not decouple....
virtual void write(Ostream &) const
Write.
virtual bool changeTopology() const
Check for topology change.
virtual void writeDict(Ostream &) const
Write dictionary.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
Virtual base class for mesh modifiers.
label index() const
Return the index of this modifier.
const word & name() const
Return name of this modifier.
Switch active() const
If modifier activate?
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
Class describing modification of a face.
A patch is a list of labels that address the faces in the global face list.
labelRange range() const
Return start/size range of this patch.
Class containing data for face removal.
Class containing data for point removal.
Direct mesh changes based on v1.3 polyTopoChange syntax.
List of mesh modifiers defining the mesh dynamics.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
const labelListList & pointFaces() const
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Determine correspondence between points. See below.
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
List< edge > edgeList
List of edge.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
List< bool > boolList
A List of bools.
bool matchPoints(const UList< point > &pts0, const UList< point > &pts1, const UList< scalar > &matchDistance, const bool verbose, labelList &from0To1, const point &origin=point::zero)
Determine correspondence between pointFields. Gets passed.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells].reset(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};constexpr label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< DynamicList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.