mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: handle partially attached master/slave faces (issue #608)
- addresses problems if faces are already partly attached (eg, on a single vertex or along an edge).
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -197,30 +197,57 @@ class polyTopoChange
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Reorder contents of container according to map
|
||||
//- Reorder contents of container according to oldToNew map
|
||||
template<class T>
|
||||
static void reorder(const labelList& map, DynamicList<T>&);
|
||||
template<class T>
|
||||
static void reorder(const labelList& map, List<DynamicList<T>>&);
|
||||
template<class T>
|
||||
static void renumberKey(const labelList& map, Map<T>&);
|
||||
static void reorder
|
||||
(
|
||||
const labelUList& oldToNew,
|
||||
DynamicList<T>& lst
|
||||
);
|
||||
|
||||
template<class T>
|
||||
static void reorder
|
||||
(
|
||||
const labelUList& oldToNew,
|
||||
List<DynamicList<T>>& lst
|
||||
);
|
||||
|
||||
template<class T>
|
||||
static void renumberKey
|
||||
(
|
||||
const labelUList& oldToNew,
|
||||
Map<T>& map
|
||||
);
|
||||
|
||||
//- Renumber elements of container according to oldToNew map
|
||||
static void renumber
|
||||
(
|
||||
const labelUList& oldToNew,
|
||||
labelHashSet& labels
|
||||
);
|
||||
|
||||
//- Renumber elements of container according to map
|
||||
static void renumber(const labelList&, labelHashSet&);
|
||||
//- Special handling of reverse maps which have <-1 in them
|
||||
static void renumberReverseMap(const labelList&, DynamicList<label>&);
|
||||
static void renumberReverseMap
|
||||
(
|
||||
const labelUList& oldToNew,
|
||||
DynamicList<label>& elems
|
||||
);
|
||||
|
||||
//- Renumber & compact elements of list according to map
|
||||
static void renumberCompact(const labelList&, labelList&);
|
||||
static void renumberCompact
|
||||
(
|
||||
const labelUList& oldToNew,
|
||||
labelList& elems
|
||||
);
|
||||
|
||||
//- Get all set elements as a labelHashSet
|
||||
static labelHashSet getSetIndices(const PackedBoolList&);
|
||||
static labelHashSet getSetIndices(const PackedBoolList& lst);
|
||||
|
||||
//- Count number of added and removed quantities from maps.
|
||||
static void countMap
|
||||
(
|
||||
const labelList& map,
|
||||
const labelList& reverseMap,
|
||||
const labelUList& map,
|
||||
const labelUList& reverseMap,
|
||||
label& nAdd,
|
||||
label& nInflate,
|
||||
label& nMerge,
|
||||
@ -228,19 +255,19 @@ class polyTopoChange
|
||||
);
|
||||
|
||||
//- Print some stats about mesh
|
||||
static void writeMeshStats(const polyMesh& mesh, Ostream&);
|
||||
static void writeMeshStats(const polyMesh& mesh, Ostream& os);
|
||||
|
||||
//- Calculate object maps. Requires reverseMap to have destination
|
||||
// to be marked with <-1.
|
||||
static void getMergeSets
|
||||
(
|
||||
const labelList& reverseCellMap,
|
||||
const labelList& cellMap,
|
||||
const labelUList& reverseCellMap,
|
||||
const labelUList& cellMap,
|
||||
List<objectMap>& cellsFromCells
|
||||
);
|
||||
|
||||
//- Are all face vertices valid
|
||||
bool hasValidPoints(const face&) const;
|
||||
bool hasValidPoints(const face& f) const;
|
||||
|
||||
//- Return face points
|
||||
pointField facePoints(const face& f) const;
|
||||
@ -248,7 +275,7 @@ class polyTopoChange
|
||||
//- Check inputs to modFace or addFace
|
||||
void checkFace
|
||||
(
|
||||
const face&,
|
||||
const face& f,
|
||||
const label facei,
|
||||
const label own,
|
||||
const label nei,
|
||||
@ -274,16 +301,16 @@ class polyTopoChange
|
||||
//- Cell ordering (bandCompression). Returns number of remaining cells.
|
||||
label getCellOrder
|
||||
(
|
||||
const CompactListList<label, labelList>&,
|
||||
labelList&
|
||||
const CompactListList<label, labelList>& cellCellAddressing,
|
||||
labelList& oldToNew
|
||||
) const;
|
||||
|
||||
//- Do upper-triangular ordering and patch ordering.
|
||||
void getFaceOrder
|
||||
(
|
||||
const label nActiveFaces,
|
||||
const labelList& cellFaces,
|
||||
const labelList& cellFaceOffsets,
|
||||
const labelUList& cellFaces,
|
||||
const labelUList& cellFaceOffsets,
|
||||
|
||||
labelList& oldToNew,
|
||||
labelList& patchSizes,
|
||||
@ -294,7 +321,7 @@ class polyTopoChange
|
||||
void reorderCompactFaces
|
||||
(
|
||||
const label newSize,
|
||||
const labelList& oldToNew
|
||||
const labelUList& oldToNew
|
||||
);
|
||||
|
||||
//- Remove all unused/removed points/faces/cells and update
|
||||
@ -314,50 +341,50 @@ class polyTopoChange
|
||||
//- Select either internal or external faces out of faceLabels
|
||||
static labelList selectFaces
|
||||
(
|
||||
const primitiveMesh&,
|
||||
const labelList& faceLabels,
|
||||
const primitiveMesh& mesh,
|
||||
const labelUList& faceLabels,
|
||||
const bool internalFacesOnly
|
||||
);
|
||||
|
||||
//- Calculate mapping for patchpoints only
|
||||
void calcPatchPointMap
|
||||
(
|
||||
const List<Map<label>>&,
|
||||
const polyBoundaryMesh&,
|
||||
labelListList&
|
||||
const UList<Map<label>>& oldPatchMeshPointMaps,
|
||||
const polyBoundaryMesh& boundary,
|
||||
labelListList& patchPointMap
|
||||
) const;
|
||||
|
||||
void calcFaceInflationMaps
|
||||
(
|
||||
const polyMesh&,
|
||||
List<objectMap>&,
|
||||
List<objectMap>&,
|
||||
List<objectMap>&
|
||||
const polyMesh& mesh,
|
||||
List<objectMap>& facesFromPoints,
|
||||
List<objectMap>& facesFromEdges,
|
||||
List<objectMap>& facesFromFaces
|
||||
) const;
|
||||
|
||||
void calcCellInflationMaps
|
||||
(
|
||||
const polyMesh&,
|
||||
List<objectMap>&,
|
||||
List<objectMap>&,
|
||||
List<objectMap>&,
|
||||
List<objectMap>&
|
||||
const polyMesh& mesh,
|
||||
List<objectMap>& cellsFromPoints,
|
||||
List<objectMap>& cellsFromEdges,
|
||||
List<objectMap>& cellsFromFaces,
|
||||
List<objectMap>& cellsFromCells
|
||||
) const;
|
||||
|
||||
void resetZones
|
||||
(
|
||||
const polyMesh&, // mesh to get existing info from
|
||||
polyMesh&, // mesh to change zones on
|
||||
labelListList&,
|
||||
labelListList&,
|
||||
labelListList&
|
||||
const polyMesh& mesh, // mesh to get existing info from
|
||||
polyMesh& newMesh, // mesh to change zones on
|
||||
labelListList& pointZoneMap,
|
||||
labelListList& faceZoneFaceMap,
|
||||
labelListList& cellZoneMap
|
||||
) const;
|
||||
|
||||
void calcFaceZonePointMap
|
||||
(
|
||||
const polyMesh&,
|
||||
const List<Map<label>>&,
|
||||
labelListList&
|
||||
const polyMesh& mesh,
|
||||
const UList<Map<label>>& oldFaceZoneMeshPointMaps,
|
||||
labelListList& faceZonePointMap
|
||||
) const;
|
||||
|
||||
|
||||
@ -367,15 +394,15 @@ class polyTopoChange
|
||||
void reorderCoupledFaces
|
||||
(
|
||||
const bool syncParallel,
|
||||
const polyBoundaryMesh&,
|
||||
const labelList& patchStarts,
|
||||
const labelList& patchSizes,
|
||||
const polyBoundaryMesh& boundary,
|
||||
const labelUList& patchStarts,
|
||||
const labelUList& patchSizes,
|
||||
const pointField& points
|
||||
);
|
||||
|
||||
void compactAndReorder
|
||||
(
|
||||
const polyMesh&,
|
||||
const polyMesh& mesh,
|
||||
const bool syncParallel,
|
||||
const bool orderCells,
|
||||
const bool orderPoints,
|
||||
@ -445,12 +472,15 @@ public:
|
||||
}
|
||||
|
||||
//- Is point removed?
|
||||
// Considered removed if point is GREAT.
|
||||
inline bool pointRemoved(const label pointi) const;
|
||||
|
||||
//- Is face removed?
|
||||
// Considered removed if face is empty
|
||||
inline bool faceRemoved(const label facei) const;
|
||||
|
||||
//- Is cell removed?
|
||||
// Considered removed if the cellMap is -2
|
||||
inline bool cellRemoved(const label celli) const;
|
||||
|
||||
|
||||
@ -463,11 +493,11 @@ public:
|
||||
// or zone ids.
|
||||
void addMesh
|
||||
(
|
||||
const polyMesh&,
|
||||
const labelList& patchMap,
|
||||
const labelList& pointZoneMap,
|
||||
const labelList& faceZoneMap,
|
||||
const labelList& cellZoneMap
|
||||
const polyMesh& mesh,
|
||||
const labelUList& patchMap,
|
||||
const labelUList& pointZoneMap,
|
||||
const labelUList& faceZoneMap,
|
||||
const labelUList& cellZoneMap
|
||||
);
|
||||
|
||||
//- Explicitly pre-size the dynamic storage for expected mesh
|
||||
@ -491,7 +521,7 @@ public:
|
||||
// - inCell = false: add retired point (to end of point list)
|
||||
label addPoint
|
||||
(
|
||||
const point&,
|
||||
const point& pt,
|
||||
const label masterPointID,
|
||||
const label zoneID,
|
||||
const bool inCell
|
||||
@ -499,17 +529,18 @@ public:
|
||||
|
||||
//- Modify coordinate.
|
||||
// Notes:
|
||||
// - zoneID = +ve (add to zoneID), -ve (remove from zones)
|
||||
// - inCell = false: add retired point (to end of point list)
|
||||
void modifyPoint
|
||||
(
|
||||
const label,
|
||||
const point&,
|
||||
const label newZoneID,
|
||||
const label pointi,
|
||||
const point& pt,
|
||||
const label zoneID,
|
||||
const bool inCell
|
||||
);
|
||||
|
||||
//- Remove/merge point.
|
||||
void removePoint(const label, const label);
|
||||
void removePoint(const label pointi, const label mergePointi);
|
||||
|
||||
//- Add face to cells. Return new face label.
|
||||
// own,nei<0, zoneID>=0 : add inactive face (to end of face list)
|
||||
@ -541,7 +572,7 @@ public:
|
||||
);
|
||||
|
||||
//- Remove/merge face.
|
||||
void removeFace(const label, const label);
|
||||
void removeFace(const label facei, const label mergeFacei);
|
||||
|
||||
//- Add cell. Return new cell label.
|
||||
label addCell
|
||||
@ -554,10 +585,10 @@ public:
|
||||
);
|
||||
|
||||
//- Modify zone of cell
|
||||
void modifyCell(const label, const label zoneID);
|
||||
void modifyCell(const label celli, const label zoneID);
|
||||
|
||||
//- Remove/merge cell.
|
||||
void removeCell(const label, const label);
|
||||
void removeCell(const label celli, const label mergeCelli);
|
||||
|
||||
//- Explicitly set the number of patches if construct-without-mesh
|
||||
// used.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,20 +30,20 @@ License
|
||||
template<class T>
|
||||
void Foam::polyTopoChange::reorder
|
||||
(
|
||||
const labelList& oldToNew,
|
||||
const labelUList& oldToNew,
|
||||
DynamicList<T>& lst
|
||||
)
|
||||
{
|
||||
// Create copy
|
||||
DynamicList<T> oldLst(lst);
|
||||
|
||||
forAll(oldToNew, elemI)
|
||||
forAll(oldToNew, i)
|
||||
{
|
||||
label newElemI = oldToNew[elemI];
|
||||
const label newIdx = oldToNew[i];
|
||||
|
||||
if (newElemI != -1)
|
||||
if (newIdx >= 0)
|
||||
{
|
||||
lst[newElemI] = oldLst[elemI];
|
||||
lst[newIdx] = oldLst[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -52,20 +52,20 @@ void Foam::polyTopoChange::reorder
|
||||
template<class T>
|
||||
void Foam::polyTopoChange::reorder
|
||||
(
|
||||
const labelList& oldToNew,
|
||||
const labelUList& oldToNew,
|
||||
List<DynamicList<T>>& lst
|
||||
)
|
||||
{
|
||||
// Create copy
|
||||
List<DynamicList<T>> oldLst(lst);
|
||||
|
||||
forAll(oldToNew, elemI)
|
||||
forAll(oldToNew, i)
|
||||
{
|
||||
label newElemI = oldToNew[elemI];
|
||||
const label newIdx = oldToNew[i];
|
||||
|
||||
if (newElemI != -1)
|
||||
if (newIdx >= 0)
|
||||
{
|
||||
lst[newElemI].transfer(oldLst[elemI]);
|
||||
lst[newIdx].transfer(oldLst[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -74,23 +74,23 @@ void Foam::polyTopoChange::reorder
|
||||
template<class T>
|
||||
void Foam::polyTopoChange::renumberKey
|
||||
(
|
||||
const labelList& oldToNew,
|
||||
Map<T>& elems
|
||||
const labelUList& oldToNew,
|
||||
Map<T>& map
|
||||
)
|
||||
{
|
||||
Map<T> newElems(elems.size());
|
||||
Map<T> newMap(map.capacity());
|
||||
|
||||
forAllConstIter(typename Map<T>, elems, iter)
|
||||
forAllConstIters(map, iter)
|
||||
{
|
||||
label newElem = oldToNew[iter.key()];
|
||||
const label newKey = oldToNew[iter.key()];
|
||||
|
||||
if (newElem >= 0)
|
||||
if (newKey >= 0)
|
||||
{
|
||||
newElems.insert(newElem, iter());
|
||||
newMap.insert(newKey, iter.object());
|
||||
}
|
||||
}
|
||||
|
||||
elems.transfer(newElems);
|
||||
map.transfer(newMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,18 +40,16 @@ void Foam::slidingInterface::decoupleInterface
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void slidingInterface::decoupleInterface("
|
||||
<< "polyTopoChange& ref) const : "
|
||||
<< "Decoupling sliding interface " << name() << endl;
|
||||
Pout<< FUNCTION_NAME << nl
|
||||
<< ": Decoupling sliding interface " << name() << endl;
|
||||
}
|
||||
|
||||
if (!attached_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void slidingInterface::decoupleInterface("
|
||||
<< "polyTopoChange& ref) const : "
|
||||
<< "Interface already decoupled." << endl;
|
||||
Pout<< FUNCTION_NAME << nl
|
||||
<< ": Interface already decoupled." << endl;
|
||||
}
|
||||
|
||||
return;
|
||||
@ -61,22 +59,23 @@ void Foam::slidingInterface::decoupleInterface
|
||||
clearCouple(ref);
|
||||
|
||||
const polyMesh& mesh = topoChanger().mesh();
|
||||
const pointField& points = mesh.points();
|
||||
const faceList& faces = mesh.faces();
|
||||
const cellList& cells = mesh.cells();
|
||||
|
||||
const labelList& own = mesh.faceOwner();
|
||||
const labelList& nei = mesh.faceNeighbour();
|
||||
const faceZoneMesh& faceZones = mesh.faceZones();
|
||||
|
||||
// Master side
|
||||
|
||||
const primitiveFacePatch& masterPatch =
|
||||
mesh.faceZones()[masterFaceZoneID_.index()]();
|
||||
faceZones[masterFaceZoneID_.index()]();
|
||||
|
||||
const labelList& masterPatchAddr =
|
||||
mesh.faceZones()[masterFaceZoneID_.index()];
|
||||
faceZones[masterFaceZoneID_.index()];
|
||||
|
||||
const boolList& masterPatchFlip =
|
||||
mesh.faceZones()[masterFaceZoneID_.index()].flipMap();
|
||||
faceZones[masterFaceZoneID_.index()].flipMap();
|
||||
|
||||
const labelList& masterFc = masterFaceCells();
|
||||
|
||||
@ -119,13 +118,13 @@ void Foam::slidingInterface::decoupleInterface
|
||||
// Slave side
|
||||
|
||||
const primitiveFacePatch& slavePatch =
|
||||
mesh.faceZones()[slaveFaceZoneID_.index()]();
|
||||
faceZones[slaveFaceZoneID_.index()]();
|
||||
|
||||
const labelList& slavePatchAddr =
|
||||
mesh.faceZones()[slaveFaceZoneID_.index()];
|
||||
faceZones[slaveFaceZoneID_.index()];
|
||||
|
||||
const boolList& slavePatchFlip =
|
||||
mesh.faceZones()[slaveFaceZoneID_.index()].flipMap();
|
||||
faceZones[slaveFaceZoneID_.index()].flipMap();
|
||||
|
||||
const labelList& slaveFc = slaveFaceCells();
|
||||
|
||||
@ -147,16 +146,7 @@ void Foam::slidingInterface::decoupleInterface
|
||||
// Recover retired points on the slave side
|
||||
forAll(newFace, pointi)
|
||||
{
|
||||
Map<label>::const_iterator rpmIter = rpm.find(newFace[pointi]);
|
||||
if (rpmIter != rpm.end())
|
||||
{
|
||||
// Master of retired point; grab its original
|
||||
// Pout<< "Reinstating retired point: " << newFace[pointi]
|
||||
// << " with old: " << rpm.find(newFace[pointi])()
|
||||
// << endl;
|
||||
|
||||
newFace[pointi] = rpmIter();
|
||||
}
|
||||
newFace[pointi] = rpm.lookup(newFace[pointi], newFace[pointi]);
|
||||
}
|
||||
|
||||
ref.setAction
|
||||
@ -181,12 +171,10 @@ void Foam::slidingInterface::decoupleInterface
|
||||
// Grab the list of faces in the layer
|
||||
const labelList& masterStickOuts = masterStickOutFaces();
|
||||
|
||||
forAll(masterStickOuts, facei)
|
||||
for (const label curFaceID : masterStickOuts)
|
||||
{
|
||||
// Renumber the face and remove additional points
|
||||
|
||||
const label curFaceID = masterStickOuts[facei];
|
||||
|
||||
const face& oldFace = faces[curFaceID];
|
||||
|
||||
DynamicList<label> newFaceLabels(oldFace.size());
|
||||
@ -219,17 +207,18 @@ void Foam::slidingInterface::decoupleInterface
|
||||
}
|
||||
|
||||
// Get face zone and its flip
|
||||
label modifiedFaceZone = mesh.faceZones().whichZone(curFaceID);
|
||||
bool modifiedFaceZoneFlip = false;
|
||||
const label modifiedFaceZone = faceZones.whichZone(curFaceID);
|
||||
|
||||
if (modifiedFaceZone >= 0)
|
||||
{
|
||||
modifiedFaceZoneFlip =
|
||||
mesh.faceZones()[modifiedFaceZone].flipMap()
|
||||
[
|
||||
mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
|
||||
];
|
||||
}
|
||||
const bool modifiedFaceZoneFlip =
|
||||
(
|
||||
modifiedFaceZone >= 0
|
||||
?
|
||||
faceZones[modifiedFaceZone].flipMap()
|
||||
[
|
||||
faceZones[modifiedFaceZone].whichFace(curFaceID)
|
||||
]
|
||||
: false
|
||||
);
|
||||
|
||||
face newFace;
|
||||
newFace.transfer(newFaceLabels);
|
||||
@ -265,23 +254,22 @@ void Foam::slidingInterface::decoupleInterface
|
||||
primitiveMesh::facesPerCell_*(masterPatch.size() + slavePatch.size())
|
||||
);
|
||||
|
||||
forAll(slaveFc, facei)
|
||||
for (const label slaveFci : slaveFc)
|
||||
{
|
||||
const labelList& curFaces = cells[slaveFc[facei]];
|
||||
const labelList& curFaces = cells[slaveFci];
|
||||
|
||||
forAll(curFaces, facei)
|
||||
for (const label facei : curFaces)
|
||||
{
|
||||
// Check if the face belongs to the slave face zone; and
|
||||
// if it has been removed; if not add it
|
||||
if
|
||||
(
|
||||
mesh.faceZones().whichZone(curFaces[facei])
|
||||
faceZones.whichZone(facei)
|
||||
!= slaveFaceZoneID_.index()
|
||||
&& !ref.faceRemoved(curFaces[facei])
|
||||
|
||||
&& !ref.faceRemoved(facei)
|
||||
)
|
||||
{
|
||||
slaveLayerCellFaceMap.insert(curFaces[facei]);
|
||||
slaveLayerCellFaceMap.insert(facei);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -292,12 +280,10 @@ void Foam::slidingInterface::decoupleInterface
|
||||
// Grab master point mapping
|
||||
const Map<label>& masterPm = masterPatch.meshPointMap();
|
||||
|
||||
forAll(slaveStickOuts, facei)
|
||||
for (const label curFaceID : slaveStickOuts)
|
||||
{
|
||||
// Renumber the face and remove additional points
|
||||
|
||||
const label curFaceID = slaveStickOuts[facei];
|
||||
|
||||
const face& oldFace = faces[curFaceID];
|
||||
|
||||
DynamicList<label> newFaceLabels(oldFace.size());
|
||||
@ -307,16 +293,19 @@ void Foam::slidingInterface::decoupleInterface
|
||||
forAll(oldFace, pointi)
|
||||
{
|
||||
// Check if the point is removed or retired
|
||||
if (rpm.found(oldFace[pointi]))
|
||||
|
||||
const label retiredPointi = rpm.lookup(oldFace[pointi], -1);
|
||||
|
||||
if (retiredPointi != -1)
|
||||
{
|
||||
// Master of retired point; grab its original
|
||||
changed = true;
|
||||
|
||||
// Pout<< "Reinstating retired point: " << oldFace[pointi]
|
||||
// << " with old: " << rpm.find(oldFace[pointi])()
|
||||
// << " with old: " << retiredPointi
|
||||
// << endl;
|
||||
|
||||
newFaceLabels.append(rpm.find(oldFace[pointi])());
|
||||
newFaceLabels.append(retiredPointi);
|
||||
}
|
||||
else if (ref.pointRemoved(oldFace[pointi]))
|
||||
{
|
||||
@ -346,17 +335,19 @@ void Foam::slidingInterface::decoupleInterface
|
||||
}
|
||||
|
||||
// Get face zone and its flip
|
||||
label modifiedFaceZone = mesh.faceZones().whichZone(curFaceID);
|
||||
bool modifiedFaceZoneFlip = false;
|
||||
const label modifiedFaceZone =
|
||||
faceZones.whichZone(curFaceID);
|
||||
|
||||
if (modifiedFaceZone >= 0)
|
||||
{
|
||||
modifiedFaceZoneFlip =
|
||||
mesh.faceZones()[modifiedFaceZone].flipMap()
|
||||
[
|
||||
mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
|
||||
];
|
||||
}
|
||||
const bool modifiedFaceZoneFlip =
|
||||
(
|
||||
modifiedFaceZone >= 0
|
||||
?
|
||||
faceZones[modifiedFaceZone].flipMap()
|
||||
[
|
||||
faceZones[modifiedFaceZone].whichFace(curFaceID)
|
||||
]
|
||||
: false
|
||||
);
|
||||
|
||||
face newFace;
|
||||
newFace.transfer(newFaceLabels);
|
||||
@ -386,22 +377,20 @@ void Foam::slidingInterface::decoupleInterface
|
||||
}
|
||||
|
||||
// Bring all slave patch points back to life
|
||||
const pointField& points = mesh.points();
|
||||
|
||||
const labelList& slaveMeshPoints =
|
||||
mesh.faceZones()[slaveFaceZoneID_.index()]().meshPoints();
|
||||
faceZones[slaveFaceZoneID_.index()]().meshPoints();
|
||||
|
||||
forAll(slaveMeshPoints, pointi)
|
||||
for (const label slavePointi : slaveMeshPoints)
|
||||
{
|
||||
ref.setAction
|
||||
(
|
||||
polyModifyPoint
|
||||
(
|
||||
slaveMeshPoints[pointi], // point ID
|
||||
points[slaveMeshPoints[pointi]], // point
|
||||
false, // remove from zone
|
||||
mesh.pointZones().whichZone(slaveMeshPoints[pointi]), // zone
|
||||
true // in a cell
|
||||
slavePointi, // point ID
|
||||
points[slavePointi], // point
|
||||
false, // remove from zone
|
||||
mesh.pointZones().whichZone(slavePointi), // zone
|
||||
true // in a cell
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -414,9 +403,8 @@ void Foam::slidingInterface::decoupleInterface
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void slidingInterface::coupleInterface("
|
||||
<< "polyTopoChange& ref) const : "
|
||||
<< "Finished decoupling sliding interface " << name() << endl;
|
||||
Pout<< FUNCTION_NAME << nl
|
||||
<< ": Finished decoupling sliding interface " << name() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,7 +47,7 @@ void Foam::enrichedPatch::calcMeshPoints() const
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
meshPointsPtr_ = new labelList(pointMap().toc());
|
||||
meshPointsPtr_ = new labelList(std::move(pointMap().toc()));
|
||||
labelList& mp = *meshPointsPtr_;
|
||||
|
||||
sort(mp);
|
||||
@ -88,7 +88,7 @@ void Foam::enrichedPatch::calcLocalFaces() const
|
||||
|
||||
forAll(f, pointi)
|
||||
{
|
||||
curlf[pointi] = mpLookup.find(f[pointi])();
|
||||
curlf[pointi] = mpLookup.cfind(f[pointi])();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ void Foam::enrichedPatch::calcLocalPoints() const
|
||||
|
||||
forAll(lp, i)
|
||||
{
|
||||
lp[i] = pointMap().find(mp[i])();
|
||||
lp[i] = pointMap().cfind(mp[i])();
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,14 +131,13 @@ void Foam::enrichedPatch::clearOut()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::enrichedPatch::enrichedPatch
|
||||
(
|
||||
const primitiveFacePatch& masterPatch,
|
||||
const primitiveFacePatch& slavePatch,
|
||||
const labelList& slavePointPointHits,
|
||||
const labelList& slavePointEdgeHits,
|
||||
const List<objectHit>& slavePointFaceHits
|
||||
const labelUList& slavePointPointHits,
|
||||
const labelUList& slavePointEdgeHits,
|
||||
const UList<objectHit>& slavePointFaceHits
|
||||
)
|
||||
:
|
||||
masterPatch_(masterPatch),
|
||||
@ -252,36 +251,20 @@ void Foam::enrichedPatch::writeOBJ(const fileName& fName) const
|
||||
{
|
||||
OFstream str(fName);
|
||||
|
||||
const pointField& lp = localPoints();
|
||||
|
||||
forAll(lp, pointi)
|
||||
{
|
||||
meshTools::writeOBJ(str, lp[pointi]);
|
||||
}
|
||||
meshTools::writeOBJ(str, localPoints());
|
||||
|
||||
const faceList& faces = localFaces();
|
||||
|
||||
forAll(faces, facei)
|
||||
for (const face& f : faces)
|
||||
{
|
||||
const face& f = faces[facei];
|
||||
|
||||
str << 'f';
|
||||
forAll(f, fp)
|
||||
for (const label fp : f)
|
||||
{
|
||||
str << ' ' << f[fp]+1;
|
||||
str << ' ' << fp+1;
|
||||
}
|
||||
str << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -36,8 +36,7 @@ Description
|
||||
|
||||
Note:
|
||||
If new points are created during master-slave edge cutting, they
|
||||
should be registred with the pointMap.
|
||||
|
||||
should be registered with the pointMap.
|
||||
|
||||
SourceFiles
|
||||
enrichedPatch.C
|
||||
@ -134,10 +133,10 @@ class enrichedPatch
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
enrichedPatch(const enrichedPatch&);
|
||||
enrichedPatch(const enrichedPatch&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const enrichedPatch&);
|
||||
void operator=(const enrichedPatch&) = delete;
|
||||
|
||||
// Creation of demand-driven private data
|
||||
|
||||
@ -196,11 +195,11 @@ public:
|
||||
(
|
||||
const primitiveFacePatch& masterPatch,
|
||||
const primitiveFacePatch& slavePatch,
|
||||
const labelList& slavePointPointHits,
|
||||
const labelUList& slavePointPointHits,
|
||||
// -1 or common point snapped to
|
||||
const labelList& slavePointEdgeHits,
|
||||
const labelUList& slavePointEdgeHits,
|
||||
// -1 or common edge snapped to
|
||||
const List<objectHit>& slavePointFaceHits
|
||||
const UList<objectHit>& slavePointFaceHits
|
||||
// master face snapped to
|
||||
);
|
||||
|
||||
@ -213,23 +212,17 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return non-const access to point map to add points
|
||||
Map<point>& pointMap();
|
||||
|
||||
//- Return map of points
|
||||
const Map<point>& pointMap() const;
|
||||
inline const Map<point>& pointMap() const;
|
||||
|
||||
//- Return non-const access to point map to add points
|
||||
inline Map<point>& pointMap();
|
||||
|
||||
//- Return map of point merges
|
||||
Map<label>& pointMergeMap()
|
||||
{
|
||||
return pointMergeMap_;
|
||||
}
|
||||
inline const Map<label>& pointMergeMap() const;
|
||||
|
||||
//- Return map of point merges
|
||||
const Map<label>& pointMergeMap() const
|
||||
{
|
||||
return pointMergeMap_;
|
||||
}
|
||||
inline Map<label>& pointMergeMap();
|
||||
|
||||
|
||||
// Topological data
|
||||
@ -278,7 +271,7 @@ public:
|
||||
|
||||
|
||||
//- Debugging: dump graphical representation to obj format file
|
||||
void writeOBJ(const fileName&) const;
|
||||
void writeOBJ(const fileName& fName) const;
|
||||
};
|
||||
|
||||
|
||||
@ -288,6 +281,10 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "enrichedPatchI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,7 @@ Description
|
||||
#include "DynamicList.H"
|
||||
#include "labelPair.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "HashSet.H"
|
||||
#include "edgeHashes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -94,9 +94,8 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
// the points projected onto the face.
|
||||
|
||||
// Create a set of edge usage parameters
|
||||
HashSet<edge, Hash<edge>> edgesUsedOnce(pp.size());
|
||||
HashSet<edge, Hash<edge>> edgesUsedTwice
|
||||
(pp.size()*primitiveMesh::edgesPerPoint_);
|
||||
edgeHashSet edgesUsedOnce(pp.size());
|
||||
edgeHashSet edgesUsedTwice(pp.size()*primitiveMesh::edgesPerPoint_);
|
||||
|
||||
|
||||
forAll(lf, facei)
|
||||
@ -145,9 +144,9 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
|
||||
// Insert the edges of current face into the seed list.
|
||||
edgeList cfe = curLocalFace.edges();
|
||||
forAll(curLocalFace, edgeI)
|
||||
for (const edge& e : cfe)
|
||||
{
|
||||
edgeSeeds.append(cfe[edgeI]);
|
||||
edgeSeeds.append(e);
|
||||
}
|
||||
|
||||
// Grab face normal
|
||||
@ -156,9 +155,7 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
|
||||
while (edgeSeeds.size())
|
||||
{
|
||||
// Pout<< "edgeSeeds.size(): "
|
||||
// << edgeSeeds.size()
|
||||
// << endl;
|
||||
// Pout<< "edgeSeeds.size(): " << edgeSeeds.size() << endl;
|
||||
|
||||
const edge curEdge = edgeSeeds.removeHead();
|
||||
|
||||
@ -198,6 +195,7 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
cutFaceGlobalPoints.append(mp[prevPointLabel]);
|
||||
cutFaceLocalPoints.append(prevPointLabel);
|
||||
// Pout<< "prevPointLabel: " << mp[prevPointLabel] << endl;
|
||||
|
||||
// Grab current point and append it to the list
|
||||
label curPointLabel = curEdge.end();
|
||||
point curPoint = lp[curPointLabel];
|
||||
@ -266,7 +264,7 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
|
||||
newDir /= magNewDir;
|
||||
|
||||
scalar curAtanTurn =
|
||||
const scalar curAtanTurn =
|
||||
atan2(newDir & right, newDir & ahead);
|
||||
|
||||
// Pout<< " atan: " << curAtanTurn << endl;
|
||||
@ -352,19 +350,18 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
// If the edge corresponds to a starting face edge,
|
||||
// mark the starting face edge as true
|
||||
|
||||
forAll(cutFaceLocal, cutI)
|
||||
forAll(cutFaceLocal, cuti)
|
||||
{
|
||||
const edge curCutFaceEdge
|
||||
(
|
||||
cutFaceLocal[cutI],
|
||||
cutFaceLocal.nextLabel(cutI)
|
||||
cutFaceLocal[cuti],
|
||||
cutFaceLocal.nextLabel(cuti)
|
||||
);
|
||||
|
||||
// Increment the usage count using two hash sets
|
||||
HashSet<edge, Hash<edge>>::iterator euoIter =
|
||||
edgesUsedOnce.find(curCutFaceEdge);
|
||||
auto euoIter = edgesUsedOnce.find(curCutFaceEdge);
|
||||
|
||||
if (euoIter == edgesUsedOnce.end())
|
||||
if (!euoIter.found())
|
||||
{
|
||||
// Pout<< "Found edge not used before: "
|
||||
// << curCutFaceEdge
|
||||
@ -435,12 +432,12 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
|
||||
if (facei < slavePatch_.size())
|
||||
{
|
||||
Map<labelList>::const_iterator mpfAddrIter =
|
||||
masterPointFaceAddr.find(cutFaceGlobal[0]);
|
||||
const auto mpfAddrIter =
|
||||
masterPointFaceAddr.cfind(cutFaceGlobal[0]);
|
||||
|
||||
bool otherSideFound = false;
|
||||
|
||||
if (mpfAddrIter != masterPointFaceAddr.end())
|
||||
if (mpfAddrIter.found())
|
||||
{
|
||||
bool miss = false;
|
||||
|
||||
@ -456,18 +453,13 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
pointi++
|
||||
)
|
||||
{
|
||||
Map<labelList>::const_iterator
|
||||
mpfAddrPointIter =
|
||||
masterPointFaceAddr.find
|
||||
(
|
||||
cutFaceGlobal[pointi]
|
||||
);
|
||||
const auto mpfAddrPointIter =
|
||||
masterPointFaceAddr.cfind
|
||||
(
|
||||
cutFaceGlobal[pointi]
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
mpfAddrPointIter
|
||||
== masterPointFaceAddr.end()
|
||||
)
|
||||
if (!mpfAddrPointIter.found())
|
||||
{
|
||||
// Point is off the master patch. Skip
|
||||
miss = true;
|
||||
@ -479,15 +471,11 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
|
||||
// For every current face, try to find it in the
|
||||
// zero-list
|
||||
forAll(curMasterFaces, i)
|
||||
for (const label facei : curMasterFaces)
|
||||
{
|
||||
forAll(masterFacesOfPZero, j)
|
||||
{
|
||||
if
|
||||
(
|
||||
curMasterFaces[i]
|
||||
== masterFacesOfPZero[j]
|
||||
)
|
||||
if (facei == masterFacesOfPZero[j])
|
||||
{
|
||||
hits[j]++;
|
||||
break;
|
||||
@ -644,7 +632,7 @@ void Foam::enrichedPatch::calcCutFaces() const
|
||||
|
||||
} // end of local faces
|
||||
|
||||
// Re-pack the list into compact storage
|
||||
// Re-pack lists into compact storage
|
||||
cutFacesPtr_ = new faceList();
|
||||
cutFacesPtr_->transfer(cf);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,11 +26,11 @@ License
|
||||
#include "enrichedPatch.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::enrichedPatch::enrichedFaceRatio_ = 3;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::enrichedPatch::calcEnrichedFaces
|
||||
@ -79,68 +79,57 @@ void Foam::enrichedPatch::calcEnrichedFaces
|
||||
|
||||
forAll(slavePatch_, facei)
|
||||
{
|
||||
const face oldFace = slavePatch_[facei];
|
||||
const face oldLocalFace = slaveLocalFaces[facei];
|
||||
// Info<< "old slave face " << facei << ": " << oldFace << endl;
|
||||
const face& oldFace = slavePatch_[facei];
|
||||
const face& oldLocalFace = slaveLocalFaces[facei];
|
||||
const labelList& curEdges = slaveFaceEdges[facei];
|
||||
|
||||
// Info<< "old slave face[" << facei << "] " << oldFace << endl;
|
||||
|
||||
DynamicList<label> newFace(oldFace.size()*enrichedFaceRatio_);
|
||||
|
||||
// Note: The number of points and edges in a face is always identical
|
||||
// so both can be done is the same loop
|
||||
forAll(oldFace, i)
|
||||
{
|
||||
// Add the point
|
||||
Map<label>::const_iterator mpIter =
|
||||
pmm.find(oldFace[i]);
|
||||
// Add the point.
|
||||
// Using the mapped point id if possible
|
||||
|
||||
if (mpIter == pmm.end())
|
||||
{
|
||||
// Point not mapped
|
||||
newFace.append(oldFace[i]);
|
||||
const label mappedPointi = pmm.lookup(oldFace[i], oldFace[i]);
|
||||
|
||||
// Add the projected point into the patch support
|
||||
pointMap().insert
|
||||
(
|
||||
oldFace[i], // Global label of point
|
||||
projectedSlavePoints[oldLocalFace[i]] // Projected position
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Point mapped
|
||||
newFace.append(mpIter());
|
||||
newFace.append(mappedPointi);
|
||||
|
||||
// Add the projected point into the patch support
|
||||
pointMap().insert
|
||||
(
|
||||
mpIter(), // Merged global label of point
|
||||
projectedSlavePoints[oldLocalFace[i]] // Projected position
|
||||
);
|
||||
}
|
||||
// Add the projected point into the patch support
|
||||
pointMap().insert
|
||||
(
|
||||
mappedPointi, // Global label of point
|
||||
projectedSlavePoints[oldLocalFace[i]] // Projected position
|
||||
);
|
||||
|
||||
// Grab the edge points
|
||||
|
||||
const labelList& slavePointsOnEdge =
|
||||
const labelList& pointsOnEdge =
|
||||
pointsIntoSlaveEdges[curEdges[i]];
|
||||
|
||||
// Info<< "slavePointsOnEdge for "
|
||||
// << curEdges[i] << ": " << slavePointsOnEdge
|
||||
// Info<< "slave pointsOnEdge for "
|
||||
// << curEdges[i] << ": " << pointsOnEdge
|
||||
// << endl;
|
||||
|
||||
// If there are no points on the edge, skip everything
|
||||
// If there is only one point, no need for sorting
|
||||
if (slavePointsOnEdge.size())
|
||||
if (pointsOnEdge.size())
|
||||
{
|
||||
// Sort edge points in order
|
||||
scalarField edgePointWeights(slavePointsOnEdge.size());
|
||||
const point& startPoint = projectedSlavePoints[oldLocalFace[i]];
|
||||
scalarField weightOnEdge(pointsOnEdge.size());
|
||||
|
||||
vector e =
|
||||
projectedSlavePoints[oldLocalFace.nextLabel(i)]
|
||||
- startPoint;
|
||||
const point& startPoint =
|
||||
projectedSlavePoints[oldLocalFace[i]];
|
||||
|
||||
scalar magSqrE = magSqr(e);
|
||||
const point& endPoint =
|
||||
projectedSlavePoints[oldLocalFace.nextLabel(i)];
|
||||
|
||||
vector e = (endPoint - startPoint);
|
||||
|
||||
const scalar magSqrE = magSqr(e);
|
||||
|
||||
if (magSqrE > SMALL)
|
||||
{
|
||||
@ -154,27 +143,34 @@ void Foam::enrichedPatch::calcEnrichedFaces
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
pointField slavePosOnEdge(slavePointsOnEdge.size());
|
||||
pointField positionOnEdge(pointsOnEdge.size());
|
||||
|
||||
forAll(slavePointsOnEdge, edgePointi)
|
||||
forAll(pointsOnEdge, edgePointi)
|
||||
{
|
||||
slavePosOnEdge[edgePointi] =
|
||||
pointMap().find(slavePointsOnEdge[edgePointi])();
|
||||
positionOnEdge[edgePointi] =
|
||||
pointMap()[pointsOnEdge[edgePointi]];
|
||||
|
||||
edgePointWeights[edgePointi] =
|
||||
(e & (slavePosOnEdge[edgePointi] - startPoint));
|
||||
weightOnEdge[edgePointi] =
|
||||
(
|
||||
e
|
||||
&
|
||||
(
|
||||
positionOnEdge[edgePointi]
|
||||
- startPoint
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
// Check weights: all new points should be on the edge
|
||||
if (min(edgePointWeights) < 0 || max(edgePointWeights) > 1)
|
||||
if (min(weightOnEdge) < 0 || max(weightOnEdge) > 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " not on the edge for edge " << curEdges[i]
|
||||
<< " of face " << facei << " in slave patch." << nl
|
||||
<< "Min weight: " << min(edgePointWeights)
|
||||
<< " Max weight: " << max(edgePointWeights)
|
||||
<< "Min weight: " << min(weightOnEdge)
|
||||
<< " Max weight: " << max(weightOnEdge)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
@ -182,101 +178,98 @@ void Foam::enrichedPatch::calcEnrichedFaces
|
||||
// Go through the points and collect them based on
|
||||
// weights from lower to higher. This gives the
|
||||
// correct order of points along the edge.
|
||||
forAll(edgePointWeights, passI)
|
||||
forAll(weightOnEdge, passI)
|
||||
{
|
||||
// Max weight can only be one, so the sorting is
|
||||
// done by elimination.
|
||||
label nextPoint = -1;
|
||||
scalar dist = 2;
|
||||
|
||||
forAll(edgePointWeights, wI)
|
||||
forAll(weightOnEdge, wI)
|
||||
{
|
||||
if (edgePointWeights[wI] < dist)
|
||||
if (weightOnEdge[wI] < dist)
|
||||
{
|
||||
dist = edgePointWeights[wI];
|
||||
dist = weightOnEdge[wI];
|
||||
nextPoint = wI;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert the next point and reset its weight to exclude it
|
||||
// from future picks
|
||||
newFace.append(slavePointsOnEdge[nextPoint]);
|
||||
edgePointWeights[nextPoint] = GREAT;
|
||||
newFace.append(pointsOnEdge[nextPoint]);
|
||||
weightOnEdge[nextPoint] = GREAT;
|
||||
|
||||
// Add the point into patch support
|
||||
pointMap().insert
|
||||
(
|
||||
slavePointsOnEdge[nextPoint],
|
||||
slavePosOnEdge[nextPoint]
|
||||
pointsOnEdge[nextPoint],
|
||||
positionOnEdge[nextPoint]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Info<< "New slave face " << facei << ": " << newFace << endl;
|
||||
|
||||
// Info<< "New slave face[" << facei << "] "
|
||||
// << flatOutput(newFace) << " was " << flatOutput(oldFace)
|
||||
// << endl;
|
||||
|
||||
// Add the new face to the list
|
||||
enrichedFaces[nEnrichedFaces].transfer(newFace);
|
||||
nEnrichedFaces++;
|
||||
}
|
||||
|
||||
|
||||
// Add master faces into the enriched faces list
|
||||
|
||||
forAll(masterPatch_, facei)
|
||||
{
|
||||
const face& oldFace = masterPatch_[facei];
|
||||
const face& oldLocalFace = masterLocalFaces[facei];
|
||||
// Info<< "old master face: " << oldFace << endl;
|
||||
const labelList& curEdges = masterFaceEdges[facei];
|
||||
|
||||
// Info<< "old master face[" << facei << "] " << oldFace << endl;
|
||||
|
||||
DynamicList<label> newFace(oldFace.size()*enrichedFaceRatio_);
|
||||
|
||||
// Note: The number of points and edges in a face is always identical
|
||||
// so both can be done is the same loop
|
||||
forAll(oldFace, i)
|
||||
{
|
||||
// Add the point
|
||||
Map<label>::const_iterator mpIter =
|
||||
pmm.find(oldFace[i]);
|
||||
// Add the point.
|
||||
// Using the mapped point id if possible
|
||||
|
||||
if (mpIter == pmm.end())
|
||||
{
|
||||
// Point not mapped
|
||||
newFace.append(oldFace[i]);
|
||||
const label mappedPointi = pmm.lookup(oldFace[i], oldFace[i]);
|
||||
|
||||
// Add the point into patch support
|
||||
pointMap().insert
|
||||
(
|
||||
oldFace[i],
|
||||
masterLocalPoints[oldLocalFace[i]]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Point mapped
|
||||
newFace.append(mpIter());
|
||||
newFace.append(mappedPointi);
|
||||
|
||||
// Add the point into support
|
||||
pointMap().insert(mpIter(), masterLocalPoints[oldLocalFace[i]]);
|
||||
}
|
||||
// Add the point into patch support
|
||||
pointMap().insert
|
||||
(
|
||||
mappedPointi, // Global label of point
|
||||
masterLocalPoints[oldLocalFace[i]]
|
||||
);
|
||||
|
||||
// Grab the edge points
|
||||
|
||||
const labelList& masterPointsOnEdge =
|
||||
const labelList& pointsOnEdge =
|
||||
pointsIntoMasterEdges[curEdges[i]];
|
||||
|
||||
// If there are no points on the edge, skip everything
|
||||
// If there is only one point, no need for sorting
|
||||
if (masterPointsOnEdge.size())
|
||||
if (pointsOnEdge.size())
|
||||
{
|
||||
// Sort edge points in order
|
||||
scalarField edgePointWeights(masterPointsOnEdge.size());
|
||||
const point& startPoint = masterLocalPoints[oldLocalFace[i]];
|
||||
scalarField weightOnEdge(pointsOnEdge.size());
|
||||
|
||||
vector e =
|
||||
masterLocalPoints[oldLocalFace.nextLabel(i)]
|
||||
- startPoint;
|
||||
const point& startPoint =
|
||||
masterLocalPoints[oldLocalFace[i]];
|
||||
|
||||
scalar magSqrE = magSqr(e);
|
||||
const point& endPoint =
|
||||
masterLocalPoints[oldLocalFace.nextLabel(i)];
|
||||
|
||||
vector e = (endPoint - startPoint);
|
||||
|
||||
const scalar magSqrE = magSqr(e);
|
||||
|
||||
if (magSqrE > SMALL)
|
||||
{
|
||||
@ -290,27 +283,33 @@ void Foam::enrichedPatch::calcEnrichedFaces
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
pointField masterPosOnEdge(masterPointsOnEdge.size());
|
||||
pointField positionOnEdge(pointsOnEdge.size());
|
||||
|
||||
forAll(masterPointsOnEdge, edgePointi)
|
||||
forAll(pointsOnEdge, edgePointi)
|
||||
{
|
||||
masterPosOnEdge[edgePointi] =
|
||||
pointMap().find(masterPointsOnEdge[edgePointi])();
|
||||
positionOnEdge[edgePointi] =
|
||||
pointMap()[pointsOnEdge[edgePointi]];
|
||||
|
||||
edgePointWeights[edgePointi] =
|
||||
(e & (masterPosOnEdge[edgePointi] - startPoint));
|
||||
weightOnEdge[edgePointi] =
|
||||
(
|
||||
e
|
||||
&
|
||||
(
|
||||
positionOnEdge[edgePointi] - startPoint
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
// Check weights: all new points should be on the edge
|
||||
if (min(edgePointWeights) < 0 || max(edgePointWeights) > 1)
|
||||
if (min(weightOnEdge) < 0 || max(weightOnEdge) > 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " not on the edge for edge " << curEdges[i]
|
||||
<< " of face " << facei << " in master patch." << nl
|
||||
<< "Min weight: " << min(edgePointWeights)
|
||||
<< " Max weight: " << max(edgePointWeights)
|
||||
<< "Min weight: " << min(weightOnEdge)
|
||||
<< " Max weight: " << max(weightOnEdge)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
@ -318,37 +317,40 @@ void Foam::enrichedPatch::calcEnrichedFaces
|
||||
// Go through the points and collect them based on
|
||||
// weights from lower to higher. This gives the
|
||||
// correct order of points along the edge.
|
||||
forAll(edgePointWeights, passI)
|
||||
forAll(weightOnEdge, passI)
|
||||
{
|
||||
// Max weight can only be one, so the sorting is
|
||||
// done by elimination.
|
||||
label nextPoint = -1;
|
||||
scalar dist = 2;
|
||||
|
||||
forAll(edgePointWeights, wI)
|
||||
forAll(weightOnEdge, wI)
|
||||
{
|
||||
if (edgePointWeights[wI] < dist)
|
||||
if (weightOnEdge[wI] < dist)
|
||||
{
|
||||
dist = edgePointWeights[wI];
|
||||
dist = weightOnEdge[wI];
|
||||
nextPoint = wI;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert the next point and reset its weight to exclude it
|
||||
// from future picks
|
||||
newFace.append(masterPointsOnEdge[nextPoint]);
|
||||
edgePointWeights[nextPoint] = GREAT;
|
||||
newFace.append(pointsOnEdge[nextPoint]);
|
||||
weightOnEdge[nextPoint] = GREAT;
|
||||
|
||||
// Add the point into patch support
|
||||
pointMap().insert
|
||||
(
|
||||
masterPointsOnEdge[nextPoint],
|
||||
masterPosOnEdge[nextPoint]
|
||||
pointsOnEdge[nextPoint],
|
||||
positionOnEdge[nextPoint]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Info<< "New master face: " << newFace << endl;
|
||||
|
||||
// Info<< "New master face[" << facei << "] "
|
||||
// << flatOutput(newFace) << " was " << flatOutput(oldFace)
|
||||
// << endl;
|
||||
|
||||
// Add the new face to the list
|
||||
enrichedFaces[nEnrichedFaces].transfer(newFace);
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::Map<Foam::point>& Foam::enrichedPatch::pointMap() const
|
||||
{
|
||||
if (!pointMapComplete_)
|
||||
{
|
||||
completePointMap();
|
||||
}
|
||||
|
||||
return pointMap_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::Map<Foam::point>& Foam::enrichedPatch::pointMap()
|
||||
{
|
||||
if (!pointMapComplete_)
|
||||
{
|
||||
completePointMap();
|
||||
}
|
||||
|
||||
return pointMap_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::Map<Foam::label>& Foam::enrichedPatch::pointMergeMap() const
|
||||
{
|
||||
return pointMergeMap_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::Map<Foam::label>& Foam::enrichedPatch::pointMergeMap()
|
||||
{
|
||||
return pointMergeMap_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,6 +32,7 @@ License
|
||||
|
||||
const Foam::label Foam::enrichedPatch::nFaceHits_ = 4;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::enrichedPatch::calcMasterPointFaces() const
|
||||
@ -51,7 +52,7 @@ void Foam::enrichedPatch::calcMasterPointFaces() const
|
||||
// Master face points lists the points of the enriched master face plus
|
||||
// points projected into the master face
|
||||
|
||||
Map<DynamicList<label>> mpf(meshPoints().size());
|
||||
Map<DynamicList<label>> mpf(2*meshPoints().size());
|
||||
|
||||
const faceList& ef = enrichedFaces();
|
||||
|
||||
@ -59,28 +60,14 @@ void Foam::enrichedPatch::calcMasterPointFaces() const
|
||||
forAll(masterPatch_, facei)
|
||||
{
|
||||
const face& curFace = ef[facei + slavePatch_.size()];
|
||||
// Pout<< "Cur face in pfAddr: " << curFace << endl;
|
||||
forAll(curFace, pointi)
|
||||
|
||||
for (const label pointi : curFace)
|
||||
{
|
||||
Map<DynamicList<label>>::iterator mpfIter =
|
||||
mpf.find(curFace[pointi]);
|
||||
DynamicList<label>& dynLst = mpf(pointi); // Get or create
|
||||
|
||||
if (mpfIter == mpf.end())
|
||||
{
|
||||
// Not found, add new dynamic list
|
||||
mpf.insert
|
||||
(
|
||||
curFace[pointi],
|
||||
DynamicList<label>(primitiveMesh::facesPerPoint_)
|
||||
);
|
||||
dynLst.reserve(primitiveMesh::facesPerPoint_); // Min size for list
|
||||
|
||||
// Iterator is invalidated - have to find again
|
||||
mpf.find(curFace[pointi])().append(facei);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpfIter().append(facei);
|
||||
}
|
||||
dynLst.append(facei);
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,50 +83,27 @@ void Foam::enrichedPatch::calcMasterPointFaces() const
|
||||
&& slavePointFaceHits_[pointi].hit()
|
||||
)
|
||||
{
|
||||
// Get the index of projected point corresponding to this slave
|
||||
// point
|
||||
const label mergedSmp =
|
||||
pointMergeMap().find(slaveMeshPoints[pointi])();
|
||||
// Index of projected point corresponding to this slave point
|
||||
const label mergedPointi = pointMergeMap()[slaveMeshPoints[pointi]];
|
||||
|
||||
Map<DynamicList<label>>::iterator mpfIter =
|
||||
mpf.find(mergedSmp);
|
||||
DynamicList<label>& dynLst = mpf(mergedPointi); // Get or create
|
||||
|
||||
if (mpfIter == mpf.end())
|
||||
{
|
||||
// Not found, add new dynamic list
|
||||
mpf.insert
|
||||
(
|
||||
mergedSmp,
|
||||
DynamicList<label>(primitiveMesh::facesPerPoint_)
|
||||
);
|
||||
dynLst.reserve(primitiveMesh::facesPerPoint_); // Min size for list
|
||||
|
||||
// Iterator is invalidated - have to find again
|
||||
mpf.find(mergedSmp)().append
|
||||
(
|
||||
slavePointFaceHits_[pointi].hitObject()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpfIter().append(slavePointFaceHits_[pointi].hitObject());
|
||||
}
|
||||
dynLst.append(slavePointFaceHits_[pointi].hitObject());
|
||||
}
|
||||
}
|
||||
|
||||
// Re-pack dynamic lists into normal lists
|
||||
const labelList mpfToc = mpf.toc();
|
||||
|
||||
masterPointFacesPtr_ = new Map<labelList>(2*mpfToc.size());
|
||||
Map<labelList>& masterPointFaceAddr = *masterPointFacesPtr_;
|
||||
masterPointFacesPtr_ = new Map<labelList>(2*mpf.size());
|
||||
Map<labelList>& masterPointFaceMap = *masterPointFacesPtr_;
|
||||
|
||||
forAll(mpfToc, mpfTocI)
|
||||
forAllIters(mpf, mpfIter)
|
||||
{
|
||||
labelList l;
|
||||
l.transfer(mpf.find(mpfToc[mpfTocI])());
|
||||
|
||||
masterPointFaceAddr.insert(mpfToc[mpfTocI], l);
|
||||
masterPointFaceMap(mpfIter.key()).transfer(mpfIter.object());
|
||||
}
|
||||
// Pout<< "masterPointFaceAddr: " << masterPointFaceAddr << endl;
|
||||
// Pout<< "masterPointFaceMap: " << masterPointFaceMap << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,8 +40,8 @@ void Foam::enrichedPatch::completePointMap() const
|
||||
|
||||
const Map<label>& pmm = pointMergeMap();
|
||||
|
||||
// Get the mesh points for both patches. If the point has not been
|
||||
// merged away, add it to the map
|
||||
// Get the mesh points for both patches.
|
||||
// If the point has not been merged away, add it to the map
|
||||
|
||||
// Do master patch
|
||||
const labelList& masterMeshPoints = masterPatch_.meshPoints();
|
||||
@ -77,29 +77,4 @@ void Foam::enrichedPatch::completePointMap() const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Foam::Map<Foam::point>& Foam::enrichedPatch::pointMap()
|
||||
{
|
||||
if (!pointMapComplete_)
|
||||
{
|
||||
completePointMap();
|
||||
}
|
||||
|
||||
return pointMap_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::Map<Foam::point>& Foam::enrichedPatch::pointMap() const
|
||||
{
|
||||
if (!pointMapComplete_)
|
||||
{
|
||||
completePointMap();
|
||||
}
|
||||
|
||||
return pointMap_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,9 +27,6 @@ License
|
||||
#include "primitiveMesh.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::enrichedPatch::calcPointPoints() const
|
||||
@ -52,16 +49,14 @@ void Foam::enrichedPatch::calcPointPoints() const
|
||||
|
||||
bool found = false;
|
||||
|
||||
forAll(lf, facei)
|
||||
for (const face& curFace : lf)
|
||||
{
|
||||
const face& curFace = lf[facei];
|
||||
|
||||
forAll(curFace, pointi)
|
||||
{
|
||||
DynamicList<label>& curPp = pp[curFace[pointi]];
|
||||
|
||||
// Do next label
|
||||
label next = curFace.nextLabel(pointi);
|
||||
const label next = curFace.nextLabel(pointi);
|
||||
|
||||
found = false;
|
||||
|
||||
@ -80,7 +75,7 @@ void Foam::enrichedPatch::calcPointPoints() const
|
||||
}
|
||||
|
||||
// Do previous label
|
||||
label prev = curFace.prevLabel(pointi);
|
||||
const label prev = curFace.prevLabel(pointi);
|
||||
found = false;
|
||||
|
||||
forAll(curPp, i)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,7 +34,7 @@ void Foam::slidingInterface::calcAttachedAddressing() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void Foam::slidingInterface::calcAttachedAddressing() const "
|
||||
Pout<< FUNCTION_NAME
|
||||
<< " for object " << name() << " : "
|
||||
<< "Calculating zone face-cell addressing."
|
||||
<< endl;
|
||||
@ -140,64 +140,85 @@ void Foam::slidingInterface::calcAttachedAddressing() const
|
||||
// Calculate stick-out faces
|
||||
const labelListList& pointFaces = mesh.pointFaces();
|
||||
|
||||
// Master side
|
||||
labelHashSet masterStickOutFaceMap
|
||||
labelHashSet stickOutFaceMap
|
||||
(
|
||||
primitiveMesh::facesPerCell_*(masterPatch.size())
|
||||
primitiveMesh::facesPerCell_
|
||||
* max(masterPatch.size(), slavePatch.size())
|
||||
);
|
||||
|
||||
// Master side
|
||||
const labelList& masterMeshPoints = masterPatch.meshPoints();
|
||||
|
||||
forAll(masterMeshPoints, pointi)
|
||||
{
|
||||
const labelList& curFaces = pointFaces[masterMeshPoints[pointi]];
|
||||
stickOutFaceMap.clear();
|
||||
|
||||
forAll(curFaces, facei)
|
||||
for (const label pointi : masterMeshPoints)
|
||||
{
|
||||
for (const label facei : pointFaces[pointi])
|
||||
{
|
||||
// Check if the face belongs to the master face zone;
|
||||
// if not add it
|
||||
const label zoneIdx = faceZones.whichZone(facei);
|
||||
|
||||
// Add if face not already part of master or slave face zone
|
||||
// This handles partially attached faces.
|
||||
if
|
||||
(
|
||||
faceZones.whichZone(curFaces[facei])
|
||||
!= masterFaceZoneID_.index()
|
||||
zoneIdx != masterFaceZoneID_.index()
|
||||
&& zoneIdx != slaveFaceZoneID_.index()
|
||||
)
|
||||
{
|
||||
masterStickOutFaceMap.insert(curFaces[facei]);
|
||||
stickOutFaceMap.insert(facei);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
masterStickOutFacesPtr_ = new labelList(masterStickOutFaceMap.toc());
|
||||
// Sort in debug mode for easier diagnostics
|
||||
if (debug)
|
||||
{
|
||||
masterStickOutFacesPtr_ =
|
||||
new labelList(std::move(stickOutFaceMap.sortedToc()));
|
||||
}
|
||||
else
|
||||
{
|
||||
masterStickOutFacesPtr_ =
|
||||
new labelList(std::move(stickOutFaceMap.toc()));
|
||||
}
|
||||
|
||||
// Slave side
|
||||
labelHashSet slaveStickOutFaceMap
|
||||
(
|
||||
primitiveMesh::facesPerCell_*(slavePatch.size())
|
||||
);
|
||||
|
||||
const labelList& slaveMeshPoints = slavePatch.meshPoints();
|
||||
|
||||
forAll(slaveMeshPoints, pointi)
|
||||
{
|
||||
const labelList& curFaces = pointFaces[slaveMeshPoints[pointi]];
|
||||
stickOutFaceMap.clear();
|
||||
|
||||
forAll(curFaces, facei)
|
||||
for (const label pointi : slaveMeshPoints)
|
||||
{
|
||||
for (const label facei : pointFaces[pointi])
|
||||
{
|
||||
// Check if the face belongs to the slave face zone;
|
||||
// if not add it
|
||||
const label zoneIdx = faceZones.whichZone(facei);
|
||||
|
||||
// Add if face not already part of master or slave face zone
|
||||
// This handles partially attached faces.
|
||||
if
|
||||
(
|
||||
faceZones.whichZone(curFaces[facei])
|
||||
!= slaveFaceZoneID_.index()
|
||||
zoneIdx != masterFaceZoneID_.index()
|
||||
&& zoneIdx != slaveFaceZoneID_.index()
|
||||
)
|
||||
{
|
||||
slaveStickOutFaceMap.insert(curFaces[facei]);
|
||||
stickOutFaceMap.insert(facei);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
slaveStickOutFacesPtr_ = new labelList(slaveStickOutFaceMap.toc());
|
||||
// Sort in debug mode for easier diagnostics
|
||||
if (debug)
|
||||
{
|
||||
slaveStickOutFacesPtr_ =
|
||||
new labelList(std::move(stickOutFaceMap.sortedToc()));
|
||||
}
|
||||
else
|
||||
{
|
||||
slaveStickOutFacesPtr_ =
|
||||
new labelList(std::move(stickOutFaceMap.toc()));
|
||||
}
|
||||
|
||||
stickOutFaceMap.clear();
|
||||
|
||||
// Retired point addressing does not exist at this stage.
|
||||
// It will be filled when the interface is coupled.
|
||||
@ -208,7 +229,6 @@ void Foam::slidingInterface::calcAttachedAddressing() const
|
||||
);
|
||||
|
||||
// Ditto for cut point edge map. This is a rough guess of its size
|
||||
//
|
||||
cutPointEdgePairMapPtr_ =
|
||||
new Map<Pair<edge>>
|
||||
(
|
||||
@ -224,7 +244,7 @@ void Foam::slidingInterface::calcAttachedAddressing() const
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void Foam::slidingInterface::calcAttachedAddressing() const "
|
||||
Pout<< FUNCTION_NAME
|
||||
<< " for object " << name() << " : "
|
||||
<< "Finished calculating zone face-cell addressing."
|
||||
<< endl;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,8 +58,8 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "bool slidingInterface::projectPoints() : "
|
||||
<< " for object " << name() << " : "
|
||||
Pout<< FUNCTION_NAME << nl
|
||||
<< ": for object " << name() << " : "
|
||||
<< "Projecting slave points onto master surface." << endl;
|
||||
}
|
||||
|
||||
@ -126,12 +126,11 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
scalarField minMasterPointLength(masterLocalPoints.size(), GREAT);
|
||||
scalarField minMasterFaceLength(masterPatch.size(), GREAT);
|
||||
|
||||
forAll(masterEdges, edgeI)
|
||||
forAll(masterEdges, edgei)
|
||||
{
|
||||
const edge& curEdge = masterEdges[edgeI];
|
||||
const edge& curEdge = masterEdges[edgei];
|
||||
|
||||
const scalar curLength =
|
||||
masterEdges[edgeI].mag(masterLocalPoints);
|
||||
const scalar curLength = curEdge.mag(masterLocalPoints);
|
||||
|
||||
// Do points
|
||||
minMasterPointLength[curEdge.start()] =
|
||||
@ -149,14 +148,14 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
);
|
||||
|
||||
// Do faces
|
||||
const labelList& curFaces = masterEdgeFaces[edgeI];
|
||||
const labelList& curFaces = masterEdgeFaces[edgei];
|
||||
|
||||
forAll(curFaces, facei)
|
||||
for (const label facei : curFaces)
|
||||
{
|
||||
minMasterFaceLength[curFaces[facei]] =
|
||||
minMasterFaceLength[facei] =
|
||||
min
|
||||
(
|
||||
minMasterFaceLength[curFaces[facei]],
|
||||
minMasterFaceLength[facei],
|
||||
curLength
|
||||
);
|
||||
}
|
||||
@ -169,12 +168,11 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
scalarField minSlavePointLength(slaveLocalPoints.size(), GREAT);
|
||||
scalarField minSlaveFaceLength(slavePatch.size(), GREAT);
|
||||
|
||||
forAll(slaveEdges, edgeI)
|
||||
forAll(slaveEdges, edgei)
|
||||
{
|
||||
const edge& curEdge = slaveEdges[edgeI];
|
||||
const edge& curEdge = slaveEdges[edgei];
|
||||
|
||||
const scalar curLength =
|
||||
slaveEdges[edgeI].mag(slaveLocalPoints);
|
||||
const scalar curLength = curEdge.mag(slaveLocalPoints);
|
||||
|
||||
// Do points
|
||||
minSlavePointLength[curEdge.start()] =
|
||||
@ -192,14 +190,14 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
);
|
||||
|
||||
// Do faces
|
||||
const labelList& curFaces = slaveEdgeFaces[edgeI];
|
||||
const labelList& curFaces = slaveEdgeFaces[edgei];
|
||||
|
||||
forAll(curFaces, facei)
|
||||
for (const label facei : curFaces)
|
||||
{
|
||||
minSlaveFaceLength[curFaces[facei]] =
|
||||
minSlaveFaceLength[facei] =
|
||||
min
|
||||
(
|
||||
minSlaveFaceLength[curFaces[facei]],
|
||||
minSlaveFaceLength[facei],
|
||||
curLength
|
||||
);
|
||||
}
|
||||
@ -219,25 +217,15 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
projectionAlgo_
|
||||
);
|
||||
|
||||
// Pout<< "USING N-SQUARED!!!" << endl;
|
||||
// List<objectHit> slavePointFaceHits =
|
||||
// projectPointsNSquared<face, List, const pointField&>
|
||||
// (
|
||||
// slavePatch,
|
||||
// masterPatch,
|
||||
// slavePointNormals,
|
||||
// projectionAlgo_
|
||||
// );
|
||||
|
||||
if (debug)
|
||||
{
|
||||
label nHits = 0;
|
||||
|
||||
forAll(slavePointFaceHits, pointi)
|
||||
for (const auto& hit : slavePointFaceHits)
|
||||
{
|
||||
if (slavePointFaceHits[pointi].hit())
|
||||
if (hit.hit())
|
||||
{
|
||||
nHits++;
|
||||
++nHits;
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,8 +235,7 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
}
|
||||
|
||||
// Projected slave points are stored for mesh motion correction
|
||||
if (projectedSlavePointsPtr_) delete projectedSlavePointsPtr_;
|
||||
|
||||
deleteDemandDrivenData(projectedSlavePointsPtr_);
|
||||
projectedSlavePointsPtr_ =
|
||||
new pointField(slavePointFaceHits.size(), Zero);
|
||||
pointField& projectedSlavePoints = *projectedSlavePointsPtr_;
|
||||
@ -380,29 +367,27 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
// Check for zero-length edges in slave projection
|
||||
scalar minEdgeLength = GREAT;
|
||||
scalar el = 0;
|
||||
label nShortEdges = 0;
|
||||
|
||||
forAll(slaveEdges, edgeI)
|
||||
for (const edge& e : slaveEdges)
|
||||
{
|
||||
el = slaveEdges[edgeI].mag(projectedSlavePoints);
|
||||
const scalar len = e.mag(projectedSlavePoints);
|
||||
minEdgeLength = min(minEdgeLength, len);
|
||||
|
||||
if (el < SMALL)
|
||||
if (len < SMALL)
|
||||
{
|
||||
Pout<< "Point projection problems for edge: "
|
||||
<< slaveEdges[edgeI] << ". Length = " << el
|
||||
<< e << ". Length = " << len
|
||||
<< endl;
|
||||
|
||||
nShortEdges++;
|
||||
}
|
||||
|
||||
minEdgeLength = min(minEdgeLength, el);
|
||||
}
|
||||
|
||||
if (nShortEdges > 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " short projected edges "
|
||||
<< nShortEdges << " short projected edges "
|
||||
<< "after adjustment for object " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
@ -439,10 +424,10 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
{
|
||||
if (slavePointFaceHits[pointi].hit())
|
||||
{
|
||||
// Taking a non-const reference so the point can be adjusted
|
||||
// Use non-const reference so the point can be adjusted
|
||||
point& curPoint = projectedSlavePoints[pointi];
|
||||
|
||||
// Get the hit face
|
||||
// Get the hit face (on master)
|
||||
const face& hitFace =
|
||||
masterLocalFaces[slavePointFaceHits[pointi].hitObject()];
|
||||
|
||||
@ -450,10 +435,10 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
scalar mergeDist = GREAT;
|
||||
|
||||
// Try all point before deciding on best fit.
|
||||
forAll(hitFace, hitPointi)
|
||||
for (const label hitPointi : hitFace)
|
||||
{
|
||||
scalar dist =
|
||||
mag(masterLocalPoints[hitFace[hitPointi]] - curPoint);
|
||||
const scalar dist =
|
||||
mag(masterLocalPoints[hitPointi] - curPoint);
|
||||
|
||||
// Calculate the tolerance
|
||||
const scalar mergeTol =
|
||||
@ -461,12 +446,12 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
min
|
||||
(
|
||||
minSlavePointLength[pointi],
|
||||
minMasterPointLength[hitFace[hitPointi]]
|
||||
minMasterPointLength[hitPointi]
|
||||
);
|
||||
|
||||
if (dist < mergeTol && dist < mergeDist)
|
||||
{
|
||||
mergePoint = hitFace[hitPointi];
|
||||
mergePoint = hitPointi;
|
||||
mergeDist = dist;
|
||||
|
||||
// Pout<< "Merging slave point "
|
||||
@ -481,12 +466,17 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
if (mergePoint > -1)
|
||||
{
|
||||
// Point is to be merged with master point
|
||||
// Slave point is to be merged with master point.
|
||||
// This may also include a false positive when the two points
|
||||
// already point to the same global point, but this will need
|
||||
// to be addressed by the caller.
|
||||
nMergedPoints++;
|
||||
|
||||
slavePointPointHits[pointi] = mergePoint;
|
||||
curPoint = masterLocalPoints[mergePoint];
|
||||
masterPointPointHits[mergePoint] = pointi;
|
||||
|
||||
// Adjust (snap) slave point
|
||||
curPoint = masterLocalPoints[mergePoint];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -498,20 +488,18 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
{
|
||||
// Check for zero-length edges in slave projection
|
||||
scalar minEdgeLength = GREAT;
|
||||
scalar el = 0;
|
||||
|
||||
forAll(slaveEdges, edgeI)
|
||||
for (const edge& e : slaveEdges)
|
||||
{
|
||||
el = slaveEdges[edgeI].mag(projectedSlavePoints);
|
||||
const scalar len = e.mag(projectedSlavePoints);
|
||||
minEdgeLength = min(minEdgeLength, len);
|
||||
|
||||
if (el < SMALL)
|
||||
if (len < SMALL)
|
||||
{
|
||||
Pout<< "Point projection problems for edge: "
|
||||
<< slaveEdges[edgeI] << ". Length = " << el
|
||||
<< e << ". Length = " << len
|
||||
<< endl;
|
||||
}
|
||||
|
||||
minEdgeLength = min(minEdgeLength, el);
|
||||
}
|
||||
|
||||
if (minEdgeLength < SMALL)
|
||||
@ -556,16 +544,16 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
scalar minDistance = GREAT;
|
||||
|
||||
forAll(hitFaceEdges, edgeI)
|
||||
for (const label edgei : hitFaceEdges)
|
||||
{
|
||||
const edge& curEdge = masterEdges[hitFaceEdges[edgeI]];
|
||||
const edge& curEdge = masterEdges[edgei];
|
||||
|
||||
pointHit edgeHit =
|
||||
curEdge.line(masterLocalPoints).nearestDist(curPoint);
|
||||
|
||||
if (edgeHit.hit())
|
||||
{
|
||||
scalar dist =
|
||||
const scalar dist =
|
||||
mag(edgeHit.hitPoint() - projectedSlavePoints[pointi]);
|
||||
|
||||
if (dist < mergeTol && dist < minDistance)
|
||||
@ -573,7 +561,7 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
// Point is to be moved onto master edge
|
||||
nMovedPoints++;
|
||||
|
||||
slavePointEdgeHits[pointi] = hitFaceEdges[edgeI];
|
||||
slavePointEdgeHits[pointi] = edgei;
|
||||
projectedSlavePoints[pointi] = edgeHit.hitPoint();
|
||||
|
||||
minDistance = dist;
|
||||
@ -582,7 +570,7 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
// << slavePatch.meshPoints()[pointi]
|
||||
// << " (" << pointi
|
||||
// << ") at " << slaveLocalPoints[pointi]
|
||||
// << " onto master edge " << hitFaceEdges[edgeI]
|
||||
// << " onto master edge " << edgei
|
||||
// << " or ("
|
||||
// << masterLocalPoints[curEdge.start()]
|
||||
// << masterLocalPoints[curEdge.end()]
|
||||
@ -607,7 +595,7 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
forAll(hitMasterEdge, hmeI)
|
||||
{
|
||||
scalar hmeDist =
|
||||
const scalar hmeDist =
|
||||
mag(masterLocalPoints[hitMasterEdge[hmeI]] - curPoint);
|
||||
|
||||
// Calculate the tolerance
|
||||
@ -660,27 +648,25 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
// Check for zero-length edges in slave projection
|
||||
scalar minEdgeLength = GREAT;
|
||||
scalar el = 0;
|
||||
|
||||
forAll(slaveEdges, edgeI)
|
||||
for (const edge& e : slaveEdges)
|
||||
{
|
||||
el = slaveEdges[edgeI].mag(projectedSlavePoints);
|
||||
const scalar len = e.mag(projectedSlavePoints);
|
||||
minEdgeLength = min(minEdgeLength, len);
|
||||
|
||||
if (el < SMALL)
|
||||
if (len < SMALL)
|
||||
{
|
||||
Pout<< "Point projection problems for edge: "
|
||||
<< slaveEdges[edgeI] << ". Length = " << el
|
||||
<< e << ". Length = " << len
|
||||
<< endl;
|
||||
}
|
||||
|
||||
minEdgeLength = min(minEdgeLength, el);
|
||||
}
|
||||
|
||||
if (minEdgeLength < SMALL)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " after correction for object " << name()
|
||||
<< abort(FatalError);
|
||||
<< " after correction for object " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -747,25 +733,19 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
labelHashSet addedFaces(2*primitiveMesh::edgesPerFace_);
|
||||
|
||||
forAll(slaveEdges, edgeI)
|
||||
forAll(slaveEdges, edgei)
|
||||
{
|
||||
const edge& curEdge = slaveEdges[edgeI];
|
||||
const edge& curEdge = slaveEdges[edgei];
|
||||
|
||||
{
|
||||
// Clear the maps
|
||||
curFaceMap.clear();
|
||||
addedFaces.clear();
|
||||
|
||||
// Grab the faces for start and end points
|
||||
const label startFace =
|
||||
slavePointFaceHits[curEdge.start()].hitObject();
|
||||
const label endFace = slavePointFaceHits[curEdge.end()].hitObject();
|
||||
|
||||
// Insert the start face into the list
|
||||
curFaceMap.insert(startFace);
|
||||
addedFaces.insert(startFace);
|
||||
const label endFace =
|
||||
slavePointFaceHits[curEdge.end()].hitObject();
|
||||
|
||||
// Pout<< "Doing edge " << edgeI
|
||||
// Pout<< "Doing edge " << edgei
|
||||
// << " or " << curEdge
|
||||
// << " start: "
|
||||
// << slavePointFaceHits[curEdge.start()].hitObject()
|
||||
@ -774,46 +754,59 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
// << endl;
|
||||
|
||||
// If the end face is on the list, the face collection is finished
|
||||
label nSweeps = 0;
|
||||
bool completed = false;
|
||||
|
||||
while (nSweeps < edgeFaceEscapeLimit_)
|
||||
if (!completed)
|
||||
{
|
||||
nSweeps++;
|
||||
// Forward sweep
|
||||
|
||||
if (addedFaces.found(endFace))
|
||||
{
|
||||
completed = true;
|
||||
}
|
||||
|
||||
// Add all face neighbours of face in the map
|
||||
const labelList cf = addedFaces.toc();
|
||||
// Clear the maps
|
||||
curFaceMap.clear();
|
||||
addedFaces.clear();
|
||||
|
||||
forAll(cf, cfI)
|
||||
{
|
||||
const labelList& curNbrs = masterFaceFaces[cf[cfI]];
|
||||
// Insert the start face into the list
|
||||
curFaceMap.insert(startFace);
|
||||
addedFaces.insert(startFace);
|
||||
|
||||
forAll(curNbrs, nbrI)
|
||||
for
|
||||
(
|
||||
label nSweeps = 0;
|
||||
nSweeps < edgeFaceEscapeLimit_;
|
||||
++nSweeps
|
||||
)
|
||||
{
|
||||
completed = addedFaces.found(endFace);
|
||||
|
||||
// Add all face neighbours of face in the map
|
||||
const labelList cf(std::move(addedFaces.toc()));
|
||||
addedFaces.clear();
|
||||
|
||||
for (const label cfi : cf)
|
||||
{
|
||||
if (!curFaceMap.found(curNbrs[nbrI]))
|
||||
const labelList& curNbrs = masterFaceFaces[cfi];
|
||||
|
||||
for (const label nbri : curNbrs)
|
||||
{
|
||||
curFaceMap.insert(curNbrs[nbrI]);
|
||||
addedFaces.insert(curNbrs[nbrI]);
|
||||
if (curFaceMap.insert(nbri))
|
||||
{
|
||||
addedFaces.insert(nbri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (completed) break;
|
||||
if (completed) break;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< ".";
|
||||
if (debug)
|
||||
{
|
||||
Pout<< ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!completed)
|
||||
{
|
||||
// Reverse sweep
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "x";
|
||||
@ -822,35 +815,32 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
// It is impossible to reach the end from the start, probably
|
||||
// due to disconnected domain. Do search in opposite direction
|
||||
|
||||
label nReverseSweeps = 0;
|
||||
|
||||
addedFaces.clear();
|
||||
curFaceMap.insert(endFace);
|
||||
addedFaces.insert(endFace);
|
||||
|
||||
while (nReverseSweeps < edgeFaceEscapeLimit_)
|
||||
for
|
||||
(
|
||||
label nSweeps = 0;
|
||||
nSweeps < edgeFaceEscapeLimit_;
|
||||
++nSweeps
|
||||
)
|
||||
{
|
||||
nReverseSweeps++;
|
||||
|
||||
if (addedFaces.found(startFace))
|
||||
{
|
||||
completed = true;
|
||||
}
|
||||
completed = addedFaces.found(startFace);
|
||||
|
||||
// Add all face neighbours of face in the map
|
||||
const labelList cf = addedFaces.toc();
|
||||
const labelList cf(std::move(addedFaces.toc()));
|
||||
addedFaces.clear();
|
||||
|
||||
forAll(cf, cfI)
|
||||
for (const label cfi : cf)
|
||||
{
|
||||
const labelList& curNbrs = masterFaceFaces[cf[cfI]];
|
||||
const labelList& curNbrs = masterFaceFaces[cfi];
|
||||
|
||||
forAll(curNbrs, nbrI)
|
||||
for (const label nbri : curNbrs)
|
||||
{
|
||||
if (!curFaceMap.found(curNbrs[nbrI]))
|
||||
if (curFaceMap.insert(nbri))
|
||||
{
|
||||
curFaceMap.insert(curNbrs[nbrI]);
|
||||
addedFaces.insert(curNbrs[nbrI]);
|
||||
addedFaces.insert(nbri);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -887,16 +877,11 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
nFacesPerSlaveEdge_*primitiveMesh::pointsPerFace_
|
||||
);
|
||||
|
||||
const labelList curFaces = curFaceMap.toc();
|
||||
// Pout<< "curFaces: " << curFaces << endl;
|
||||
forAll(curFaces, facei)
|
||||
for (const label facei : curFaceMap)
|
||||
{
|
||||
const face& f = masterLocalFaces[curFaces[facei]];
|
||||
const face& f = masterLocalFaces[facei];
|
||||
|
||||
forAll(f, pointi)
|
||||
{
|
||||
curPointMap.insert(f[pointi]);
|
||||
}
|
||||
curPointMap.insert(f); // Insert all face points
|
||||
}
|
||||
|
||||
const labelList curMasterPoints = curPointMap.toc();
|
||||
@ -912,7 +897,7 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
// is used to reject master points out of reach.
|
||||
// Calculated as a combination of travel distance in projection and
|
||||
// edge length
|
||||
scalar slaveCatchDist =
|
||||
const scalar slaveCatchDist =
|
||||
edgeMasterCatchFraction_*edgeMag
|
||||
+ 0.5*
|
||||
(
|
||||
@ -945,10 +930,8 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
edgeNormalInPlane /= mag(edgeNormalInPlane);
|
||||
|
||||
forAll(curMasterPoints, pointi)
|
||||
for (const label cmp : curMasterPoints)
|
||||
{
|
||||
const label cmp = curMasterPoints[pointi];
|
||||
|
||||
// Skip the current point if the edge start or end has
|
||||
// been adjusted onto in
|
||||
if
|
||||
@ -974,11 +957,11 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
// Strict checking of slave cut to avoid capturing
|
||||
// end points.
|
||||
scalar cutOnSlave =
|
||||
const scalar cutOnSlave =
|
||||
((edgeLineHit.hitPoint() - edgeLine.start()) & edgeVec)
|
||||
/sqr(edgeMag);
|
||||
|
||||
scalar distInEdgePlane =
|
||||
const scalar distInEdgePlane =
|
||||
min
|
||||
(
|
||||
edgeLineHit.distance(),
|
||||
@ -1032,14 +1015,14 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
}
|
||||
|
||||
// Snap to point onto edge
|
||||
masterPointEdgeHits[cmp] = edgeI;
|
||||
masterPointEdgeHits[cmp] = edgei;
|
||||
masterPointEdgeDist[cmp] = edgeLineHit.distance();
|
||||
|
||||
// Pout<< "Inserting master point "
|
||||
// << masterPatch.meshPoints()[cmp]
|
||||
// << " (" << cmp
|
||||
// << ") at " << masterLocalPoints[cmp]
|
||||
// << " into slave edge " << edgeI
|
||||
// << " into slave edge " << edgei
|
||||
// << " " << curEdge
|
||||
// << " cutOnSlave: " << cutOnSlave
|
||||
// << " distInEdgePlane: " << distInEdgePlane
|
||||
@ -1096,16 +1079,20 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
|
||||
// Store the addressing arrays and projected points
|
||||
deleteDemandDrivenData(slavePointPointHitsPtr_);
|
||||
slavePointPointHitsPtr_ = new labelList(slavePointPointHits);
|
||||
slavePointPointHitsPtr_ = new labelList();
|
||||
slavePointPointHitsPtr_->transfer(slavePointPointHits);
|
||||
|
||||
deleteDemandDrivenData(slavePointEdgeHitsPtr_);
|
||||
slavePointEdgeHitsPtr_ = new labelList(slavePointEdgeHits);
|
||||
slavePointEdgeHitsPtr_ = new labelList();
|
||||
slavePointEdgeHitsPtr_->transfer(slavePointEdgeHits);
|
||||
|
||||
deleteDemandDrivenData(slavePointFaceHitsPtr_);
|
||||
slavePointFaceHitsPtr_ = new List<objectHit>(slavePointFaceHits);
|
||||
slavePointFaceHitsPtr_ = new List<objectHit>();
|
||||
slavePointFaceHitsPtr_->transfer(slavePointFaceHits);
|
||||
|
||||
deleteDemandDrivenData(masterPointEdgeHitsPtr_);
|
||||
masterPointEdgeHitsPtr_ = new labelList(masterPointEdgeHits);
|
||||
masterPointEdgeHitsPtr_ = new labelList();
|
||||
masterPointEdgeHitsPtr_->transfer(masterPointEdgeHits);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -1128,16 +1115,20 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
{
|
||||
// Must be restart. Force topological change.
|
||||
deleteDemandDrivenData(slavePointPointHitsPtr_);
|
||||
slavePointPointHitsPtr_ = new labelList(slavePointPointHits);
|
||||
slavePointPointHitsPtr_ = new labelList();
|
||||
slavePointPointHitsPtr_->transfer(slavePointPointHits);
|
||||
|
||||
deleteDemandDrivenData(slavePointEdgeHitsPtr_);
|
||||
slavePointEdgeHitsPtr_ = new labelList(slavePointEdgeHits);
|
||||
slavePointEdgeHitsPtr_ = new labelList();
|
||||
slavePointEdgeHitsPtr_->transfer(slavePointEdgeHits);
|
||||
|
||||
deleteDemandDrivenData(slavePointFaceHitsPtr_);
|
||||
slavePointFaceHitsPtr_ = new List<objectHit>(slavePointFaceHits);
|
||||
slavePointFaceHitsPtr_ = new List<objectHit>();
|
||||
slavePointFaceHitsPtr_->transfer(slavePointFaceHits);
|
||||
|
||||
deleteDemandDrivenData(masterPointEdgeHitsPtr_);
|
||||
masterPointEdgeHitsPtr_ = new labelList(masterPointEdgeHits);
|
||||
masterPointEdgeHitsPtr_ = new labelList();
|
||||
masterPointEdgeHitsPtr_->transfer(masterPointEdgeHits);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -1218,16 +1209,20 @@ bool Foam::slidingInterface::projectPoints() const
|
||||
{
|
||||
// Grab new data
|
||||
deleteDemandDrivenData(slavePointPointHitsPtr_);
|
||||
slavePointPointHitsPtr_ = new labelList(slavePointPointHits);
|
||||
slavePointPointHitsPtr_ = new labelList();
|
||||
slavePointPointHitsPtr_->transfer(slavePointPointHits);
|
||||
|
||||
deleteDemandDrivenData(slavePointEdgeHitsPtr_);
|
||||
slavePointEdgeHitsPtr_ = new labelList(slavePointEdgeHits);
|
||||
slavePointEdgeHitsPtr_ = new labelList();
|
||||
slavePointEdgeHitsPtr_->transfer(slavePointEdgeHits);
|
||||
|
||||
deleteDemandDrivenData(slavePointFaceHitsPtr_);
|
||||
slavePointFaceHitsPtr_ = new List<objectHit>(slavePointFaceHits);
|
||||
slavePointFaceHitsPtr_ = new List<objectHit>();
|
||||
slavePointFaceHitsPtr_->transfer(slavePointFaceHits);
|
||||
|
||||
deleteDemandDrivenData(masterPointEdgeHitsPtr_);
|
||||
masterPointEdgeHitsPtr_ = new labelList(masterPointEdgeHits);
|
||||
masterPointEdgeHitsPtr_ = new labelList();
|
||||
masterPointEdgeHitsPtr_->transfer(masterPointEdgeHits);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
8
tutorials/mesh/stitchMesh/simple-cube1/Allclean
Executable file
8
tutorials/mesh/stitchMesh/simple-cube1/Allclean
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
|
||||
cleanCase0
|
||||
rmdir constant 2> /dev/null
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
19
tutorials/mesh/stitchMesh/simple-cube1/Allmesh
Executable file
19
tutorials/mesh/stitchMesh/simple-cube1/Allmesh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication topoSet
|
||||
|
||||
runApplication subsetMesh final -patch outer -resultTime 0
|
||||
|
||||
# Avoid any inconsistencies
|
||||
rm -f constant/polyMesh/{cellZones,faceZones,pointZones}
|
||||
|
||||
runApplication -s patches topoSet -dict system/topoSetDict.patches
|
||||
|
||||
runApplication createPatch -overwrite
|
||||
|
||||
# rm -f 0/polyMesh/{cellZones,faceZones,pointZones}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
12
tutorials/mesh/stitchMesh/simple-cube1/Allrun
Executable file
12
tutorials/mesh/stitchMesh/simple-cube1/Allrun
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||
|
||||
runApplication ./Allmesh
|
||||
|
||||
for dir in x y z
|
||||
do
|
||||
runApplication -s dir-$dir stitchMesh -partial outer$dir inner$dir
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
50
tutorials/mesh/stitchMesh/simple-cube1/scripts/stitch
Executable file
50
tutorials/mesh/stitchMesh/simple-cube1/scripts/stitch
Executable file
@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||
|
||||
[ "$#" -gt 0 ] || {
|
||||
echo "provide x, y, z or -all directions"
|
||||
exit 1
|
||||
}
|
||||
|
||||
unset optAll
|
||||
for dir
|
||||
do
|
||||
case "$dir" in
|
||||
-x | x) rm -rf 1 2 3 ;;
|
||||
-y | y) rm -rf 2 3 ;;
|
||||
-z | z) rm -rf 3 ;;
|
||||
-all | all)
|
||||
optAll=true
|
||||
rm -rf 1 2 3
|
||||
;;
|
||||
*)
|
||||
echo "provide x, y, z or -all directions"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$optAll" = true ]
|
||||
then
|
||||
set -- x y z
|
||||
fi
|
||||
|
||||
stitch()
|
||||
{
|
||||
local dir=$1
|
||||
stitchMesh -partial outer$dir inner$dir | tee log.stitch-$dir
|
||||
}
|
||||
|
||||
|
||||
for dir
|
||||
do
|
||||
case "$dir" in
|
||||
-x | x) [ -d 1 ] || stitch x;;
|
||||
-y | y) [ -d 2 ] || stitch y;;
|
||||
-z | z) [ -d 3 ] || stitch z;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
132
tutorials/mesh/stitchMesh/simple-cube1/system/blockMeshDict
Normal file
132
tutorials/mesh/stitchMesh/simple-cube1/system/blockMeshDict
Normal file
@ -0,0 +1,132 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
// Dimensions for outer box
|
||||
lo 0; // outer lower corner
|
||||
uo 1; // outer upper corner
|
||||
|
||||
// Dimensions for inner box
|
||||
li -0.1; // inner lower corner
|
||||
|
||||
ui 0.497; // inner upper corner
|
||||
// ^^^^^ very poorly handled gaps
|
||||
|
||||
ui 0.498; // inner upper corner
|
||||
// ^^^^^ slave patch probably does not project onto master
|
||||
|
||||
ui 0.499; // inner upper corner
|
||||
// ^^^^^ OK
|
||||
|
||||
|
||||
vertices
|
||||
(
|
||||
( $lo $lo $lo )
|
||||
( $uo $lo $lo )
|
||||
( $uo $uo $lo )
|
||||
( $lo $uo $lo )
|
||||
( $lo $lo $uo )
|
||||
( $uo $lo $uo )
|
||||
( $uo $uo $uo )
|
||||
( $lo $uo $uo )
|
||||
|
||||
( $li $li $li )
|
||||
( $ui $li $li )
|
||||
( $ui $ui $li )
|
||||
( $li $ui $li )
|
||||
( $li $li $ui )
|
||||
( $ui $li $ui )
|
||||
( $ui $ui $ui )
|
||||
( $li $ui $ui )
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (6 6 6) simpleGrading (1 1 1)
|
||||
hex (8 9 10 11 12 13 14 15) (10 10 10) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
wallso
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
// Walls of the outside block
|
||||
(0 4 7 3)
|
||||
(1 2 6 5)
|
||||
(0 1 5 4)
|
||||
(3 7 6 2)
|
||||
(0 3 2 1)
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
wallsi
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
// Walls of the inside block
|
||||
(8 12 15 11)
|
||||
(8 9 13 12)
|
||||
(8 11 10 9)
|
||||
);
|
||||
}
|
||||
|
||||
// Outer faces populated by subsetMesh
|
||||
outer
|
||||
{
|
||||
type patch;
|
||||
faces ();
|
||||
}
|
||||
|
||||
innerx
|
||||
{
|
||||
type patch;
|
||||
inGroups (inner);
|
||||
faces
|
||||
(
|
||||
(9 10 14 13)
|
||||
);
|
||||
}
|
||||
innery
|
||||
{
|
||||
type patch;
|
||||
inGroups (inner);
|
||||
faces
|
||||
(
|
||||
(11 15 14 10)
|
||||
);
|
||||
}
|
||||
innerz
|
||||
{
|
||||
type patch;
|
||||
inGroups (inner);
|
||||
faces
|
||||
(
|
||||
(12 13 14 15)
|
||||
);
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
45
tutorials/mesh/stitchMesh/simple-cube1/system/controlDict
Normal file
45
tutorials/mesh/stitchMesh/simple-cube1/system/controlDict
Normal file
@ -0,0 +1,45 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application simpleFoam;
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 10;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl runTime;
|
||||
|
||||
writeInterval 1;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,53 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object createPatchDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
pointSync false;
|
||||
|
||||
outerSet
|
||||
{
|
||||
patchInfo
|
||||
{
|
||||
type patch;
|
||||
inGroups (outer);
|
||||
}
|
||||
|
||||
constructFrom set;
|
||||
}
|
||||
|
||||
|
||||
// Patches to create.
|
||||
patches
|
||||
(
|
||||
{
|
||||
name outerx;
|
||||
set outerx;
|
||||
$outerSet;
|
||||
}
|
||||
|
||||
{
|
||||
name outery;
|
||||
set outery;
|
||||
$outerSet;
|
||||
}
|
||||
|
||||
{
|
||||
name outerz;
|
||||
set outerz;
|
||||
$outerSet;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
55
tutorials/mesh/stitchMesh/simple-cube1/system/fvSchemes
Normal file
55
tutorials/mesh/stitchMesh/simple-cube1/system/fvSchemes
Normal file
@ -0,0 +1,55 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss cubic;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p ;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
43
tutorials/mesh/stitchMesh/simple-cube1/system/fvSolution
Normal file
43
tutorials/mesh/stitchMesh/simple-cube1/system/fvSolution
Normal file
@ -0,0 +1,43 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-06;
|
||||
relTol 0;
|
||||
}
|
||||
|
||||
U
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother symGaussSeidel;
|
||||
tolerance 1e-05;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PISO
|
||||
{
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
106
tutorials/mesh/stitchMesh/simple-cube1/system/topoSetDict
Normal file
106
tutorials/mesh/stitchMesh/simple-cube1/system/topoSetDict
Normal file
@ -0,0 +1,106 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
actions
|
||||
(
|
||||
// Outer cube
|
||||
{
|
||||
name outer;
|
||||
type cellSet;
|
||||
action new;
|
||||
source regionToCell;
|
||||
sourceInfo
|
||||
{
|
||||
insidePoints
|
||||
(
|
||||
(0.99 0.99 0.99)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
name corner;
|
||||
type cellSet;
|
||||
action new;
|
||||
source boxToCell;
|
||||
sourceInfo
|
||||
{
|
||||
box (-1 -1 -1)(0.5 0.5 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
name inner;
|
||||
type cellSet;
|
||||
action new;
|
||||
source cellToCell;
|
||||
sourceInfo
|
||||
{
|
||||
set corner;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
name inner;
|
||||
type cellSet;
|
||||
action delete;
|
||||
source cellToCell;
|
||||
sourceInfo
|
||||
{
|
||||
set outer;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
name outer;
|
||||
type cellSet;
|
||||
action delete;
|
||||
source cellToCell;
|
||||
sourceInfo
|
||||
{
|
||||
set corner;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
name corner;
|
||||
type cellSet;
|
||||
action clear;
|
||||
}
|
||||
|
||||
{
|
||||
name final;
|
||||
type cellSet;
|
||||
action new;
|
||||
source cellToCell;
|
||||
sourceInfo
|
||||
{
|
||||
set outer;
|
||||
}
|
||||
}
|
||||
{
|
||||
name final;
|
||||
type cellSet;
|
||||
action add;
|
||||
source cellToCell;
|
||||
sourceInfo
|
||||
{
|
||||
set inner;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,88 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
newFromPatch
|
||||
{
|
||||
type faceSet;
|
||||
action new;
|
||||
source patchToFace;
|
||||
sourceInfo
|
||||
{
|
||||
name outer;
|
||||
}
|
||||
}
|
||||
|
||||
subsetNormal
|
||||
{
|
||||
type faceSet;
|
||||
action subset;
|
||||
source normalToFace;
|
||||
sourceInfo
|
||||
{
|
||||
cos 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
actions
|
||||
(
|
||||
// outerx
|
||||
{
|
||||
name outerx;
|
||||
$newFromPatch
|
||||
}
|
||||
|
||||
{
|
||||
name outerx;
|
||||
$subsetNormal;
|
||||
sourceInfo
|
||||
{
|
||||
normal (-1 0 0);
|
||||
}
|
||||
}
|
||||
|
||||
// outery
|
||||
{
|
||||
name outery;
|
||||
$newFromPatch
|
||||
}
|
||||
|
||||
{
|
||||
name outery;
|
||||
$subsetNormal;
|
||||
sourceInfo
|
||||
{
|
||||
normal (0 -1 0);
|
||||
}
|
||||
}
|
||||
|
||||
// outerz
|
||||
{
|
||||
name outerz;
|
||||
$newFromPatch
|
||||
}
|
||||
|
||||
{
|
||||
name outerz;
|
||||
$subsetNormal;
|
||||
sourceInfo
|
||||
{
|
||||
normal (0 0 -1);
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user