43 const Foam::scalar Foam::perfectInterface::tol_ = 1
e-3;
59 ctrs[patchFacei] = pp[patchFacei].centre(
points);
72 const word& masterPatchName,
73 const word& slavePatchName
77 masterPatchIndex_(mesh_.boundaryMesh().
findIndex(masterPatchName)),
78 slavePatchIndex_(mesh_.boundaryMesh().
findIndex(slavePatchName))
109 scalar minLen = great;
113 minLen =
min(minLen, edges0[edgeI].
mag(pts0));
115 scalar typDim = tol_*minLen;
119 Pout<<
"typDim:" << typDim <<
" edges0:" << edges0.
size()
120 <<
" pts0:" << pts0.
size() <<
" pts1:" << pts1.
size()
121 <<
" pp0:" << pp0.
size() <<
" pp1:" << pp1.
size() <<
endl;
128 labelList renumberPoints(mesh_.points().size());
131 renumberPoints[i] = i;
148 <<
"Points on patch sides do not match to within tolerance "
154 renumberPoints[meshPts1[i]] = meshPts0[from1To0Points[i]];
166 calcFaceCentres(pp0),
167 calcFaceCentres(pp1),
176 <<
"Face centres of patch sides do not match to within tolerance "
191 const label meshPointi = meshPts1[i];
193 if (meshPointi != renumberPoints[meshPointi])
215 if (affectedFaces.
erase(facei))
218 <<
"Found face " << facei <<
" vertices "
219 << mesh_.faces()[facei] <<
" whose points are"
220 <<
" used both by master patch and slave patch" <<
endl;
228 const label facei = iter.key();
229 const face&
f = mesh_.faces()[facei];
235 newFace[fp] = renumberPoints[
f[fp]];
242 if (mesh_.isInternalFace(facei))
244 nbr = mesh_.faceNeighbour()[facei];
255 mesh_.faceOwner()[facei],
266 const label meshPointi = meshPts1[i];
268 if (meshPointi != renumberPoints[meshPointi])
270 ref.removePoint(meshPointi, -1);
279 ref.removeFace(facei, -1);
289 const face&
f = mesh_.faces()[facei];
295 newFace[fp] = renumberPoints[
f[fp]];
298 const label own = mesh_.faceOwner()[facei];
300 const label nbr = mesh_.faceOwner()[pp1Facei];
334 Pout<<
"bool perfectInterface::setRefinement(polyTopoChange&) const : "
335 <<
"masterPatchIndex_:" << masterPatchIndex_
336 <<
" slavePatchIndex_:" << slavePatchIndex_ <<
endl;
357 setRefinement(pp0, pp1,
ref);
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
bool insert(const Key &key)
Insert a new entry.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
A List with indirect addressing.
void size(const label)
Override size to be inconsistent with allocated storage.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
label size() const
Return the number of elements in the list.
const List< label > & addressing() const
Return the list addressing.
label size() const
Return the number of elements in the UList.
A face is a list of labels corresponding to mesh vertices.
face reverseFace() const
Return face with reverse direction.
Hack of attachDetach to couple patches when they perfectly align. Does not decouple....
perfectInterface(const word &name, const polyMesh &mesh, const word &masterPatchName, const word &slavePatchName)
Construct from components.
virtual ~perfectInterface()
Destructor.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
Determine correspondence between points. See below.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar e
Elementary charge.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
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.
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("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]=cellShape(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, &mergedCyclicPolyPatch::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]