mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
initial mattijsLib merge
This commit is contained in:
@ -54,8 +54,8 @@ Description
|
||||
#include "cellInfo.H"
|
||||
#include "MeshWave.H"
|
||||
#include "edgeStats.H"
|
||||
#include "octreeDataTriSurface.H"
|
||||
#include "octree.H"
|
||||
#include "treeDataTriSurface.H"
|
||||
#include "indexedOctree.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -185,7 +185,7 @@ void cutBySurface
|
||||
<< " to the surface ..." << nl << endl;
|
||||
|
||||
const pointField& pts = mesh.points();
|
||||
const octree<octreeDataTriSurface>& tree = querySurf.tree();
|
||||
const indexedOctree<treeDataTriSurface>& tree = querySurf.tree();
|
||||
|
||||
label nRemoved = 0;
|
||||
|
||||
@ -193,17 +193,9 @@ void cutBySurface
|
||||
{
|
||||
const point& pt = pts[pointI];
|
||||
|
||||
// Search in tight bounding box around pt.
|
||||
treeBoundBox tightest
|
||||
(
|
||||
pt - vector(nearDist, nearDist, nearDist),
|
||||
pt + vector(nearDist, nearDist, nearDist)
|
||||
);
|
||||
scalar tightestDist = mag(tightest.max() - tightest.min());
|
||||
pointIndexHit hitInfo = tree.findNearest(pt, sqr(nearDist));
|
||||
|
||||
label triI = tree.findNearest(pt, tightest, tightestDist);
|
||||
|
||||
if (triI != -1 && tightestDist < nearDist)
|
||||
if (hitInfo.hit())
|
||||
{
|
||||
const labelList& pCells = mesh.pointCells()[pointI];
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
# include "addRegionOption.H"
|
||||
|
||||
# include "addTimeOptionsNoConstant.H"
|
||||
|
||||
@ -67,7 +68,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
|
||||
# include "createPolyMesh.H"
|
||||
# include "createNamedPolyMesh.H"
|
||||
|
||||
bool firstCheck = true;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
execFlowFunctionObjects.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/execFlowFunctionObjects
|
||||
EXE = $(FOAM_APPBIN)/execFlowFunctionObjects
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
calcDivPhi.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/divPhi
|
||||
EXE = $(FOAM_APPBIN)/divPhi
|
||||
|
||||
@ -51,16 +51,15 @@ void dumpBox(const treeBoundBox& bb, const fileName& fName)
|
||||
|
||||
|
||||
pointField boxPoints(bb.points());
|
||||
edgeList boxEdges(bb.edges());
|
||||
|
||||
forAll(boxPoints, i)
|
||||
{
|
||||
meshTools::writeOBJ(str, boxPoints[i]);
|
||||
}
|
||||
|
||||
forAll(boxEdges, i)
|
||||
forAll(treeBoundBox::edges, i)
|
||||
{
|
||||
const edge& e = boxEdges[i];
|
||||
const edge& e = treeBoundBox::edges[i];
|
||||
|
||||
str<< "l " << e[0]+1 << ' ' << e[1]+1 << nl;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
#( cd $FOAM_SRC/other && ./Allwmake )
|
||||
( cd $FOAM_SRC/other && ./Allwmake )
|
||||
|
||||
( cd $FOAM_SRC/OpenFOAM && wmakeLnInclude . )
|
||||
|
||||
|
||||
@ -1,161 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::mapDistributeLagrangian
|
||||
|
||||
Description
|
||||
Class containing mesh-to-mesh mapping information for particles
|
||||
|
||||
SourceFiles
|
||||
mapDistributeLagrangian.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mapDistributeLagrangian_H
|
||||
#define mapDistributeLagrangian_H
|
||||
|
||||
#include "mapDistributePolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mapDistributeLagrangian Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mapDistributeLagrangian
|
||||
{
|
||||
// Private data
|
||||
|
||||
const label nNewParticles_;
|
||||
|
||||
//- Maps from subsetted mesh back to original mesh
|
||||
const labelListList subParticleMap_;
|
||||
|
||||
//- Maps from subsetted mesh to new reconstructed mesh
|
||||
const labelListList constructParticleMap_;
|
||||
|
||||
//- Per element in subsetted mesh the cell label
|
||||
const labelListList constructCellLabels_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
mapDistributeLagrangian
|
||||
(
|
||||
const label nNewParticles,
|
||||
const labelListList& subParticleMap,
|
||||
const labelListList& constructParticleMap,
|
||||
const labelListList& constructCellLabels
|
||||
)
|
||||
:
|
||||
nNewParticles_(nNewParticles),
|
||||
subParticleMap_(subParticleMap),
|
||||
constructParticleMap_(constructParticleMap),
|
||||
constructCellLabels_(constructCellLabels)
|
||||
{}
|
||||
|
||||
//- Construct from components and steal storage
|
||||
mapDistributeLagrangian
|
||||
(
|
||||
const label nNewParticles,
|
||||
labelListList& subParticleMap,
|
||||
labelListList& constructParticleMap,
|
||||
labelListList& constructCellLabels,
|
||||
const bool reUse
|
||||
)
|
||||
:
|
||||
nNewParticles_(nNewParticles),
|
||||
subParticleMap_(subParticleMap, reUse),
|
||||
constructParticleMap_(constructParticleMap, reUse),
|
||||
constructCellLabels_(constructCellLabels, reUse)
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- From subsetted lagrangian particles back to original particles
|
||||
const labelListList& subParticleMap() const
|
||||
{
|
||||
return subParticleMap_;
|
||||
}
|
||||
|
||||
//- From received particles to new reconstructed particles
|
||||
const labelListList& constructParticleMap() const
|
||||
{
|
||||
return constructParticleMap_;
|
||||
}
|
||||
|
||||
//- Per received particle the destination cell label
|
||||
const labelListList& constructCellLabels() const
|
||||
{
|
||||
return constructCellLabels_;
|
||||
}
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- distribute list of lagrangian data
|
||||
template<class T>
|
||||
void distributeLagrangianData(List<T>& lst) const
|
||||
{
|
||||
mapDistributePolyMesh::distribute
|
||||
(
|
||||
nNewParticles_,
|
||||
subParticleMap(),
|
||||
constructParticleMap(),
|
||||
lst
|
||||
);
|
||||
}
|
||||
|
||||
//- Correct for topo change.
|
||||
void updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"mapDistributeLagrangian::updateMesh(const mapPolyMesh&)"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,246 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ListOps.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::mapDistributePolyMesh::calcPatchSizes()
|
||||
{
|
||||
oldPatchSizes_.setSize(oldPatchStarts_.size());
|
||||
|
||||
// Calculate old patch sizes
|
||||
for (label patchI = 0; patchI < oldPatchStarts_.size() - 1; patchI++)
|
||||
{
|
||||
oldPatchSizes_[patchI] =
|
||||
oldPatchStarts_[patchI + 1] - oldPatchStarts_[patchI];
|
||||
}
|
||||
|
||||
// Set the last one by hand
|
||||
const label lastPatchID = oldPatchStarts_.size() - 1;
|
||||
|
||||
oldPatchSizes_[lastPatchID] = nOldFaces_ - oldPatchStarts_[lastPatchID];
|
||||
|
||||
if (min(oldPatchSizes_) < 0)
|
||||
{
|
||||
FatalErrorIn("mapDistributePolyMesh::calcPatchSizes()")
|
||||
<< "Calculated negative old patch size:" << oldPatchSizes_ << nl
|
||||
<< "Error in mapping data" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
//- Construct from components
|
||||
Foam::mapDistributePolyMesh::mapDistributePolyMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
// mesh before changes
|
||||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
const labelList& oldPatchStarts,
|
||||
const labelList& oldPatchNMeshPoints,
|
||||
|
||||
// how to subset pieces of mesh to send across
|
||||
const labelListList& subPointMap,
|
||||
const labelListList& subFaceMap,
|
||||
const labelListList& subCellMap,
|
||||
const labelListList& subPatchMap,
|
||||
|
||||
// how to reconstruct received mesh
|
||||
const labelListList& constructPointMap,
|
||||
const labelListList& constructFaceMap,
|
||||
const labelListList& constructCellMap,
|
||||
const labelListList& constructPatchMap
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
nOldPoints_(nOldPoints),
|
||||
nOldFaces_(nOldFaces),
|
||||
nOldCells_(nOldCells),
|
||||
oldPatchSizes_(oldPatchStarts.size()),
|
||||
oldPatchStarts_(oldPatchStarts),
|
||||
oldPatchNMeshPoints_(oldPatchNMeshPoints),
|
||||
subPointMap_(subPointMap),
|
||||
subFaceMap_(subFaceMap),
|
||||
subCellMap_(subCellMap),
|
||||
subPatchMap_(subPatchMap),
|
||||
constructPointMap_(constructPointMap),
|
||||
constructFaceMap_(constructFaceMap),
|
||||
constructCellMap_(constructCellMap),
|
||||
constructPatchMap_(constructPatchMap)
|
||||
{
|
||||
calcPatchSizes();
|
||||
}
|
||||
|
||||
|
||||
//- (optionally destructively) construct from components
|
||||
Foam::mapDistributePolyMesh::mapDistributePolyMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
labelList& oldPatchStarts,
|
||||
labelList& oldPatchNMeshPoints,
|
||||
|
||||
labelListList& subPointMap,
|
||||
labelListList& subFaceMap,
|
||||
labelListList& subCellMap,
|
||||
labelListList& subPatchMap,
|
||||
labelListList& constructPointMap,
|
||||
labelListList& constructFaceMap,
|
||||
labelListList& constructCellMap,
|
||||
labelListList& constructPatchMap,
|
||||
const bool reUse // clone or reuse
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
nOldPoints_(nOldPoints),
|
||||
nOldFaces_(nOldFaces),
|
||||
nOldCells_(nOldCells),
|
||||
oldPatchSizes_(oldPatchStarts.size()),
|
||||
oldPatchStarts_(oldPatchStarts, reUse),
|
||||
oldPatchNMeshPoints_(oldPatchNMeshPoints, reUse),
|
||||
subPointMap_(subPointMap, reUse),
|
||||
subFaceMap_(subFaceMap, reUse),
|
||||
subCellMap_(subCellMap, reUse),
|
||||
subPatchMap_(subPatchMap, reUse),
|
||||
constructPointMap_(constructPointMap, reUse),
|
||||
constructFaceMap_(constructFaceMap, reUse),
|
||||
constructCellMap_(constructCellMap, reUse),
|
||||
constructPatchMap_(constructPatchMap, reUse)
|
||||
{
|
||||
calcPatchSizes();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::mapDistributePolyMesh::distributePointIndices(labelList& lst)
|
||||
const
|
||||
{
|
||||
// Construct boolList from selected elements
|
||||
boolList isSelected
|
||||
(
|
||||
createWithValues<boolList>
|
||||
(
|
||||
nOldPoints(),
|
||||
false,
|
||||
lst,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
// Distribute
|
||||
distributePointData(isSelected);
|
||||
|
||||
// Collect selected elements
|
||||
lst = findIndices(isSelected, true);
|
||||
}
|
||||
|
||||
|
||||
void Foam::mapDistributePolyMesh::distributeFaceIndices(labelList& lst)
|
||||
const
|
||||
{
|
||||
// Construct boolList from selected elements
|
||||
boolList isSelected
|
||||
(
|
||||
createWithValues<boolList>
|
||||
(
|
||||
nOldFaces(),
|
||||
false,
|
||||
lst,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
// Distribute
|
||||
distributeFaceData(isSelected);
|
||||
|
||||
// Collect selected elements
|
||||
lst = findIndices(isSelected, true);
|
||||
}
|
||||
|
||||
|
||||
void Foam::mapDistributePolyMesh::distributeCellIndices(labelList& lst)
|
||||
const
|
||||
{
|
||||
// Construct boolList from selected elements
|
||||
boolList isSelected
|
||||
(
|
||||
createWithValues<boolList>
|
||||
(
|
||||
nOldCells(),
|
||||
false,
|
||||
lst,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
// Distribute
|
||||
distributeCellData(isSelected);
|
||||
|
||||
// Collect selected elements
|
||||
lst = findIndices(isSelected, true);
|
||||
}
|
||||
|
||||
|
||||
void Foam::mapDistributePolyMesh::distributePatchIndices(labelList& lst)
|
||||
const
|
||||
{
|
||||
// Construct boolList from selected elements
|
||||
boolList isSelected
|
||||
(
|
||||
createWithValues<boolList>
|
||||
(
|
||||
oldPatchStarts().size(), // nOldPatches
|
||||
false,
|
||||
lst,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
// Distribute
|
||||
distributePatchData(isSelected);
|
||||
|
||||
// Collect selected elements
|
||||
lst = findIndices(isSelected, true);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,335 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::mapDistributePolyMesh
|
||||
|
||||
Description
|
||||
Class containing mesh-to-mesh mapping information after a mesh distribution
|
||||
where we send parts of meshes (using subsetting) to other processors
|
||||
and receive and reconstruct mesh.
|
||||
|
||||
We store mapping from the bits-to-send to the complete starting mesh
|
||||
(subXXXMap) and from the received bits to their location in the new
|
||||
mesh (constructXXXMap).
|
||||
|
||||
SourceFiles
|
||||
mapDistributePolyMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mapDistributePolyMesh_H
|
||||
#define mapDistributePolyMesh_H
|
||||
|
||||
#include "labelList.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mapDistributePolyMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mapDistributePolyMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
const polyMesh& mesh_;
|
||||
|
||||
//- Number of old live points
|
||||
const label nOldPoints_;
|
||||
|
||||
//- Number of old live faces
|
||||
const label nOldFaces_;
|
||||
|
||||
//- Number of old live cells
|
||||
const label nOldCells_;
|
||||
|
||||
//- List of the old patch sizes
|
||||
labelList oldPatchSizes_;
|
||||
|
||||
//- List of the old patch start labels
|
||||
const labelList oldPatchStarts_;
|
||||
|
||||
//- List of numbers of mesh points per old patch
|
||||
const labelList oldPatchNMeshPoints_;
|
||||
|
||||
//- Maps from subsetted mesh back to original mesh
|
||||
const labelListList subPointMap_;
|
||||
const labelListList subFaceMap_;
|
||||
const labelListList subCellMap_;
|
||||
const labelListList subPatchMap_;
|
||||
|
||||
//- Maps from subsetted mesh to new reconstructed mesh
|
||||
const labelListList constructPointMap_;
|
||||
const labelListList constructFaceMap_;
|
||||
const labelListList constructCellMap_;
|
||||
const labelListList constructPatchMap_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void calcPatchSizes();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
mapDistributePolyMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
// mesh before changes
|
||||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
const labelList& oldPatchStarts,
|
||||
const labelList& oldPatchNMeshPoints,
|
||||
|
||||
// how to subset pieces of mesh to send across
|
||||
const labelListList& subPointMap,
|
||||
const labelListList& subFaceMap,
|
||||
const labelListList& subCellMap,
|
||||
const labelListList& subPatchMap,
|
||||
|
||||
// how to reconstruct received mesh
|
||||
const labelListList& constructPointMap,
|
||||
const labelListList& constructFaceMap,
|
||||
const labelListList& constructCellMap,
|
||||
const labelListList& constructPatchMap
|
||||
);
|
||||
|
||||
//- (optionally destructively) construct from components
|
||||
mapDistributePolyMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
labelList& oldPatchStarts,
|
||||
labelList& oldPatchNMeshPoints,
|
||||
|
||||
labelListList& subPointMap,
|
||||
labelListList& subFaceMap,
|
||||
labelListList& subCellMap,
|
||||
labelListList& subPatchMap,
|
||||
labelListList& constructPointMap,
|
||||
labelListList& constructFaceMap,
|
||||
labelListList& constructCellMap,
|
||||
labelListList& constructPatchMap,
|
||||
const bool reUse // clone or reuse
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
const polyMesh& mesh() const
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
//- Number of points in mesh before distribution
|
||||
label nOldPoints() const
|
||||
{
|
||||
return nOldPoints_;
|
||||
}
|
||||
|
||||
//- Number of faces in mesh before distribution
|
||||
label nOldFaces() const
|
||||
{
|
||||
return nOldFaces_;
|
||||
}
|
||||
|
||||
//- Number of cells in mesh before distribution
|
||||
label nOldCells() const
|
||||
{
|
||||
return nOldCells_;
|
||||
}
|
||||
|
||||
//- List of the old patch sizes
|
||||
const labelList& oldPatchSizes() const
|
||||
{
|
||||
return oldPatchSizes_;
|
||||
}
|
||||
|
||||
//- List of the old patch start labels
|
||||
const labelList& oldPatchStarts() const
|
||||
{
|
||||
return oldPatchStarts_;
|
||||
}
|
||||
|
||||
//- List of numbers of mesh points per old patch
|
||||
const labelList& oldPatchNMeshPoints() const
|
||||
{
|
||||
return oldPatchNMeshPoints_;
|
||||
}
|
||||
|
||||
//- From subsetted mesh back to original mesh
|
||||
// (these are like the maps in fvMeshSubset)
|
||||
const labelListList& subPointMap() const
|
||||
{
|
||||
return subPointMap_;
|
||||
}
|
||||
//- From subsetted mesh back to original mesh
|
||||
const labelListList& subFaceMap() const
|
||||
{
|
||||
return subFaceMap_;
|
||||
}
|
||||
//- From subsetted mesh back to original mesh
|
||||
const labelListList& subCellMap() const
|
||||
{
|
||||
return subCellMap_;
|
||||
}
|
||||
//- From subsetted mesh back to original mesh
|
||||
const labelListList& subPatchMap() const
|
||||
{
|
||||
return subPatchMap_;
|
||||
}
|
||||
|
||||
//- From subsetted mesh to new reconstructed mesh
|
||||
// (like the pointProcAddressing in reconstructPar)
|
||||
const labelListList& constructPointMap() const
|
||||
{
|
||||
return constructPointMap_;
|
||||
}
|
||||
//- From subsetted mesh to new reconstructed mesh
|
||||
const labelListList& constructFaceMap() const
|
||||
{
|
||||
return constructFaceMap_;
|
||||
}
|
||||
//- From subsetted mesh to new reconstructed mesh
|
||||
const labelListList& constructCellMap() const
|
||||
{
|
||||
return constructCellMap_;
|
||||
}
|
||||
//- From subsetted mesh to new reconstructed mesh
|
||||
const labelListList& constructPatchMap() const
|
||||
{
|
||||
return constructPatchMap_;
|
||||
}
|
||||
|
||||
// Edit
|
||||
|
||||
//- Helper function: distribute list data
|
||||
template<class T>
|
||||
static void distribute
|
||||
(
|
||||
const label newSize,
|
||||
const labelListList& subMap, // from subset to original
|
||||
const labelListList& constructMap, // from subset to new
|
||||
List<T>&
|
||||
);
|
||||
|
||||
//- distribute list of point data
|
||||
template<class T>
|
||||
void distributePointData(List<T>& lst) const
|
||||
{
|
||||
distribute
|
||||
(
|
||||
mesh_.nPoints(),
|
||||
subPointMap(),
|
||||
constructPointMap(),
|
||||
lst
|
||||
);
|
||||
}
|
||||
//- distribute list of face data
|
||||
template<class T>
|
||||
void distributeFaceData(List<T>& lst) const
|
||||
{
|
||||
distribute
|
||||
(
|
||||
mesh_.nFaces(),
|
||||
subFaceMap(),
|
||||
constructFaceMap(),
|
||||
lst
|
||||
);
|
||||
}
|
||||
//- distribute list of cell data
|
||||
template<class T>
|
||||
void distributeCellData(List<T>& lst) const
|
||||
{
|
||||
distribute
|
||||
(
|
||||
mesh_.nCells(),
|
||||
subCellMap(),
|
||||
constructCellMap(),
|
||||
lst
|
||||
);
|
||||
}
|
||||
//- distribute list of patch data
|
||||
template<class T>
|
||||
void distributePatchData(List<T>& lst) const
|
||||
{
|
||||
distribute
|
||||
(
|
||||
mesh_.boundaryMesh().size(),
|
||||
subPatchMap(),
|
||||
constructPatchMap(),
|
||||
lst
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- distribute list of point/face/cell/patch indices.
|
||||
// (Converts to boolList, distributes boolList and reconstructs)
|
||||
void distributePointIndices(labelList& pointIDs) const;
|
||||
void distributeFaceIndices(labelList& faceIDs) const;
|
||||
void distributeCellIndices(labelList& cellIDs) const;
|
||||
void distributePatchIndices(labelList& patchIDs) const;
|
||||
|
||||
|
||||
//- Correct for topo change.
|
||||
void updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"mapDistributePolyMesh::updateMesh(const mapPolyMesh&)"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "mapDistributePolyMeshTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,83 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Distribute list.
|
||||
template<class T>
|
||||
void Foam::mapDistributePolyMesh::distribute
|
||||
(
|
||||
const label newSize,
|
||||
const labelListList& subMap, // from subset to original
|
||||
const labelListList& constructMap, // from subset to new
|
||||
List<T>& field
|
||||
)
|
||||
{
|
||||
// Send sub field to neighbour
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
if (domain != Pstream::myProcNo())
|
||||
{
|
||||
OPstream toNbr(Pstream::blocking, domain);
|
||||
toNbr << IndirectList<T>(field, subMap[domain])();
|
||||
}
|
||||
}
|
||||
|
||||
// Subset myself
|
||||
List<T> subField(IndirectList<T>(field, subMap[Pstream::myProcNo()]));
|
||||
|
||||
// Receive sub field from myself (subField)
|
||||
field.setSize(newSize);
|
||||
|
||||
const labelList& map = constructMap[Pstream::myProcNo()];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
field[map[i]] = subField[i];
|
||||
}
|
||||
|
||||
|
||||
// Receive sub field from neighbour
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
if (domain != Pstream::myProcNo())
|
||||
{
|
||||
IPstream fromNbr(Pstream::blocking, domain);
|
||||
List<T> subField(fromNbr);
|
||||
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
field[map[i]] = subField[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -86,7 +86,7 @@ projectPoints
|
||||
|
||||
const ToPatch& masterFaces = targetPatch;
|
||||
|
||||
const typename ToPatch::PointFieldType& masterPoints = targetPatch.points();
|
||||
const Field<PointType>& masterPoints = targetPatch.points();
|
||||
|
||||
// Estimate face centre of target side
|
||||
Field<PointType> masterFaceCentres(targetPatch.size());
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "ListOps.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -663,9 +664,11 @@ void Foam::refinementHistory::distribute(const mapDistributePolyMesh& map)
|
||||
// Per visible cell the processor it goes to.
|
||||
labelList destination(visibleCells_.size());
|
||||
|
||||
forAll(map.subCellMap(), procI)
|
||||
const labelListList& subCellMap = map.cellMap().subMap();
|
||||
|
||||
forAll(subCellMap, procI)
|
||||
{
|
||||
const labelList& newToOld = map.subCellMap()[procI];
|
||||
const labelList& newToOld = subCellMap[procI];
|
||||
|
||||
forAll(newToOld, i)
|
||||
{
|
||||
@ -792,7 +795,7 @@ Pout<< "refinementHistory::distribute :"
|
||||
}
|
||||
|
||||
|
||||
const labelList& subMap = map.subCellMap()[procI];
|
||||
const labelList& subMap = subCellMap[procI];
|
||||
|
||||
// New visible cells.
|
||||
labelList newVisibleCells(subMap.size(), -1);
|
||||
@ -873,7 +876,7 @@ Pout<< "refinementHistory::distribute :"
|
||||
|
||||
|
||||
// Combine visibleCell.
|
||||
const labelList& constructMap = map.constructCellMap()[procI];
|
||||
const labelList& constructMap = map.cellMap().constructMap()[procI];
|
||||
|
||||
forAll(newVisibleCells, i)
|
||||
{
|
||||
|
||||
@ -62,7 +62,7 @@ void Foam::fvMotionSolver::movePoints(const pointField& p)
|
||||
|
||||
void Foam::fvMotionSolver::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
motionSolver::updateMesh();
|
||||
motionSolver::updateMesh(mpm);
|
||||
pointMesh_.updateMesh(mpm);
|
||||
vpi_.updateMesh();
|
||||
}
|
||||
|
||||
@ -47,6 +47,10 @@ octree/treeLeafName.C
|
||||
octree/pointIndexHitIOList.C
|
||||
|
||||
indexedOctree/indexedOctreeName.C
|
||||
indexedOctree/treeDataCell.C
|
||||
indexedOctree/treeDataEdge.C
|
||||
indexedOctree/treeDataFace.C
|
||||
indexedOctree/treeDataPoint.C
|
||||
indexedOctree/treeDataTriSurface.C
|
||||
|
||||
topoSets = sets/topoSets
|
||||
|
||||
@ -28,8 +28,8 @@ Description
|
||||
|
||||
#include "cellClassification.H"
|
||||
#include "triSurfaceSearch.H"
|
||||
#include "octree.H"
|
||||
#include "octreeDataTriSurface.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataFace.H"
|
||||
#include "meshSearch.H"
|
||||
#include "cellInfo.H"
|
||||
#include "polyMesh.H"
|
||||
@ -141,11 +141,9 @@ Foam::boolList Foam::cellClassification::markFaces
|
||||
}
|
||||
}
|
||||
|
||||
octreeDataFace shapes(mesh_, allFaces);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Testing " << shapes.size() << " faces for piercing by surface"
|
||||
Pout<< "Testing " << allFaceI << " faces for piercing by surface"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -164,13 +162,13 @@ Foam::boolList Foam::cellClassification::markFaces
|
||||
bbMax.y() += 2*tol;
|
||||
bbMax.z() += 2*tol;
|
||||
|
||||
octree<octreeDataFace> faceTree
|
||||
indexedOctree<treeDataFace> faceTree
|
||||
(
|
||||
treeDataFace(false, mesh_, allFaces),
|
||||
allBb, // overall search domain
|
||||
shapes, // all information needed to do checks on faces
|
||||
1, // min levels
|
||||
20.0, // maximum ratio of cubes v.s. faces
|
||||
10.0
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
);
|
||||
|
||||
const triSurface& surf = search.surface();
|
||||
@ -210,7 +208,7 @@ Foam::boolList Foam::cellClassification::markFaces
|
||||
}
|
||||
else
|
||||
{
|
||||
label faceI = shapes.meshFaces()[pHit.index()];
|
||||
label faceI = faceTree.shapes().faceLabels()[pHit.index()];
|
||||
|
||||
if (!cutFace[faceI])
|
||||
{
|
||||
|
||||
@ -915,14 +915,9 @@ void indexedOctree<Type>::traverseNode
|
||||
{
|
||||
faceID = 0;
|
||||
|
||||
//WarningIn("indexedOctree<Type>::traverseNode")
|
||||
FatalErrorIn("indexedOctree<Type>::traverseNode")
|
||||
<< "Did not hit side of node box " << subBb
|
||||
WarningIn("indexedOctree<Type>::traverseNode")
|
||||
<< "Did not hit side of box " << subBb
|
||||
<< " with ray from " << start << " to " << end
|
||||
//<< endl;
|
||||
<< abort(FatalError);
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
@ -938,14 +933,9 @@ void indexedOctree<Type>::traverseNode
|
||||
{
|
||||
faceID = 0;
|
||||
|
||||
//WarningIn("indexedOctree<Type>::traverseNode")
|
||||
FatalErrorIn("indexedOctree<Type>::traverseNode")
|
||||
<< "Did not hit side of content box " << subBb
|
||||
WarningIn("indexedOctree<Type>::traverseNode")
|
||||
<< "Did not hit side of box " << subBb
|
||||
<< " with ray from " << start << " to " << end
|
||||
//<< endl;
|
||||
<< abort(FatalError);
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and subset of cells.
|
||||
//- Construct from mesh and subset of faces.
|
||||
treeDataFace
|
||||
(
|
||||
const bool cacheBb,
|
||||
|
||||
@ -34,8 +34,8 @@ Description
|
||||
#include "labelHashSet.H"
|
||||
#include "triSurface.H"
|
||||
#include "pointIndexHit.H"
|
||||
#include "octreeDataTriSurface.H"
|
||||
#include "octree.H"
|
||||
#include "treeDataTriSurface.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "meshTools.H"
|
||||
#include "plane.H"
|
||||
#include "Random.H"
|
||||
@ -120,7 +120,7 @@ void Foam::edgeIntersections::intersectEdges
|
||||
}
|
||||
|
||||
// Construct octree.
|
||||
const octree<octreeDataTriSurface>& tree = querySurf2.tree();
|
||||
const indexedOctree<treeDataTriSurface>& tree = querySurf2.tree();
|
||||
|
||||
|
||||
label nHits = 0;
|
||||
|
||||
@ -40,7 +40,8 @@ SourceFiles
|
||||
#include "pointField.H"
|
||||
#include "boolList.H"
|
||||
#include "pointIndexHit.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataTriSurface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -1,91 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::triSurfaceMesh
|
||||
|
||||
Description
|
||||
A triSurface with objectRegistry so it can hold fields.
|
||||
|
||||
SourceFiles
|
||||
triSurfaceMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef triSurfaceMesh_H
|
||||
#define triSurfaceMesh_H
|
||||
|
||||
#include "triSurface.H"
|
||||
#include "objectRegistry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class triSurfaceMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class triSurfaceMesh
|
||||
:
|
||||
public objectRegistry,
|
||||
public triSurface
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from triangles, patches, points.
|
||||
triSurfaceMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const List<labelledTri>& faces,
|
||||
const geometricSurfacePatchList& patches,
|
||||
const pointField& points
|
||||
)
|
||||
:
|
||||
objectRegistry(io),
|
||||
triSurface(faces, patches, points)
|
||||
{}
|
||||
|
||||
//- Construct from file name (uses extension to determine type)
|
||||
triSurfaceMesh(const IOobject& io, const fileName& fName)
|
||||
:
|
||||
objectRegistry(io),
|
||||
triSurface(fName)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user