Commit c3519f5b authored by mattijs's avatar mattijs
Browse files

patch decomposition through mapping

parent 85a2dbaf
......@@ -34,6 +34,7 @@ License
#include "Map.H"
#include "globalMeshData.H"
#include "DynamicList.H"
#include "fvFieldDecomposer.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......@@ -306,12 +307,29 @@ bool domainDecomposition::writeDecomposition()
forAll (curPatchSizes, patchi)
{
// Get the face labels consistent with the field mapping
// (reuse the patch field mappers)
const polyPatch& meshPatch =
meshPatches[curBoundaryAddressing[patchi]];
fvFieldDecomposer::patchFieldDecomposer patchMapper
(
SubList<label>
(
curFaceLabels,
curPatchSizes[patchi],
curPatchStarts[patchi]
),
meshPatch.start()
);
// Map existing patches
procPatches[nPatches] =
meshPatches[curBoundaryAddressing[patchi]].clone
(
procMesh.boundaryMesh(),
nPatches,
curPatchSizes[patchi],
patchMapper.directAddressing(),
curPatchStarts[patchi]
).ptr();
......
......@@ -445,6 +445,19 @@ Foam::coupledPolyPatch::coupledPolyPatch
{}
Foam::coupledPolyPatch::coupledPolyPatch
(
const coupledPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::coupledPolyPatch::~coupledPolyPatch()
......
......@@ -221,6 +221,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
coupledPolyPatch
(
const coupledPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
// Destructor
......
......@@ -94,6 +94,21 @@ Foam::genericPolyPatch::genericPolyPatch
{}
Foam::genericPolyPatch::genericPolyPatch
(
const genericPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart),
actualTypeName_(pp.actualTypeName_),
dict_(pp.dict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::genericPolyPatch::~genericPolyPatch()
......
......@@ -106,6 +106,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
genericPolyPatch
(
const genericPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
......@@ -128,6 +138,22 @@ public:
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new genericPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
// Destructor
......
......@@ -826,6 +826,26 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
{}
Foam::cyclicPolyPatch::cyclicPolyPatch
(
const cyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
coupledPointsPtr_(NULL),
coupledEdgesPtr_(NULL),
featureCos_(pp.featureCos_),
transform_(pp.transform_),
rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_),
separationVector_(pp.separationVector_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicPolyPatch::~cyclicPolyPatch()
......
......@@ -234,6 +234,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
cyclicPolyPatch
(
const cyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
......@@ -256,6 +266,22 @@ public:
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new cyclicPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
// Destructor
......
......@@ -87,4 +87,17 @@ Foam::emptyPolyPatch::emptyPolyPatch
{}
Foam::emptyPolyPatch::emptyPolyPatch
(
const emptyPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{}
// ************************************************************************* //
......@@ -92,6 +92,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
emptyPolyPatch
(
const emptyPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
......@@ -113,6 +123,22 @@ public:
new emptyPolyPatch(*this, bm, index, newSize, newStart)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new emptyPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
};
......
......@@ -124,6 +124,26 @@ Foam::processorPolyPatch::processorPolyPatch
{}
Foam::processorPolyPatch::processorPolyPatch
(
const processorPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(),
neighbFaceAreas_(),
neighbFaceCellCentres_(),
neighbPointsPtr_(NULL),
neighbEdgesPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorPolyPatch::~processorPolyPatch()
......
......@@ -158,6 +158,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
processorPolyPatch
(
const processorPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
......@@ -178,7 +188,7 @@ public:
(
new processorPolyPatch
(
refCast<const processorPolyPatch>(*this),
*this,
bm,
index,
newSize,
......@@ -187,6 +197,29 @@ public:
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new processorPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
// Destructor
......
......@@ -87,4 +87,17 @@ Foam::symmetryPolyPatch::symmetryPolyPatch
{}
Foam::symmetryPolyPatch::symmetryPolyPatch
(
const symmetryPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{}
// ************************************************************************* //
......@@ -92,6 +92,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
symmetryPolyPatch
(
const symmetryPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
......@@ -113,6 +123,22 @@ public:
new symmetryPolyPatch(*this, bm, index, newSize, newStart)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new symmetryPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
};
......
......@@ -157,4 +157,19 @@ Foam::wedgePolyPatch::wedgePolyPatch
}
Foam::wedgePolyPatch::wedgePolyPatch
(
const wedgePolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{
initTransforms();
}
// ************************************************************************* //
......@@ -113,6 +113,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
wedgePolyPatch
(
const wedgePolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
......@@ -135,6 +145,22 @@ public:
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new wedgePolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
// Member functions
......
......@@ -87,4 +87,17 @@ Foam::wallPolyPatch::wallPolyPatch
{}
Foam::wallPolyPatch::wallPolyPatch
(
const wallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{}
// ************************************************************************* //
......@@ -92,6 +92,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
wallPolyPatch
(
const wallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
......@@ -113,6 +123,22 @@ public:
new wallPolyPatch(*this, bm, index, newSize, newStart)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new wallPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
};
......
......@@ -167,6 +167,33 @@ Foam::polyPatch::polyPatch
{}
Foam::polyPatch::polyPatch
(
const polyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
patchIdentifier(pp, index),
primitivePatch
(
faceSubList
(
bm.mesh().faces(),
mapAddressing.size(),
newStart
),
bm.mesh().points()
),
start_(newStart),
boundaryMesh_(bm),
faceCellsPtr_(NULL),
mePtr_(NULL)
{}
Foam::polyPatch::polyPatch(const polyPatch& p)
:
patchIdentifier(p),
......
......@@ -199,6 +199,16 @@ public:
const label newStart
);
//- Construct given the original patch and a map
polyPatch
(
const polyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct as copy
polyPatch(const polyPatch&);
......@@ -224,6 +234,22 @@ public:
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(