60 const Foam::scalar Foam::perfectInterface::tol_ = 1
e-3;
76 ctrs[patchFacei] =
pp[patchFacei].centre(
points);
85 Foam::perfectInterface::perfectInterface
90 const word& faceZoneName,
91 const word& masterPatchName,
92 const word& slavePatchName
96 faceZoneID_(faceZoneName, mme.
mesh().faceZones()),
102 Foam::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();
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)
292 face newFace(
f.
size());
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])
348 ref.setAction(polyRemovePoint(meshPointi));
356 label facei = pp1.addressing()[i];
357 ref.setAction(polyRemoveFace(facei));
369 label facei = pp0.addressing()[i];
373 face newFace(
f.
size());
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()
444 const polyMesh&
mesh = topoChanger().mesh();
447 const polyPatch& patch0 =
patches[masterPatchID_.index()];
448 const polyPatch& patch1 =
patches[slavePatchID_.index()];
462 setRefinement(pp0, pp1,
ref);
489 << faceZoneID_.name() <<
nl 490 << masterPatchID_.name() <<
nl 491 << slavePatchID_.name() <<
endl;
503 os.
writeEntry(
"masterPatchName", masterPatchID_.name());
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
A class for handling keywords in dictionaries.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
List< edge > edgeList
List of edge.
constexpr char nl
The newline '\n' character (0x0a)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
virtual void write(Ostream &) const
Write.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field...
Determine correspondence between points. See below.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
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.
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.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
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 of mesh modifiers defining the mesh dynamics.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual Ostream & endBlock()
Write end block group.
virtual const labelList & faceOwner() const
Return face owner.
virtual const faceList & faces() const
Return raw faces.
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Virtual base class for mesh modifiers.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
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]
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
#define WarningInFunction
Report a warning using Foam::Warning.
const polyBoundaryMesh & patches
virtual void writeDict(Ostream &) const
Write dictionary.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
const labelListList & pointFaces() const
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
virtual bool changeTopology() const
Check for topology change.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)