60const Foam::scalar Foam::perfectInterface::tol_ = 1
e-3;
67 const indirectPrimitivePatch& pp
76 ctrs[patchFacei] = pp[patchFacei].centre(
points);
90 const word& faceZoneName,
91 const word& masterPatchName,
92 const word& slavePatchName
96 faceZoneID_(faceZoneName, mme.
mesh().faceZones()),
114 mme.
mesh().faceZones()
138 Pout<<
"bool perfectInterface::changeTopology() const "
139 <<
"for object " <<
name() <<
" : "
140 <<
"Inactive" <<
endl;
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])
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;
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]];
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()
462 setRefinement(pp0, pp1,
ref);
489 << faceZoneID_.name() <<
nl
490 << masterPatchID_.name() <<
nl
491 << slavePatchID_.name() <<
endl;
503 os.
writeEntry(
"masterPatchName", masterPatchID_.name());
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
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.
A List with indirect addressing.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
A list of faces which address into the list of points.
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,...
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
A subset of mesh faces organised as a primitive patch.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
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.
virtual bool write()
Write the output fields.
Foam::dictionary writeDict() const
Write to dictionary.
A class for handling keywords in dictionaries.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void updateMesh()
Update for new mesh topology.
Hack of attachDetach to couple patches when they perfectly align. Does not decouple....
virtual bool changeTopology() const
Check for topology change.
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.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Virtual base class for mesh modifiers.
Mesh consisting of general polyhedral cells.
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.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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)
const labelIOList & zoneID
Determine correspondence between points. See below.
#define WarningInFunction
Report a warning using Foam::Warning.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
vectorField pointField
pointField is a vectorField.
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)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
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];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } 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};const 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< SLList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.