Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev into feature/cvMesh

This commit is contained in:
laurence
2013-06-20 11:30:36 +01:00
441 changed files with 6723 additions and 4205 deletions

View File

@ -26,12 +26,12 @@ else
fi
# build OpenFOAM libraries and applications
src/Allwmake
applications/Allwmake
src/Allwmake $*
applications/Allwmake $*
if [ "$1" = doc ]
then
doc/Allwmake
doc/Allwmake $*
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -16,7 +16,7 @@ wmakeCheckPwd "$WM_PROJECT_DIR/applications" || {
set -x
wmake all utilities
wmake all solvers
wmake all utilities $*
wmake all solvers $*
# ----------------------------------------------------------------- end-of-file

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,8 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::XiGModel::basicSubGrid
Foam::XiGModels::basicSubGrid
Description
@ -39,13 +38,14 @@ Description
and the removal:
\f[ - k_{1} /frac{\vert \dwea{\vec{U}} \vert}{L_{sub}}
\frac{\Xi_{sub}-1}{\Xi_{sub}} \f]
\f[
- k_{1} /frac{\vert \dwea{\vec{U}} \vert}{L_{sub}}
\frac{\Xi_{sub}-1}{\Xi_{sub}}
\f]
Finally, \f$ G_{sub} \f$ is added to generation rate \f$ G_{in} \f$
due to the turbulence.
SourceFiles
basicSubGrid.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::XiEqModel::SCOPEXiEq
Foam::XiEqModels::SCOPEXiEq
Description
Simple SCOPEXiEq model for XiEq based on SCOPEXiEqs correlation
@ -120,7 +120,6 @@ public:
//- Update properties from given dictionary
virtual bool read(const dictionary& XiEqProperties);
};

View File

@ -87,7 +87,7 @@
forAll(Y, i)
{
Y[i] = Y0[i];
h0 += Y0[i]*specieData[i].Hs(p[i], T0);
h0 += Y0[i]*specieData[i].Hs(p[0], T0);
}
thermo.he() = dimensionedScalar("h", dimEnergy/dimMass, h0);

View File

@ -1,5 +1,8 @@
EXE_INC = \
-I../buoyantBoussinesqSimpleFoam \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \
@ -9,6 +12,8 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lsampling \
-lmeshTools \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \

View File

@ -11,12 +11,18 @@
- fvm::laplacian(alphaEff, T)
==
radiation->ST(rhoCpRef, T)
+ fvOptions(T)
);
TEqn.relax();
fvOptions.constrain(TEqn);
TEqn.solve();
radiation->correct();
fvOptions.correct(T);
rhok = 1.0 - beta*(T - TRef);
}

View File

@ -5,10 +5,14 @@
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
==
fvOptions(U)
);
UEqn.relax();
fvOptions.constrain(UEqn);
if (pimple.momentumPredictor())
{
solve
@ -23,4 +27,6 @@
)*mesh.magSf()
)
);
fvOptions.correct(U);
}

View File

@ -48,8 +48,9 @@ Description
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "pimpleControl.H"
#include "radiationModel.H"
#include "fvIOoptionList.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,6 +62,7 @@ int main(int argc, char *argv[])
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "createIncompressibleRadiationModel.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
#include "CourantNo.H"

View File

@ -1,5 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \
-I$(LIB_SRC)/transportModels \
@ -7,7 +10,9 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-lsampling \
-lmeshTools \
-lfvOptions \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleTransportModels

View File

@ -8,10 +8,17 @@
(
fvm::div(phi, T)
- fvm::laplacian(alphaEff, T)
==
fvOptions(T)
);
TEqn.relax();
fvOptions.constrain(TEqn);
TEqn.solve();
fvOptions.correct(T);
rhok = 1.0 - beta*(T - TRef);
}

View File

@ -4,10 +4,14 @@
(
fvm::div(phi, U)
+ turbulence->divDevReff(U)
==
fvOptions(U)
);
UEqn().relax();
fvOptions.constrain(UEqn());
if (simple.momentumPredictor())
{
solve
@ -22,4 +26,6 @@
)*mesh.magSf()
)
);
fvOptions.correct(U);
}

View File

@ -48,6 +48,7 @@ Description
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "fvIOoptionList.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,6 +60,7 @@ int main(int argc, char *argv[])
#include "createMesh.H"
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H"
simpleControl simple(mesh);

View File

@ -26,21 +26,18 @@ Application
Description
Combination of heatConductionFoam and buoyantFoam for conjugate heat
transfer between a solid region and fluid region. It includes
porous media in the primary fluid region treated explicitly.
transfer between solid regions and fluid regions. Both regions include
the fvOptions framework.
It handles secondary fluid or solid circuits which can be coupled
thermally with the main fluid region. i.e radiators, etc.
The secondary fluid region is
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "rhoThermo.H"
#include "turbulenceModel.H"
#include "fixedGradientFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "regionProperties.H"
#include "compressibleCourantNo.H"
#include "solidRegionDiffNo.H"

View File

@ -30,7 +30,7 @@ Description
Sub-models include:
- turbulence modelling, i.e. laminar, RAS or LES
- run-time selectable finitie volume options, e.g. MRF, explicit porosity
- run-time selectable finite volume options, e.g. MRF, explicit porosity
\*---------------------------------------------------------------------------*/

View File

@ -1,8 +0,0 @@
FieldField<fvsPatchField, scalar>& phibf = phi.boundaryField();
const FieldField<fvPatchField, vector>& Ubf = U.boundaryField();
const FieldField<fvsPatchField, vector>& Sfbf = mesh.Sf().boundaryField();
forAll(phibf, patchI)
{
phibf[patchI] = (Ubf[patchI] & Sfbf[patchI]);
}

View File

@ -1,5 +1,3 @@
#include "resetPhiPatches.H"
volScalarField rAU(1.0/UEqn().A());
surfaceScalarField rAUf("Dp", fvc::interpolate(rAU));
@ -22,6 +20,9 @@ adjustPhi(phiHbyA, U, p_gh);
fvOptions.relativeFlux(phiHbyA);
// Update the phi BCs from U before p BCs are updated
phi.boundaryField() = mesh.Sf().boundaryField() & U.boundaryField();
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{

View File

@ -35,116 +35,6 @@ Description
#include "meshTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void checkConnectedAgglomeration
(
const lduMesh& mesh,
const labelUList& restrict,
const label nCoarse
)
{
if (mesh.lduAddr().size() != restrict.size())
{
FatalErrorIn
(
"checkConnectedAgglomeration(const lduMesh&, const labelList&)"
) << "nCells:" << mesh.lduAddr().size()
<< " agglom:" << restrict.size()
<< abort(FatalError);
}
// Seed (master) for every region
labelList regionToMaster(nCoarse, -1);
labelList master(mesh.lduAddr().size(), -1);
forAll(restrict, cellI)
{
label region = restrict[cellI];
if (regionToMaster[region] == -1)
{
// Set cell to be master for region
//Pout<< "For region " << region
// << " allocating local master " << cellI
// << endl;
regionToMaster[region] = cellI;
master[cellI] = cellI;
}
}
// Now loop and transport master through region
const labelUList& lower = mesh.lduAddr().lowerAddr();
const labelUList& upper = mesh.lduAddr().upperAddr();
while (true)
{
label nChanged = 0;
forAll(lower, faceI)
{
label own = lower[faceI];
label nei = upper[faceI];
if (restrict[own] == restrict[nei])
{
// Region-internal face
if (master[own] != -1)
{
if (master[nei] == -1)
{
master[nei] = master[own];
nChanged++;
}
else if (master[nei] != master[own])
{
FatalErrorIn("checkConnectedAgglomeration(..)")
<< "problem" << abort(FatalError);
}
}
else if (master[nei] != -1)
{
master[own] = master[nei];
nChanged++;
}
}
}
reduce(nChanged, sumOp<label>());
if (nChanged == 0)
{
break;
}
}
// Check that master is set for all cells
boolList singleRegion(nCoarse, true);
label nSet = nCoarse;
forAll(master, cellI)
{
if (master[cellI] == -1)
{
label region = restrict[cellI];
if (singleRegion[region] == true)
{
singleRegion[region] = false;
nSet--;
}
}
}
label totalNCoarse = returnReduce(nCoarse, sumOp<label>());
label totalNVisited = returnReduce(nSet, sumOp<label>());
if (totalNVisited < totalNCoarse)
{
WarningIn("checkConnectedAgglomeration(..)")
<< "out of " << totalNCoarse
<< " agglomerated cells have " << totalNCoarse-totalNVisited
<< " cells that are not a single connected region" << endl;
}
}
// Main program:
int main(int argc, char *argv[])
@ -227,12 +117,28 @@ int main(int argc, char *argv[])
<< " agglomerated size : "
<< returnReduce(coarseSize, sumOp<label>()) << endl;
checkConnectedAgglomeration
labelList newAddr;
label newCoarseSize = 0;
bool ok = GAMGAgglomeration::checkRestriction
(
agglom.meshLevel(level),
newAddr,
newCoarseSize,
agglom.meshLevel(level).lduAddr(),
addr,
coarseSize
);
if (!ok)
{
WarningIn(args.executable())
<< "At level " << level
<< " there are " << coarseSize
<< " agglomerated cells but " << newCoarseSize
<< " disconnected regions" << endl
<< " This means that some agglomerations (coarse cells)"
<< " consist of multiple disconnected regions."
<< endl;
}
forAll(addr, fineI)

View File

@ -116,17 +116,19 @@ int main(int argc, char *argv[])
squareMatrix[2][1] = -43;
squareMatrix[2][2] = 98;
const scalarSquareMatrix squareMatrixCopy = squareMatrix;
Info<< nl << "Square Matrix = " << squareMatrix << endl;
scalarDiagonalMatrix rhs(3, 0);
rhs[0] = 1;
rhs[1] = 2;
rhs[2] = 3;
Info<< "det = " << det(squareMatrixCopy) << endl;
LUsolve(squareMatrix, rhs);
labelList rhs(3, 0);
label sign;
LUDecompose(squareMatrix, rhs, sign);
Info<< "Decomposition = " << squareMatrix << endl;
Info<< "Solution = " << rhs << endl;
Info<< "Pivots = " << rhs << endl;
Info<< "Sign = " << sign << endl;
Info<< "det = " << detDecomposed(squareMatrix, sign) << endl;
}
Info<< "\nEnd\n" << endl;

View File

@ -12,7 +12,7 @@ wmake snappyHexMesh
if [ -d "$CGAL_ARCH_PATH" ]
then
foamyHexMesh/Allwmake
foamyHex2DMesh/Allwmake
foamyQuadMesh/Allwmake
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -1783,7 +1783,7 @@ int main(int argc, char *argv[])
{
extrudeMeshShadowFaces[nShadowFaces] = fz[j];
zoneShadowFlipMap[nShadowFaces] = fz.flipMap()[j];
zoneShadowID[nShadowFaces] = zoneShadowIDs[i];
zoneShadowID[nShadowFaces] = i;
nShadowFaces++;
}
}

View File

@ -26,6 +26,10 @@ License
#include "DelaunayMesh.H"
#include "labelPair.H"
#include "PrintTable.H"
#include "pointIOField.H"
#include "scalarIOField.H"
#include "labelIOField.H"
#include "pointConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -36,14 +40,121 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Triangulation>
Foam::DelaunayMesh<Triangulation>::DelaunayMesh()
Foam::DelaunayMesh<Triangulation>::DelaunayMesh(const Time& runTime)
:
Triangulation(),
vertexCount_(0),
cellCount_(0)
cellCount_(0),
runTime_(runTime)
{}
template<class Triangulation>
Foam::DelaunayMesh<Triangulation>::DelaunayMesh
(
const Time& runTime,
const word& meshName
)
:
Triangulation(),
vertexCount_(0),
cellCount_(0),
runTime_(runTime)
{
pointIOField pts
(
IOobject
(
"points",
runTime.timeName(),
meshName/polyMesh::meshSubDir,
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
);
labelIOField types
(
IOobject
(
"types",
runTime.timeName(),
meshName,
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
);
labelIOField indices
(
IOobject
(
"indices",
runTime.timeName(),
meshName,
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
);
labelIOField processorIndices
(
IOobject
(
"processorIndices",
runTime.timeName(),
meshName,
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
);
if (pts.headerOk())
{
forAll(pts, ptI)
{
Vertex_handle vh = this->insert(toPoint<Point>(pts[ptI]));
if (indices.headerOk())
{
vh->index() = indices[ptI];
vertexCount()++;
}
else
{
vh->index() = getNewVertexIndex();
}
if (processorIndices.headerOk())
{
vh->procIndex() = processorIndices[ptI];
}
else
{
vh->procIndex() = Pstream::myProcNo();
}
if (types.headerOk())
{
vh->type() =
static_cast<Foam::indexedVertexEnum::vertexType>
(
types[ptI]
);
}
else
{
vh->type() = Vb::vtUnassigned;
}
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Triangulation>

View File

@ -43,6 +43,7 @@ SourceFiles
#include "boundBox.H"
#include "indexedVertex.H"
#include "CGALTriangulation3Ddefs.H"
#include "Time.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -82,6 +83,12 @@ public:
FixedList<label, 2>::Hash<>
> labelPairHashSet;
typedef HashTable
<
label,
labelPair,
FixedList<label, 2>::Hash<>
> labelTolabelPairHashTable;
private:
@ -95,6 +102,9 @@ private:
// This allows a unique index to be assigned to each cell.
mutable label cellCount_;
//- Reference to Time
const Time& runTime_;
//- Spatial sort traits to use with a pair of point pointers and an int.
// Taken from a post on the CGAL lists: 2010-01/msg00004.html by
// Sebastien Loriot (Geometry Factory).
@ -159,7 +169,13 @@ public:
// Constructors
//- Construct from components
DelaunayMesh();
explicit DelaunayMesh(const Time& runTime);
DelaunayMesh
(
const Time& runTime,
const word& meshName
);
//- Destructor
@ -168,6 +184,14 @@ public:
// Member Functions
inline const Time& time() const;
inline void timeCheck
(
const string& description,
const bool check = true
) const;
inline label getNewVertexIndex() const;
inline label getNewCellIndex() const;
@ -177,6 +201,7 @@ public:
inline void resetCellCount();
inline label vertexCount() const;
inline label& vertexCount();
inline void resetVertexCount();
@ -209,12 +234,12 @@ public:
//- Create an fvMesh from the triangulation.
// The mesh is not parallel consistent - only used for viewing
autoPtr<fvMesh> createMesh
autoPtr<polyMesh> createMesh
(
const fileName& name,
const Time& runTime,
labelList& vertexMap,
labelList& cellMap
labelTolabelPairHashTable& vertexMap,
labelList& cellMap,
const bool writeDelaunayData = true
) const;
};

View File

@ -36,6 +36,40 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Triangulation>
inline const Foam::Time& Foam::DelaunayMesh<Triangulation>::time() const
{
return runTime_;
}
template<class Triangulation>
void Foam::DelaunayMesh<Triangulation>::timeCheck
(
const string& description,
const bool check
) const
{
if (check)
{
Info<< nl << "--- [ cpuTime "
<< time().elapsedCpuTime() << " s, "
<< "delta " << time().cpuTimeIncrement()<< " s";
if (description != word::null)
{
Info<< ", " << description << " ";
}
else
{
Info<< " ";
}
Info<< "] --- " << endl;
}
}
template<class Triangulation>
inline Foam::label Foam::DelaunayMesh<Triangulation>::getNewVertexIndex() const
{
@ -90,6 +124,12 @@ Foam::label Foam::DelaunayMesh<Triangulation>::vertexCount() const
return vertexCount_;
}
template<class Triangulation>
Foam::label& Foam::DelaunayMesh<Triangulation>::vertexCount()
{
return vertexCount_;
}
template<class Triangulation>
void Foam::DelaunayMesh<Triangulation>::resetVertexCount()

View File

@ -28,6 +28,7 @@ License
#include "pointConversion.H"
#include "wallPolyPatch.H"
#include "processorPolyPatch.H"
#include "labelIOField.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -331,13 +332,13 @@ void Foam::DelaunayMesh<Triangulation>::printVertexInfo(Ostream& os) const
template<class Triangulation>
Foam::autoPtr<Foam::fvMesh>
Foam::autoPtr<Foam::polyMesh>
Foam::DelaunayMesh<Triangulation>::createMesh
(
const fileName& name,
const Time& runTime,
labelList& vertexMap,
labelList& cellMap
labelTolabelPairHashTable& vertexMap,
labelList& cellMap,
const bool writeDelaunayData
) const
{
pointField points(Triangulation::number_of_vertices());
@ -354,12 +355,54 @@ Foam::DelaunayMesh<Triangulation>::createMesh
List<DynamicList<face> > patchFaces(1, DynamicList<face>());
List<DynamicList<label> > patchOwners(1, DynamicList<label>());
vertexMap.setSize(vertexCount(), -1);
vertexMap.resize(vertexCount());
cellMap.setSize(Triangulation::number_of_finite_cells(), -1);
// Calculate pts and a map of point index to location in pts.
label vertI = 0;
labelIOField indices
(
IOobject
(
"indices",
time().timeName(),
name,
time(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Triangulation::number_of_vertices()
);
labelIOField types
(
IOobject
(
"types",
time().timeName(),
name,
time(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Triangulation::number_of_vertices()
);
labelIOField processorIndices
(
IOobject
(
"processorIndices",
time().timeName(),
name,
time(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Triangulation::number_of_vertices()
);
for
(
Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
@ -369,13 +412,20 @@ Foam::DelaunayMesh<Triangulation>::createMesh
{
if (!vit->farPoint())
{
vertexMap[vit->index()] = vertI;
vertexMap(labelPair(vit->index(), vit->procIndex())) = vertI;
points[vertI] = topoint(vit->point());
indices[vertI] = vit->index();
types[vertI] = static_cast<label>(vit->type());
processorIndices[vertI] = vit->procIndex();
vertI++;
}
}
points.setSize(vertI);
indices.setSize(vertI);
types.setSize(vertI);
processorIndices.setSize(vertI);
// Index the cells
label cellI = 0;
@ -391,6 +441,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
(
!cit->hasFarPoint()
&& !Triangulation::is_infinite(cit)
&& cit->real()
)
{
cellMap[cit->cellIndex()] = cellI++;
@ -424,7 +475,12 @@ Foam::DelaunayMesh<Triangulation>::createMesh
label c1I = Cb::ctFar;
bool c1Real = false;
if (!c1->hasFarPoint() && !Triangulation::is_infinite(c1))
if
(
!c1->hasFarPoint()
&& !Triangulation::is_infinite(c1)
&& c1->real()
)
{
c1I = cellMap[c1->cellIndex()];
c1Real = true;
@ -432,7 +488,12 @@ Foam::DelaunayMesh<Triangulation>::createMesh
label c2I = Cb::ctFar;
bool c2Real = false;
if (!c2->hasFarPoint() && !Triangulation::is_infinite(c2))
if
(
!c2->hasFarPoint()
&& !Triangulation::is_infinite(c2)
&& c2->real()
)
{
c2I = cellMap[c2->cellIndex()];
c2Real = true;
@ -451,10 +512,17 @@ Foam::DelaunayMesh<Triangulation>::createMesh
{
verticesOnTriFace[i] = vertexMap
[
labelPair
(
c1->vertex
(
Triangulation::vertex_triple_index(oppositeVertex, i)
)->index()
)->index(),
c1->vertex
(
Triangulation::vertex_triple_index(oppositeVertex, i)
)->procIndex()
)
];
}
@ -524,15 +592,15 @@ Foam::DelaunayMesh<Triangulation>::createMesh
Info<< "Creating mesh" << endl;
autoPtr<fvMesh> meshPtr
autoPtr<polyMesh> meshPtr
(
new fvMesh
new polyMesh
(
IOobject
(
name,
runTime.timeName(),
runTime,
time().timeName(),
time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
@ -565,7 +633,14 @@ Foam::DelaunayMesh<Triangulation>::createMesh
patches.setSize(nValidPatches);
meshPtr().addFvPatches(patches);
meshPtr().addPatches(patches);
if (writeDelaunayData)
{
indices.write();
types.write();
processorIndices.write();
}
Info<< "Mesh created" << endl;

View File

@ -126,9 +126,24 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Triangulation>
Foam::DistributedDelaunayMesh<Triangulation>::DistributedDelaunayMesh()
Foam::DistributedDelaunayMesh<Triangulation>::DistributedDelaunayMesh
(
const Time& runTime
)
:
DelaunayMesh<Triangulation>(),
DelaunayMesh<Triangulation>(runTime),
allBackgroundMeshBounds_()
{}
template<class Triangulation>
Foam::DistributedDelaunayMesh<Triangulation>::DistributedDelaunayMesh
(
const Time& runTime,
const word& meshName
)
:
DelaunayMesh<Triangulation>(runTime, meshName),
allBackgroundMeshBounds_()
{}
@ -254,6 +269,60 @@ void Foam::DistributedDelaunayMesh<Triangulation>::findProcessorBoundaryCells
/Pstream::nProcs()
);
// std::list<Cell_handle> infinite_cells;
// Triangulation::incident_cells
// (
// Triangulation::infinite_vertex(),
// std::back_inserter(infinite_cells)
// );
//
// for
// (
// typename std::list<Cell_handle>::iterator vcit
// = infinite_cells.begin();
// vcit != infinite_cells.end();
// ++vcit
// )
// {
// Cell_handle cit = *vcit;
//
// // Index of infinite vertex in this cell.
// int i = cit->index(Triangulation::infinite_vertex());
//
// Cell_handle c = cit->neighbor(i);
//
// if (c->unassigned())
// {
// c->cellIndex() = this->getNewCellIndex();
//
// if (checkProcBoundaryCell(c, circumsphereOverlaps))
// {
// cellToCheck.insert(c->cellIndex());
// }
// }
// }
//
//
// for
// (
// Finite_cells_iterator cit = Triangulation::finite_cells_begin();
// cit != Triangulation::finite_cells_end();
// ++cit
// )
// {
// if (cit->parallelDualVertex())
// {
// if (cit->unassigned())
// {
// if (checkProcBoundaryCell(cit, circumsphereOverlaps))
// {
// cellToCheck.insert(cit->cellIndex());
// }
// }
// }
// }
for
(
All_cells_iterator cit = Triangulation::all_cells_begin();
@ -315,13 +384,21 @@ void Foam::DistributedDelaunayMesh<Triangulation>::findProcessorBoundaryCells
continue;
}
if
(
checkProcBoundaryCell
(
citNeighbor,
circumsphereOverlaps
);
)
)
{
cellToCheck.insert(citNeighbor->cellIndex());
}
}
cellToCheck.unset(cit->cellIndex());
}
}
}
@ -521,7 +598,6 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
<< originalParallelVertices[vI].procIndex()
<< " " << originalParallelVertices[vI].index() << endl;
}
}
}
}

View File

@ -135,13 +135,25 @@ public:
// Constructors
//- Construct from components
DistributedDelaunayMesh();
explicit DistributedDelaunayMesh(const Time& runTime);
DistributedDelaunayMesh
(
const Time& runTime,
const word& meshName
);
//- Destructor
~DistributedDelaunayMesh();
// Queries
//- Use DelaunayMesh timeCheck function
using DelaunayMesh<Triangulation>::timeCheck;
// Member Functions
//- Build a mapDistribute for the supplied destination processor data

View File

@ -791,10 +791,11 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
(
IOobject
(
fvMesh::defaultRegion,
"backgroundMeshDecomposition",
runTime_.timeName(),
runTime_,
IOobject::MUST_READ
IOobject::MUST_READ,
IOobject::AUTO_WRITE
)
),
meshCutter_

View File

@ -27,7 +27,7 @@ License
#include "cellSizeAndAlignmentControls.H"
#include "pointIOField.H"
#include "scalarIOField.H"
#include "tensorIOField.H"
#include "triadIOField.H"
#include "tetrahedron.H"
#include "plane.H"
#include "transform.H"
@ -38,6 +38,8 @@ License
namespace Foam
{
defineTypeNameAndDebug(cellShapeControlMesh, 0);
word cellShapeControlMesh::meshSubDir = "cellShapeControlMesh";
}
@ -366,9 +368,89 @@ void Foam::cellShapeControlMesh::writeTriangulation()
Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime)
:
DistributedDelaunayMesh<CellSizeDelaunay>
(
runTime,
meshSubDir
),
runTime_(runTime),
defaultCellSize_(0.0)
{}
{
if (this->vertexCount())
{
fvMesh mesh
(
IOobject
(
meshSubDir,
runTime.timeName(),
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
);
if (mesh.nPoints() == this->vertexCount())
{
pointScalarField sizes
(
IOobject
(
"sizes",
runTime.timeName(),
meshSubDir,
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
pointMesh::New(mesh)
);
triadIOField alignments
(
IOobject
(
"alignments",
mesh.time().timeName(),
meshSubDir,
mesh.time(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
)
);
if
(
sizes.size() == this->vertexCount()
&& alignments.size() == this->vertexCount()
)
{
label count = 0;
for
(
Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
++vit
)
{
vit->targetCellSize() = sizes[count];
vit->alignment() = alignments[count];
count++;
}
}
else
{
FatalErrorIn
(
"Foam::cellShapeControlMesh::cellShapeControlMesh"
"(const Time&)"
) << "Cell size point field is not the same size as the "
<< "mesh."
<< abort(FatalError);
}
}
}
}
//Foam::triangulatedMesh::triangulatedMesh
@ -744,9 +826,7 @@ void Foam::cellShapeControlMesh::insertBoundingPoints
void Foam::cellShapeControlMesh::write() const
{
Info<< "Writing cell size and alignment mesh" << endl;
const fileName name("cellSizeAndAlignmentMesh");
Info<< "Writing " << meshSubDir << endl;
// Reindex the cells
label cellCount = 0;
@ -763,17 +843,16 @@ void Foam::cellShapeControlMesh::write() const
}
}
labelList vertexMap;
DelaunayMesh<CellSizeDelaunay>::labelTolabelPairHashTable vertexMap;
labelList cellMap;
autoPtr<fvMesh> meshPtr = DelaunayMesh<CellSizeDelaunay>::createMesh
autoPtr<polyMesh> meshPtr = DelaunayMesh<CellSizeDelaunay>::createMesh
(
name,
runTime_,
meshSubDir,
vertexMap,
cellMap
);
const fvMesh& mesh = meshPtr();
const polyMesh& mesh = meshPtr();
pointScalarField sizes
(
@ -781,7 +860,8 @@ void Foam::cellShapeControlMesh::write() const
(
"sizes",
mesh.time().timeName(),
mesh,
meshSubDir,
mesh.time(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
@ -789,7 +869,22 @@ void Foam::cellShapeControlMesh::write() const
scalar(0)
);
OFstream str(runTime_.path()/"alignments.obj");
triadIOField alignments
(
IOobject
(
"alignments",
mesh.time().timeName(),
meshSubDir,
mesh.time(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sizes.size()
);
// Write alignments
// OFstream str(runTime_.path()/"alignments.obj");
for
(
@ -801,35 +896,41 @@ void Foam::cellShapeControlMesh::write() const
if (!vit->farPoint())
{
// Populate sizes
sizes[vertexMap[vit->index()]] = vit->targetCellSize();
sizes[vertexMap[labelPair(vit->index(), vit->procIndex())]] =
vit->targetCellSize();
// Write alignments
const tensor& alignment = vit->alignment();
pointFromPoint pt = topoint(vit->point());
alignments[vertexMap[labelPair(vit->index(), vit->procIndex())]] =
vit->alignment();
if
(
alignment.x() == triad::unset[0]
|| alignment.y() == triad::unset[0]
|| alignment.z() == triad::unset[0]
)
{
Info<< "Bad alignment = " << vit->info();
vit->alignment() = tensor::I;
Info<< "New alignment = " << vit->info();
continue;
}
meshTools::writeOBJ(str, pt, alignment.x() + pt);
meshTools::writeOBJ(str, pt, alignment.y() + pt);
meshTools::writeOBJ(str, pt, alignment.z() + pt);
// // Write alignments
// const tensor& alignment = vit->alignment();
// pointFromPoint pt = topoint(vit->point());
//
// if
// (
// alignment.x() == triad::unset[0]
// || alignment.y() == triad::unset[0]
// || alignment.z() == triad::unset[0]
// )
// {
// Info<< "Bad alignment = " << vit->info();
//
// vit->alignment() = tensor::I;
//
// Info<< "New alignment = " << vit->info();
//
// continue;
// }
//
// meshTools::writeOBJ(str, pt, alignment.x() + pt);
// meshTools::writeOBJ(str, pt, alignment.y() + pt);
// meshTools::writeOBJ(str, pt, alignment.z() + pt);
}
}
mesh.write();
sizes.write();
alignments.write();
}

View File

@ -95,6 +95,9 @@ public:
//- Runtime type information
ClassName("cellShapeControlMesh");
//- Return the mesh sub-directory name (usually "cellShapeControlMesh")
static word meshSubDir;
// Constructors

View File

@ -223,6 +223,13 @@ void Foam::controlMeshRefinement::initialMeshPopulation
const autoPtr<backgroundMeshDecomposition>& decomposition
)
{
if (shapeController_.shapeControlMesh().vertexCount() > 0)
{
// Mesh already populated.
Info<< "Cell size and alignment mesh already populated." << endl;
return;
}
autoPtr<boundBox> overallBoundBox;
// Need to pass in the background mesh decomposition so that can test if
@ -268,7 +275,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
controlFunction.initialVertices(pts, sizes, alignments);
Info<< " Got initial vertices list" << endl;
Info<< " Got initial vertices list of size " << pts.size() << endl;
List<Vb> vertices(pts.size());

View File

@ -194,12 +194,24 @@ void Foam::conformalVoronoiMesh::insertPoints
}
}
label preReinsertionSize(number_of_vertices());
rangeInsertWithInfo
(
vertices.begin(),
vertices.end(),
true
false
);
const label nReinserted = returnReduce
(
label(number_of_vertices()) - preReinsertionSize,
sumOp<label>()
);
Info<< " Reinserted " << nReinserted << " vertices out of "
<< returnReduce(vertices.size(), sumOp<label>())
<< endl;
}
@ -787,8 +799,8 @@ Foam::face Foam::conformalVoronoiMesh::buildDualFace
<< "Dual face uses circumcenter defined by a "
<< "Delaunay tetrahedron with no internal "
<< "or boundary points. Defining Delaunay edge ends: "
<< topoint(vA->point()) << " "
<< topoint(vB->point()) << nl
<< vA->info() << " "
<< vB->info() << nl
<< exit(FatalError);
}
@ -969,7 +981,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
const dictionary& foamyHexMeshDict
)
:
DistributedDelaunayMesh<Delaunay>(),
DistributedDelaunayMesh<Delaunay>(runTime),
runTime_(runTime),
rndGen_(64293*Pstream::myProcNo()),
foamyHexMeshControls_(foamyHexMeshDict),
@ -1034,6 +1046,18 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
)
),
decomposition_()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::conformalVoronoiMesh::~conformalVoronoiMesh()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::conformalVoronoiMesh::initialiseForMotion()
{
if (foamyHexMeshControls().objOutput())
{
@ -1049,7 +1073,10 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
runTime_,
rndGen_,
geometryToConformTo_,
foamyHexMeshDict.subDict("backgroundMeshDecomposition")
foamyHexMeshControls().foamyHexMeshDict().subDict
(
"backgroundMeshDecomposition"
)
)
);
}
@ -1108,18 +1135,56 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
Foam::indexedVertexEnum::vtExternalFeaturePoint
);
}
//writeFixedPoints("fixedPointsStart.obj");
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
void Foam::conformalVoronoiMesh::initialiseForConformation()
{
if (Pstream::parRun())
{
decomposition_.reset
(
new backgroundMeshDecomposition
(
runTime_,
rndGen_,
geometryToConformTo_,
foamyHexMeshControls().foamyHexMeshDict().subDict
(
"backgroundMeshDecomposition"
)
)
);
}
Foam::conformalVoronoiMesh::~conformalVoronoiMesh()
{}
insertInitialPoints();
insertFeaturePoints();
// Improve the guess that the backgroundMeshDecomposition makes with the
// initial positions. Use before building the surface conformation to
// better balance the surface conformation load.
distributeBackground(*this);
buildSurfaceConformation();
// The introduction of the surface conformation may have distorted the
// balance of vertices, distribute if necessary.
distributeBackground(*this);
if (Pstream::parRun())
{
sync(decomposition_().procBounds());
}
cellSizeMeshOverlapsBackground();
if (foamyHexMeshControls().printVertexInfo())
{
printVertexInfo(Info);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::conformalVoronoiMesh::move()
{
@ -1630,6 +1695,8 @@ void Foam::conformalVoronoiMesh::move()
);
}
DynamicList<Vertex_handle> pointsToRemove;
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
@ -1640,15 +1707,18 @@ void Foam::conformalVoronoiMesh::move()
if
(
(vit->internalPoint() || vit->internalBoundaryPoint())
&& !vit->referred()
//&& !vit->referred()
)
{
bool inside = geometryToConformTo_.inside
(
topoint(vit->point())
);
const Foam::point& pt = topoint(vit->point());
if (!inside)
bool inside = geometryToConformTo_.inside(pt);
if
(
!inside
|| !geometryToConformTo_.globalBounds().contains(pt)
)
{
if
(
@ -1658,13 +1728,16 @@ void Foam::conformalVoronoiMesh::move()
{
str().write(topoint(vit->point()));
}
remove(vit);
pointsToRemove.append(vit);
internalPtIsOutside++;
}
}
}
Info<< " " << internalPtIsOutside
remove(pointsToRemove.begin(), pointsToRemove.end());
Info<< " " << returnReduce(internalPtIsOutside, sumOp<label>())
<< " internal points were inserted outside the domain. "
<< "They have been removed." << endl;
}
@ -1739,32 +1812,6 @@ void Foam::conformalVoronoiMesh::move()
if (time().outputTime())
{
writeMesh(time().timeName());
// label cellI = 0;
// for
// (
// Finite_cells_iterator cit = finite_cells_begin();
// cit != finite_cells_end();
// ++cit
// )
// {
// if
// (
// !cit->hasFarPoint()
// && !is_infinite(cit)
// )
// {
// cit->cellIndex() = cellI++;
// }
// }
//
// labelList vertexMap;
// labelList cellMap;
// autoPtr<fvMesh> tetMesh =
// createMesh("tetMesh", runTime_, vertexMap, cellMap);
//
// tetMesh().write();
//writeFixedPoints("fixedPointsStart_" + runTime_.timeName() + ".obj");
}
updateSizesAndAlignments(pointsToInsert);

View File

@ -317,7 +317,7 @@ private:
void insertPoints
(
List<Vb>& vertices,
bool distribute = true
bool distribute
);
//- Create a point-pair at a ppDist distance either side of
@ -734,7 +734,8 @@ private:
//- edge conformation location
bool nearFeatureEdgeLocation
(
pointIndexHit& pHit
const pointIndexHit& pHit,
pointIndexHit& nearestEdgeHit
) const;
//- Build or rebuild the edge location tree
@ -764,6 +765,7 @@ private:
pointIndexHitAndFeatureDynList& featureEdgeHits,
DynamicList<label>& surfaceToTreeShape,
DynamicList<label>& edgeToTreeShape,
Map<scalar>& surfacePtToEdgePtDist,
bool firstPass
) const;
@ -1037,6 +1039,10 @@ public:
// Member Functions
void initialiseForMotion();
void initialiseForConformation();
//- Move the vertices according to the controller, re-conforming to the
// surface as required
void move();

View File

@ -1787,6 +1787,11 @@ void Foam::conformalVoronoiMesh::indexDualVertices
}
}
OBJstream snapping1("snapToSurface1.obj");
OBJstream snapping2("snapToSurface2.obj");
OFstream tetToSnapTo("tetsToSnapTo.obj");
label offset = 0;
for
(
Delaunay::Finite_cells_iterator cit = finite_cells_begin();
@ -1892,6 +1897,88 @@ void Foam::conformalVoronoiMesh::indexDualVertices
}
}
// {
// // Snapping points far outside
// if (cit->boundaryDualVertex() && !cit->parallelDualVertex())
// {
// pointFromPoint dual = cit->dual();
//
// pointIndexHit hitInfo;
// label surfHit;
//
// // Find nearest surface point
// geometryToConformTo_.findSurfaceNearest
// (
// dual,
// sqr(targetCellSize(dual)),
// hitInfo,
// surfHit
// );
//
// if (!hitInfo.hit())
// {
// // Project dual to nearest point on tet
//
// tetPointRef tet
// (
// topoint(cit->vertex(0)->point()),
// topoint(cit->vertex(1)->point()),
// topoint(cit->vertex(2)->point()),
// topoint(cit->vertex(3)->point())
// );
//
// pointFromPoint nearestPointOnTet =
// tet.nearestPoint(dual).rawPoint();
//
// // Get nearest point on surface from tet.
// geometryToConformTo_.findSurfaceNearest
// (
// nearestPointOnTet,
// sqr(targetCellSize(nearestPointOnTet)),
// hitInfo,
// surfHit
// );
//
// vector snapDir = nearestPointOnTet - dual;
// snapDir /= mag(snapDir) + SMALL;
//
// drawDelaunayCell(tetToSnapTo, cit, offset);
// offset += 1;
//
// vectorField norm(1);
// allGeometry_[surfHit].getNormal
// (
// List<pointIndexHit>(1, hitInfo),
// norm
// );
// norm[0] /= mag(norm[0]) + SMALL;
//
// if
// (
// hitInfo.hit()
// && (mag(snapDir & norm[0]) > 0.5)
// )
// {
// snapping1.write
// (
// linePointRef(dual, nearestPointOnTet)
// );
//
// snapping2.write
// (
// linePointRef
// (
// nearestPointOnTet,
// hitInfo.hitPoint()
// )
// );
//
// pts[cit->cellIndex()] = hitInfo.hitPoint();
// }
// }
// }
// }
if (cit->boundaryDualVertex())
{
if (cit->featureEdgeDualVertex())
@ -2458,6 +2545,54 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|| (vB->internalOrBoundaryPoint() && !vB->referred())
)
{
if
(
(vA->internalPoint() && vB->externalBoundaryPoint())
|| (vB->internalPoint() && vA->externalBoundaryPoint())
)
{
Cell_circulator ccStart = incident_cells(*eit);
Cell_circulator cc1 = ccStart;
Cell_circulator cc2 = cc1;
cc2++;
bool skipEdge = false;
do
{
if
(
cc1->hasFarPoint() || cc2->hasFarPoint()
|| is_infinite(cc1) || is_infinite(cc2)
)
{
Pout<< "Ignoring edge between internal and external: "
<< vA->info()
<< vB->info();
skipEdge = true;
break;
}
cc1++;
cc2++;
} while (cc1 != ccStart);
// Do not create faces if the internal point is outside!
// This occurs because the internal point is not determined to
// be outside in the inside/outside test. This is most likely
// due to the triangle.nearestPointClassify test not returning
// edge/point as the nearest type.
if (skipEdge)
{
continue;
}
}
face newDualFace = buildDualFace(eit);
if (newDualFace.size() >= 3)
@ -2673,7 +2808,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
patchPointPairSlaves[patchI].transfer(patchPPSlaves[patchI]);
}
// if (foamyHexMeshControls().objOutput())
if (foamyHexMeshControls().objOutput())
{
Info<< "Writing processor interfaces" << endl;

View File

@ -298,6 +298,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
DynamicList<label> edgeToTreeShape(AtoV/4);
DynamicList<label> surfaceToTreeShape(AtoV);
Map<scalar> surfacePtToEdgePtDist(AtoV/4);
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
@ -332,6 +334,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
featureEdgeHits,
surfaceToTreeShape,
edgeToTreeShape,
surfacePtToEdgePtDist,
true
);
}
@ -463,6 +466,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
DynamicList<label> surfaceToTreeShape(AtoV/2);
DynamicList<label> edgeToTreeShape(AtoV/4);
Map<scalar> surfacePtToEdgePtDist;
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
@ -507,6 +512,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
featureEdgeHits,
surfaceToTreeShape,
edgeToTreeShape,
surfacePtToEdgePtDist,
false
);
}
@ -552,6 +558,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
featureEdgeHits,
surfaceToTreeShape,
edgeToTreeShape,
surfacePtToEdgePtDist,
false
);
}
@ -569,7 +576,20 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
Vertex_handle vA = c->vertex(eit->second);
Vertex_handle vB = c->vertex(eit->third);
if (vA->referred() || vB->referred())
if
(
vA->referred()
|| vB->referred()
)
{
continue;
}
if
(
(vA->internalPoint() && vA->referred())
|| (vB->internalPoint() && vB->referred())
)
{
continue;
}
@ -617,6 +637,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
featureEdgeHits,
surfaceToTreeShape,
edgeToTreeShape,
surfacePtToEdgePtDist,
false
);
}
@ -1907,14 +1928,16 @@ bool Foam::conformalVoronoiMesh::pointIsNearSurfaceLocation
bool Foam::conformalVoronoiMesh::nearFeatureEdgeLocation
(
pointIndexHit& pHit
const pointIndexHit& pHit,
pointIndexHit& nearestEdgeHit
) const
{
Foam::point pt = pHit.hitPoint();
const Foam::point& pt = pHit.hitPoint();
const scalar exclusionRangeSqr = featureEdgeExclusionDistanceSqr(pt);
bool closeToFeatureEdge = pointIsNearFeatureEdgeLocation(pt);
bool closeToFeatureEdge =
pointIsNearFeatureEdgeLocation(pt, nearestEdgeHit);
if (closeToFeatureEdge)
{
@ -1957,15 +1980,11 @@ bool Foam::conformalVoronoiMesh::nearFeatureEdgeLocation
if
(
mag(cosAngle) < searchConeAngle
&& (
mag(lineBetweenPoints)
> foamyHexMeshControls().pointPairDistanceCoeff()
*targetCellSize(pt)
)
&& (mag(lineBetweenPoints) > pointPairDistance(pt))
)
{
pt = edgeHit.hitPoint();
pHit.setPoint(pt);
//pt = edgeHit.hitPoint();
//pHit.setPoint(pt);
closeToFeatureEdge = false;
}
else
@ -2076,6 +2095,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
pointIndexHitAndFeatureDynList& featureEdgeHits,
DynamicList<label>& surfaceToTreeShape,
DynamicList<label>& edgeToTreeShape,
Map<scalar>& surfacePtToEdgePtDist,
bool firstPass
) const
{
@ -2161,12 +2181,12 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
if
(
!pointIsNearFeatureEdgeLocation
(
edPt,
nearestEdgeHit
)
// !nearFeatureEdgeLocation(edHit)
// !pointIsNearFeatureEdgeLocation
// (
// edPt,
// nearestEdgeHit
// )
!nearFeatureEdgeLocation(edHit, nearestEdgeHit)
)
{
appendToEdgeLocationTree(edPt);
@ -2182,55 +2202,47 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
(
pointIndexHitAndFeature(edHit, featureHit)
);
// Info<< "Add " << existingEdgeLocations_.size() - 1
// << " " << magSqr(edPt - surfPt) << endl;
surfacePtToEdgePtDist.insert
(
existingEdgeLocations_.size() - 1,
magSqr(edPt - surfPt)
);
}
else if (firstPass)
{
label hitIndex = nearestEdgeHit.index();
// Info<< "Close to " << nearestEdgeHit << endl;
if
(
magSqr(edPt - surfPt)
< surfacePtToEdgePtDist[hitIndex]
)
{
featureEdgeHits[hitIndex] =
pointIndexHitAndFeature(edHit, featureHit);
existingEdgeLocations_[hitIndex] =
edHit.hitPoint();
surfacePtToEdgePtDist[hitIndex] =
magSqr(edPt - surfPt);
// Change edge location in featureEdgeHits
// remove index from edge tree
// reinsert new point into tree
edgeLocationTreePtr_().remove(hitIndex);
edgeLocationTreePtr_().insert
(
hitIndex,
hitIndex + 1
);
}
}
// else if (firstPass)
// {
// label hitIndex = nearestEdgeHit.index();
//
// // Calc new edge location
//// Foam::point newPt =
//// 0.5
//// *(
//// nearestEdgeHit.hitPoint()
//// + edHit.hitPoint()
//// );
//
// pointIndexHit pHitOld =
// edgeLocationTreePtr_().findNearest
// (
// nearestEdgeHit.hitPoint(), GREAT
// );
//
// pointIndexHit pHitNew =
// edgeLocationTreePtr_().findNearest
// (
// edHit.hitPoint(), GREAT
// );
//
// if
// (
// pHitNew.hitPoint() - pHitOld.hitPoint()
// )
// {
// edHit.setPoint(pHit.hitPoint());
//
// featureEdgeHits[hitIndex] =
// pointIndexHitAndFeature(edHit, featureHit);
//
// existingEdgeLocations_[hitIndex] =
// edHit.hitPoint();
//
// // Change edge location in featureEdgeHits
// // remove index from edge tree
// // reinsert new point into tree
// edgeLocationTreePtr_().remove(hitIndex);
// edgeLocationTreePtr_().insert
// (
// hitIndex,
// hitIndex + 1
// );
// }
// }
}
}
}

View File

@ -873,17 +873,7 @@ void Foam::conformalVoronoiMesh::reinsertFeaturePoints(bool distribute)
{
Info<< nl << "Reinserting stored feature points" << endl;
label preReinsertionSize(number_of_vertices());
insertPoints(featureVertices_, distribute);
const label nReinserted = returnReduce
(
label(number_of_vertices()) - preReinsertionSize,
sumOp<label>()
);
Info<< " Reinserted " << nReinserted << " vertices" << endl;
}
@ -1458,8 +1448,6 @@ void Foam::conformalVoronoiMesh::createFeaturePoints(DynamicList<Vb>& pts)
forAll(feMeshes, i)
{
Info<< indent << "Edge mesh = " << feMeshes[i].name() << nl << endl;
const extendedFeatureEdgeMesh& feMesh(feMeshes[i]);
for

View File

@ -337,11 +337,10 @@ inline void Foam::conformalVoronoiMesh::createPointPair
const Foam::point internalPt = surfPt - ppDistn;
const Foam::point externalPt = surfPt + ppDistn;
if
(
geometryToConformTo_.inside(internalPt)
&& geometryToConformTo_.outside(externalPt)
)
bool internalInside = geometryToConformTo_.inside(internalPt);
bool externalOutside = geometryToConformTo_.outside(externalPt);
if (internalInside && externalOutside)
{
pts.append
(
@ -369,11 +368,8 @@ inline void Foam::conformalVoronoiMesh::createPointPair
{
Info<< "Warning: point pair not inside/outside" << nl
<< " surfPt = " << surfPt << nl
<< " internal = "
<< internalPt << " " << geometryToConformTo_.inside(internalPt)
<< nl
<< " external = "
<< externalPt << " " << geometryToConformTo_.outside(externalPt)
<< " internal = " << internalPt << " " << internalInside << nl
<< " external = " << externalPt << " " << externalOutside
<< endl;
}
}

View File

@ -101,7 +101,9 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell
// Supply offset as tet number
offset *= 4;
os << "# cell index: " << label(c->cellIndex()) << endl;
os << "# cell index: " << label(c->cellIndex())
<< " INT_MIN = " << INT_MIN
<< endl;
os << "# circumradius "
<< mag(c->dual() - topoint(c->vertex(0)->point()))
@ -112,7 +114,15 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell
os << "# index / type / procIndex: "
<< label(c->vertex(i)->index()) << " "
<< label(c->vertex(i)->type()) << " "
<< label(c->vertex(i)->procIndex()) << endl;
<< label(c->vertex(i)->procIndex())
<< (is_infinite(c->vertex(i)) ? " # This vertex is infinite!" : "")
<<
(
c->vertex(i)->uninitialised()
? " # This vertex is uninitialised!"
: ""
)
<< endl;
meshTools::writeOBJ(os, topoint(c->vertex(i)->point()));
}
@ -411,202 +421,247 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
}
}
if (foamyHexMeshControls().writeCellShapeControlMesh())
{
cellShapeControls().shapeControlMesh().write();
}
if (foamyHexMeshControls().writeBackgroundMeshDecomposition())
{
Info<< nl << "Writing " << "backgroundMeshDecomposition" << endl;
// Have to explicitly update the mesh instance.
const_cast<fvMesh&>(decomposition_().mesh()).setInstance
(
time().timeName()
);
decomposition_().mesh().write();
}
if (foamyHexMeshControls().writeTetDualMesh())
{
// Determine map from Delaunay vertex to Dual mesh
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// From all Delaunay vertices to cell (positive index)
// or patch face (negative index)
labelList vertexToDualAddressing(number_of_vertices(), 0);
forAll(cellToDelaunayVertex, cellI)
{
label vertI = cellToDelaunayVertex[cellI];
if (vertexToDualAddressing[vertI] != 0)
{
FatalErrorIn("conformalVoronoiMesh::writeMesh(..)")
<< "Delaunay vertex " << vertI
<< " from cell " << cellI
<< " is already mapped to "
<< vertexToDualAddressing[vertI]
<< exit(FatalError);
}
vertexToDualAddressing[vertI] = cellI+1;
}
forAll(patchToDelaunayVertex, patchI)
{
const labelList& patchVertices = patchToDelaunayVertex[patchI];
forAll(patchVertices, i)
{
label vertI = patchVertices[i];
if (vertexToDualAddressing[vertI] > 0)
{
FatalErrorIn("conformalVoronoiMesh::writeMesh(..)")
<< "Delaunay vertex " << vertI
<< " from patch " << patchI
<< " local index " << i
<< " is already mapped to cell "
<< vertexToDualAddressing[vertI]-1
<< exit(FatalError);
}
// Vertex might be used by multiple faces. Which one to
// use? For now last one wins.
label dualFaceI = dualPatchStarts[patchI]+i;
vertexToDualAddressing[vertI] = -dualFaceI-1;
}
}
// Calculate tet mesh addressing
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pointField points;
labelList boundaryPts(number_of_finite_cells(), -1);
// From tet point back to Delaunay vertex index
labelList pointToDelaunayVertex;
faceList faces;
labelList owner;
labelList neighbour;
wordList patchTypes;
wordList patchNames;
PtrList<dictionary> patchDicts;
pointField cellCentres;
calcTetMesh
label cellI = 0;
for
(
points,
pointToDelaunayVertex,
faces,
owner,
neighbour,
patchTypes,
patchNames,
patchDicts
);
// Calculate map from tet points to dual mesh cells/patch faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelIOList pointDualAddressing
(
IOobject
(
"pointDualAddressing",
instance,
"tetDualMesh"/polyMesh::meshSubDir,
runTime_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
UIndirectList<label>
(
vertexToDualAddressing,
pointToDelaunayVertex
)()
);
label pointI = findIndex(pointDualAddressing, -1);
if (pointI != -1)
{
WarningIn
(
"conformalVoronoiMesh::writeMesh\n"
"(\n"
" const fileName& instance,\n"
" bool filterFaces\n"
")\n"
) << "Delaunay vertex " << pointI
<< " does not have a corresponding dual cell." << endl;
}
Info<< "Writing map from tetDualMesh points to Voronoi mesh to "
<< pointDualAddressing.objectPath() << endl;
pointDualAddressing.write();
// Write tet points corresponding to the Voronoi cell/face centre
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
// Read Voronoi mesh
fvMesh mesh
(
IOobject
(
Foam::polyMesh::defaultRegion,
instance,
runTime_,
IOobject::MUST_READ
Finite_cells_iterator cit = finite_cells_begin();
cit != finite_cells_end();
++cit
)
);
pointIOField dualPoints
{
if
(
IOobject
(
"dualPoints",
instance,
"tetDualMesh"/polyMesh::meshSubDir,
runTime_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
points
);
forAll(pointDualAddressing, pointI)
!cit->hasFarPoint()
&& !is_infinite(cit)
)
{
label index = pointDualAddressing[pointI];
if (index > 0)
{
label cellI = index-1;
dualPoints[pointI] = mesh.cellCentres()[cellI];
}
else if (index < 0)
{
label faceI = -index-1;
if (faceI >= mesh.nInternalFaces())
{
dualPoints[pointI] = mesh.faceCentres()[faceI];
}
cit->cellIndex() = cellI++;
}
}
Info<< "Writing new tetDualMesh points mapped onto Voronoi mesh to "
<< dualPoints.objectPath() << endl
<< "Replace the polyMesh/points with these." << endl;
dualPoints.write();
}
Info<< nl << "Writing " << "tetDualMesh" << endl;
DistributedDelaunayMesh<Delaunay>::labelTolabelPairHashTable vertexMap;
labelList cellMap;
autoPtr<polyMesh> tetMesh =
createMesh("tetDualMesh", vertexMap, cellMap);
Info<< nl << "Writing tetDualMesh to " << instance << endl;
tetMesh().write();
PackedBoolList boundaryFacesToRemove;
writeMesh
(
"tetDualMesh",
instance,
points,
boundaryPts,
faces,
owner,
neighbour,
patchTypes,
patchNames,
patchDicts,
cellCentres,
boundaryFacesToRemove
);
// // Determine map from Delaunay vertex to Dual mesh
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// // From all Delaunay vertices to cell (positive index)
// // or patch face (negative index)
// labelList vertexToDualAddressing(number_of_vertices(), 0);
//
// forAll(cellToDelaunayVertex, cellI)
// {
// label vertI = cellToDelaunayVertex[cellI];
//
// if (vertexToDualAddressing[vertI] != 0)
// {
// FatalErrorIn("conformalVoronoiMesh::writeMesh(..)")
// << "Delaunay vertex " << vertI
// << " from cell " << cellI
// << " is already mapped to "
// << vertexToDualAddressing[vertI]
// << exit(FatalError);
// }
// vertexToDualAddressing[vertI] = cellI+1;
// }
//
// forAll(patchToDelaunayVertex, patchI)
// {
// const labelList& patchVertices = patchToDelaunayVertex[patchI];
//
// forAll(patchVertices, i)
// {
// label vertI = patchVertices[i];
//
// if (vertexToDualAddressing[vertI] > 0)
// {
// FatalErrorIn("conformalVoronoiMesh::writeMesh(..)")
// << "Delaunay vertex " << vertI
// << " from patch " << patchI
// << " local index " << i
// << " is already mapped to cell "
// << vertexToDualAddressing[vertI]-1
// << exit(FatalError);
// }
//
// // Vertex might be used by multiple faces. Which one to
// // use? For now last one wins.
// label dualFaceI = dualPatchStarts[patchI]+i;
// vertexToDualAddressing[vertI] = -dualFaceI-1;
// }
// }
//
//
// // Calculate tet mesh addressing
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// pointField points;
// labelList boundaryPts(number_of_finite_cells(), -1);
// // From tet point back to Delaunay vertex index
// labelList pointToDelaunayVertex;
// faceList faces;
// labelList owner;
// labelList neighbour;
// wordList patchTypes;
// wordList patchNames;
// PtrList<dictionary> patchDicts;
// pointField cellCentres;
//
// calcTetMesh
// (
// points,
// pointToDelaunayVertex,
// faces,
// owner,
// neighbour,
// patchTypes,
// patchNames,
// patchDicts
// );
//
//
//
// // Calculate map from tet points to dual mesh cells/patch faces
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// labelIOList pointDualAddressing
// (
// IOobject
// (
// "pointDualAddressing",
// instance,
// "tetDualMesh"/polyMesh::meshSubDir,
// runTime_,
// IOobject::NO_READ,
// IOobject::AUTO_WRITE,
// false
// ),
// UIndirectList<label>
// (
// vertexToDualAddressing,
// pointToDelaunayVertex
// )()
// );
//
// label pointI = findIndex(pointDualAddressing, -1);
// if (pointI != -1)
// {
// WarningIn
// (
// "conformalVoronoiMesh::writeMesh\n"
// "(\n"
// " const fileName& instance,\n"
// " bool filterFaces\n"
// ")\n"
// ) << "Delaunay vertex " << pointI
// << " does not have a corresponding dual cell." << endl;
// }
//
// Info<< "Writing map from tetDualMesh points to Voronoi mesh to "
// << pointDualAddressing.objectPath() << endl;
// pointDualAddressing.write();
//
//
//
// // Write tet points corresponding to the Voronoi cell/face centre
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// {
// // Read Voronoi mesh
// fvMesh mesh
// (
// IOobject
// (
// Foam::polyMesh::defaultRegion,
// instance,
// runTime_,
// IOobject::MUST_READ
// )
// );
// pointIOField dualPoints
// (
// IOobject
// (
// "dualPoints",
// instance,
// "tetDualMesh"/polyMesh::meshSubDir,
// runTime_,
// IOobject::NO_READ,
// IOobject::AUTO_WRITE,
// false
// ),
// points
// );
//
// forAll(pointDualAddressing, pointI)
// {
// label index = pointDualAddressing[pointI];
//
// if (index > 0)
// {
// label cellI = index-1;
// dualPoints[pointI] = mesh.cellCentres()[cellI];
// }
// else if (index < 0)
// {
// label faceI = -index-1;
// if (faceI >= mesh.nInternalFaces())
// {
// dualPoints[pointI] = mesh.faceCentres()[faceI];
// }
// }
// }
//
// Info<< "Writing tetDualMesh points mapped onto Voronoi mesh to "
// << dualPoints.objectPath() << endl
// << "Replace the polyMesh/points with these." << endl;
// dualPoints.write();
// }
//
//
// Info<< nl << "Writing tetDualMesh to " << instance << endl;
//
// PackedBoolList boundaryFacesToRemove;
// writeMesh
// (
// "tetDualMesh",
// instance,
// points,
// boundaryPts,
// faces,
// owner,
// neighbour,
// patchTypes,
// patchNames,
// patchDicts,
// cellCentres,
// boundaryFacesToRemove
// );
}
}

View File

@ -113,13 +113,12 @@ Foam::Ostream& Foam::operator<<
const CGAL::indexedVertex<Gt, Vb>& p
)
{
os << p.point()
<< p.index()
<< static_cast<int>(p.type())
<< p.procIndex()
<< p.alignment()
<< p.targetCellSize()
<< token::SPACE
os << p.point() << ' '
<< p.index() << ' '
<< static_cast<int>(p.type()) << ' '
<< p.procIndex() << ' '
<< p.alignment() << ' '
<< p.targetCellSize() << ' '
<< static_cast<int>(p.fixed());
return os;

View File

@ -706,8 +706,8 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInside
// Info<< surface.name() << " = "
// << volumeType::names[surfaceVolumeTests[s][i]] << endl;
//if (surfaceVolumeTests[s][i] == volumeType::OUTSIDE)
if (surfaceVolumeTests[s][i] != volumeType::INSIDE)
if (surfaceVolumeTests[s][i] == volumeType::OUTSIDE)
// if (surfaceVolumeTests[s][i] != volumeType::INSIDE)
{
insidePoint[i] = false;

View File

@ -247,6 +247,20 @@ Foam::cvControls::cvControls
}
writeTetDualMesh_ = Switch(filteringDict.lookup("writeTetDualMesh"));
writeCellShapeControlMesh_ =
Switch(filteringDict.lookup("writeCellShapeControlMesh"));
if (Pstream::parRun())
{
writeBackgroundMeshDecomposition_ =
Switch(filteringDict.lookup("writeBackgroundMeshDecomposition"));
}
else
{
writeBackgroundMeshDecomposition_ = Switch(false);
}
}

View File

@ -202,6 +202,10 @@ class cvControls
//- Write tet mesh at output time (it always writes the Voronoi)
Switch writeTetDualMesh_;
Switch writeCellShapeControlMesh_;
Switch writeBackgroundMeshDecomposition_;
// Private Member Functions
@ -335,6 +339,12 @@ public:
//- Write tetMesh at output time
inline Switch writeTetDualMesh() const;
//- Write cellShapeControlMesh at output time
inline Switch writeCellShapeControlMesh() const;
//- Write backgroundMeshDecomposition at output time
inline Switch writeBackgroundMeshDecomposition() const;
};

View File

@ -215,5 +215,15 @@ inline Foam::Switch Foam::cvControls::writeTetDualMesh() const
return writeTetDualMesh_;
}
inline Foam::Switch Foam::cvControls::writeCellShapeControlMesh() const
{
return writeCellShapeControlMesh_;
}
inline Foam::Switch Foam::cvControls::writeBackgroundMeshDecomposition() const
{
return writeBackgroundMeshDecomposition_;
}
// ************************************************************************* //

View File

@ -58,7 +58,7 @@ List<Vb::Point> pointFile::initialPoints() const
IOobject
(
pointFileName_.name(),
foamyHexMesh_.time().constant(),
foamyHexMesh_.time().timeName(),
foamyHexMesh_.time(),
IOobject::MUST_READ,
IOobject::NO_WRITE

View File

@ -45,18 +45,28 @@ int main(int argc, char *argv[])
"check all surface geometry for quality"
);
Foam::argList::addBoolOption
(
"conformationOnly",
"conform to the initial points without any point motion"
);
#include "addOverwriteOption.H"
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
const bool checkGeometry = args.optionFound("checkGeometry");
const bool conformationOnly = args.optionFound("conformationOnly");
const bool overwrite = args.optionFound("overwrite");
IOdictionary foamyHexMeshDict
(
IOobject
(
"foamyHexMeshDict",
args.executable() + "Dict",
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
@ -101,9 +111,26 @@ int main(int argc, char *argv[])
conformalVoronoiMesh::debug = true;
Info<< "Create mesh for time = " << runTime.timeName() << nl << endl;
conformalVoronoiMesh mesh(runTime, foamyHexMeshDict);
if (conformationOnly)
{
mesh.initialiseForConformation();
if (!overwrite)
{
runTime++;
}
mesh.writeMesh(runTime.timeName());
}
else
{
mesh.initialiseForMotion();
while (runTime.loop())
{
Info<< nl << "Time = " << runTime.timeName() << endl;
@ -114,6 +141,8 @@ int main(int argc, char *argv[])
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< endl;
}
}
Info<< nl << "End" << nl << endl;

View File

@ -7,6 +7,6 @@ insertSurfaceNearPointPairs.C
insertBoundaryConformPointPairs.C
CV2DIO.C
shortEdgeFilter2D.C
foamyHex2DMesh.C
foamyQuadMesh.C
EXE = $(FOAM_APPBIN)/foamyHex2DMesh
EXE = $(FOAM_APPBIN)/foamyQuadMesh

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
foamyHex2DMesh
foamyQuadMesh
Description
Conformal-Voronoi 2D extruding automatic mesher with grid or read

View File

@ -11,31 +11,18 @@ FoamFile
format ascii;
class dictionary;
location "system";
object foamyHex2DMeshDict;
object foamyQuadMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
geometry
{
laurence_clean_preciser.stl
surfaceFile.stl
{
name laurence_clean_preciser;
type closedTriSurfaceMesh;
//type triSurfaceMesh;
name surfaceFile;
type triSurfaceMesh;
}
// refinementBox
// {
// type searchableBox;
// min (-0.5 0.35 -1000);
// max (-0.5 0.35 1000);
// }
// refinementSphere
// {
// type searchableSphere;
// centre (0.85 0.4 0.0);
// radius 0.01;
// }
}
surfaceConformation
@ -66,10 +53,10 @@ surfaceConformation
geometryToConformTo
{
laurence_clean_preciser
surfaceFile
{
featureMethod extendedFeatureEdgeMesh;
extendedFeatureEdgeMesh "laurence_clean_preciser.extendedFeatureEdgeMesh";
extendedFeatureEdgeMesh "surfaceFile.extendedFeatureEdgeMesh";
}
}
@ -94,7 +81,7 @@ motionControl
cellSizeControlGeometry
{
laurence_clean_preciser
surfaceFile
{
priority 1;
mode bothSides;

View File

@ -55,6 +55,9 @@ Usage
\param -fields \n
Use existing geometry decomposition and convert fields only.
\param -sets \n
Decompose cellSets, faceSets, pointSets.
\param -force \n
Remove any existing \a processor subdirectories before decomposing the
geometry.
@ -127,6 +130,11 @@ int main(int argc, char *argv[])
"use existing geometry decomposition and convert fields only"
);
argList::addBoolOption
(
"sets",
"decompose cellSets, faceSets, pointSets"
);
argList::addBoolOption
(
"force",
"remove existing processor*/ subdirs before decomposing the geometry"
@ -146,6 +154,7 @@ int main(int argc, char *argv[])
bool writeCellDist = args.optionFound("cellDist");
bool copyUniform = args.optionFound("copyUniform");
bool decomposeFieldsOnly = args.optionFound("fields");
bool decomposeSets = args.optionFound("sets");
bool forceOverwrite = args.optionFound("force");
bool ifRequiredDecomposition = args.optionFound("ifRequired");
@ -312,7 +321,7 @@ int main(int argc, char *argv[])
{
mesh.decomposeMesh();
mesh.writeDecomposition();
mesh.writeDecomposition(decomposeSets);
if (writeCellDist)
{

View File

@ -34,6 +34,10 @@ License
#include "globalMeshData.H"
#include "DynamicList.H"
#include "fvFieldDecomposer.H"
#include "IOobjectList.H"
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -123,7 +127,7 @@ Foam::domainDecomposition::~domainDecomposition()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::domainDecomposition::writeDecomposition()
bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
{
Info<< "\nConstructing processor meshes" << endl;
@ -160,6 +164,37 @@ bool Foam::domainDecomposition::writeDecomposition()
}
PtrList<const cellSet> cellSets;
PtrList<const faceSet> faceSets;
PtrList<const pointSet> pointSets;
if (decomposeSets)
{
// Read sets
IOobjectList objects(*this, facesInstance(), "polyMesh/sets");
{
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
forAllConstIter(IOobjectList, cSets, iter)
{
cellSets.append(new cellSet(*iter()));
}
}
{
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
forAllConstIter(IOobjectList, fSets, iter)
{
faceSets.append(new faceSet(*iter()));
}
}
{
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
forAllConstIter(IOobjectList, pSets, iter)
{
pointSets.append(new pointSet(*iter()));
}
}
}
label maxProcCells = 0;
label totProcFaces = 0;
label maxProcPatches = 0;
@ -732,6 +767,52 @@ bool Foam::domainDecomposition::writeDecomposition()
procMesh.write();
if (decomposeSets)
{
forAll(cellSets, i)
{
const cellSet& cs = cellSets[i];
cellSet set(procMesh, cs.name(), cs.size()/nProcs_);
forAll(curCellLabels, i)
{
if (cs.found(curCellLabels[i]))
{
set.insert(i);
}
}
set.write();
}
forAll(faceSets, i)
{
const faceSet& cs = faceSets[i];
faceSet set(procMesh, cs.name(), cs.size()/nProcs_);
forAll(curFaceLabels, i)
{
if (cs.found(mag(curFaceLabels[i])-1))
{
set.insert(i);
}
}
set.write();
}
forAll(pointSets, i)
{
const pointSet& cs = pointSets[i];
pointSet set(procMesh, cs.name(), cs.size()/nProcs_);
forAll(curPointLabels, i)
{
if (cs.found(curPointLabels[i]))
{
set.insert(i);
}
}
set.write();
}
}
// Write points if pointsInstance differing from facesInstance
if (facesInstancePointsPtr_.valid())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -172,7 +172,7 @@ public:
void decomposeMesh();
//- Write decomposition
bool writeDecomposition();
bool writeDecomposition(const bool decomposeSets);
//- Cell-processor decomposition labels
const labelList& cellToProc() const

View File

@ -1,6 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude

View File

@ -41,6 +41,10 @@ Description
#include "pointFieldReconstructor.H"
#include "reconstructLagrangian.H"
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool haveAllTimes
@ -99,6 +103,11 @@ int main(int argc, char *argv[])
"skip reconstructing lagrangian positions and fields"
);
argList::addBoolOption
(
"sets",
"reconstruct cellSets, faceSets, pointSets"
);
argList::addBoolOption
(
"newTimes",
"only reconstruct new times (i.e. that do not exist already)"
@ -113,6 +122,9 @@ int main(int argc, char *argv[])
args.optionLookup("fields")() >> selectedFields;
}
const bool reconstructSets = args.optionFound("sets");
const bool noLagrangian = args.optionFound("noLagrangian");
HashSet<word> selectedLagrangianFields;
@ -668,6 +680,148 @@ int main(int argc, char *argv[])
Info<< "No lagrangian fields" << nl << endl;
}
}
if (reconstructSets)
{
// Scan to find all sets
HashTable<label> cSetNames;
HashTable<label> fSetNames;
HashTable<label> pSetNames;
forAll(procMeshes.meshes(), procI)
{
const fvMesh& procMesh = procMeshes.meshes()[procI];
IOobjectList objects
(
procMesh, procMesh.facesInstance(), "polyMesh/sets"
);
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
forAllConstIter(IOobjectList, cSets, iter)
{
cSetNames.insert(iter.key(), cSetNames.size());
}
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
forAllConstIter(IOobjectList, fSets, iter)
{
fSetNames.insert(iter.key(), fSetNames.size());
}
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
forAllConstIter(IOobjectList, pSets, iter)
{
pSetNames.insert(iter.key(), pSetNames.size());
}
}
// Construct all sets
PtrList<cellSet> cellSets(cSetNames.size());
PtrList<faceSet> faceSets(fSetNames.size());
PtrList<pointSet> pointSets(pSetNames.size());
// Load sets
forAll(procMeshes.meshes(), procI)
{
const fvMesh& procMesh = procMeshes.meshes()[procI];
IOobjectList objects
(
procMesh, procMesh.facesInstance(), "polyMesh/sets"
);
// cellSets
const labelList& cellMap =
procMeshes.cellProcAddressing()[procI];
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
forAllConstIter(IOobjectList, cSets, iter)
{
// Load cellSet
const cellSet procSet(*iter());
label setI = cSetNames[iter.key()];
if (!cellSets.set(setI))
{
cellSets.set
(
setI,
new cellSet(mesh, iter.key(), procSet.size())
);
}
cellSet& cSet = cellSets[setI];
forAllConstIter(cellSet, procSet, iter)
{
cSet.insert(cellMap[iter.key()]);
}
}
// faceSets
const labelList& faceMap =
procMeshes.faceProcAddressing()[procI];
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
forAllConstIter(IOobjectList, fSets, iter)
{
// Load faceSet
const faceSet procSet(*iter());
label setI = fSetNames[iter.key()];
if (!faceSets.set(setI))
{
faceSets.set
(
setI,
new faceSet(mesh, iter.key(), procSet.size())
);
}
faceSet& fSet = faceSets[setI];
forAllConstIter(faceSet, procSet, iter)
{
fSet.insert(mag(faceMap[iter.key()])-1);
}
}
// pointSets
const labelList& pointMap =
procMeshes.pointProcAddressing()[procI];
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
forAllConstIter(IOobjectList, pSets, iter)
{
// Load pointSet
const pointSet propSet(*iter());
label setI = pSetNames[iter.key()];
if (!pointSets.set(setI))
{
pointSets.set
(
setI,
new pointSet(mesh, iter.key(), propSet.size())
);
}
pointSet& pSet = pointSets[setI];
forAllConstIter(pointSet, propSet, iter)
{
pSet.insert(pointMap[iter.key()]);
}
}
}
// Write sets
forAll(cellSets, i)
{
cellSets[i].write();
}
forAll(faceSets, i)
{
faceSets[i].write();
}
forAll(pointSets, i)
{
pointSets[i].write();
}
}
}
}

View File

@ -1,11 +0,0 @@
vtkPV398Foam.C
vtkPV398FoamFields.C
vtkPV398FoamMesh.C
vtkPV398FoamMeshLagrangian.C
vtkPV398FoamMeshSet.C
vtkPV398FoamMeshVolume.C
vtkPV398FoamMeshZone.C
vtkPV398FoamUpdateInfo.C
vtkPV398FoamUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPV398Foam

View File

@ -1,5 +0,0 @@
vtkPV398blockMesh.C
vtkPV398blockMeshConvert.C
vtkPV398blockMeshUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPV398blockMesh

View File

@ -1,3 +0,0 @@
vtkPV398Readers.C
LIB = $(FOAM_LIBBIN)/libvtkPV398Readers

View File

@ -2,7 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory
#set -x
if [ "$ParaView_VERSION" != "3.98.1" ]
if [ "$ParaView_VERSION" != "4.0.1" ]
then
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then

View File

@ -2,8 +2,8 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
wclean libso vtkPV398Readers
PV398blockMeshReader/Allwclean
PV398FoamReader/Allwclean
wclean libso vtkPV4Readers
PV4blockMeshReader/Allwclean
PV4FoamReader/Allwclean
# ----------------------------------------------------------------- end-of-file

View File

@ -2,7 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory
#set -x
if [ "$ParaView_VERSION" == "3.98.1" ]
if [ "$ParaView_VERSION" == "4.0.1" ]
then
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
@ -14,14 +14,14 @@ if [ "$ParaView_VERSION" == "3.98.1" ]
# ensure CMake gets the correct C++ compiler
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
wmake libso vtkPV398Readers
PV398blockMeshReader/Allwmake
PV398FoamReader/Allwmake
wmake libso vtkPV4Readers
PV4blockMeshReader/Allwmake
PV4FoamReader/Allwmake
else
echo "ERROR: ParaView not found in $ParaView_DIR"
fi
else
echo "WARN: PV398 readers not building: ParaView_VERSION=$ParaView_VERSION"
echo "WARN: PV4 readers not building: ParaView_VERSION=$ParaView_VERSION"
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -3,9 +3,9 @@ cd ${0%/*} || exit 1 # run from this directory
set -x
# deal with client/server vs combined plugins
rm -f $FOAM_LIBBIN/libPV398FoamReader* 2>/dev/null
rm -f $FOAM_LIBBIN/libPV4FoamReader* 2>/dev/null
rm -rf PV398FoamReader/Make
wclean libso vtkPV398Foam
rm -rf PV4FoamReader/Make
wclean libso vtkPV4Foam
# ----------------------------------------------------------------- end-of-file

View File

@ -4,9 +4,9 @@ set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
wmake libso vtkPV398Foam
wmake libso vtkPV4Foam
(
cd PV398FoamReader
cd PV4FoamReader
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
cd Make/$WM_OPTIONS
cmake ../..

View File

@ -21,7 +21,7 @@ INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
${PROJECT_SOURCE_DIR}/../vtkPV398Foam
${PROJECT_SOURCE_DIR}/../vtkPV4Foam
)
ADD_DEFINITIONS(
@ -41,45 +41,45 @@ SET(
#
# Extend the auto-generated panel
QT4_WRAP_CPP(MOC_SRCS pqPV398FoamReaderPanel.h)
QT4_WRAP_CPP(MOC_SRCS pqPV4FoamReaderPanel.h)
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
CLASS_NAME pqPV398FoamReaderPanel
XML_NAME PV398FoamReader # name of SourceProxy in *SM.xml
CLASS_NAME pqPV4FoamReaderPanel
XML_NAME PV4FoamReader # name of SourceProxy in *SM.xml
XML_GROUP sources
)
ADD_PARAVIEW_PLUGIN(
PV398FoamReader_SM "1.0"
SERVER_MANAGER_XML PV398FoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPV398FoamReader.cxx
PV4FoamReader_SM "1.0"
SERVER_MANAGER_XML PV4FoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPV4FoamReader.cxx
GUI_INTERFACES ${IFACES}
GUI_SOURCES pqPV398FoamReaderPanel.cxx
GUI_SOURCES pqPV4FoamReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
GUI_RESOURCE_FILES PV398FoamReader.xml
GUI_RESOURCE_FILES PV4FoamReader.xml
)
# #
# # Define the server-side portion of the reader plugin
# #
# ADD_PARAVIEW_PLUGIN(
# PV398FoamReader_SM "1.0"
# SERVER_MANAGER_XML PV398FoamReader_SM.xml
# SERVER_MANAGER_SOURCES vtkPV398FoamReader.cxx
# PV4FoamReader_SM "1.0"
# SERVER_MANAGER_XML PV4FoamReader_SM.xml
# SERVER_MANAGER_SOURCES vtkPV4FoamReader.cxx
# )
# #
# # Define the client-side portion of the reader plugin
# #
# ADD_PARAVIEW_PLUGIN(
# PV398FoamReader "1.0"
# PV4FoamReader "1.0"
# GUI_RESOURCES PV3FoamReader.qrc
# )
#
TARGET_LINK_LIBRARIES(
PV398FoamReader_SM
PV4FoamReader_SM
OpenFOAM
finiteVolume
vtkPV398Foam
vtkPV4Foam
)
#-----------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/ParaViewResources" >
<file>PV398FoamReader.xml</file>
<file>PV4FoamReader.xml</file>
</qresource>
</RCC>

View File

@ -1,5 +1,5 @@
<ParaViewReaders>
<Reader name="PV398FoamReader"
<Reader name="PV4FoamReader"
extensions="OpenFOAM"
file_description="OpenFOAM Reader">
</Reader>

View File

@ -1,8 +1,8 @@
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy
name="PV398FoamReader"
class="vtkPV398FoamReader">
name="PV4FoamReader"
class="vtkPV4FoamReader">
<!-- File name - compulsory -->
<StringVectorProperty

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "pqPV398FoamReaderPanel.h"
#include "pqPV4FoamReaderPanel.h"
// QT
#include <QGridLayout>
@ -50,7 +50,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
pqPV398FoamReaderPanel::pqPV398FoamReaderPanel
pqPV4FoamReaderPanel::pqPV4FoamReaderPanel
(
pqProxy *proxy,
QWidget *p
@ -339,7 +339,7 @@ pqPV398FoamReaderPanel::pqPV398FoamReaderPanel
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void pqPV398FoamReaderPanel::CacheMeshToggled()
void pqPV4FoamReaderPanel::CacheMeshToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
@ -348,7 +348,7 @@ void pqPV398FoamReaderPanel::CacheMeshToggled()
}
void pqPV398FoamReaderPanel::RefreshPressed()
void pqPV4FoamReaderPanel::RefreshPressed()
{
// update everything
vtkSMIntVectorProperty::SafeDownCast
@ -363,7 +363,7 @@ void pqPV398FoamReaderPanel::RefreshPressed()
}
void pqPV398FoamReaderPanel::ZeroTimeToggled()
void pqPV4FoamReaderPanel::ZeroTimeToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
@ -374,7 +374,7 @@ void pqPV398FoamReaderPanel::ZeroTimeToggled()
}
void pqPV398FoamReaderPanel::ShowPatchNamesToggled()
void pqPV4FoamReaderPanel::ShowPatchNamesToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
@ -391,7 +391,7 @@ void pqPV398FoamReaderPanel::ShowPatchNamesToggled()
}
void pqPV398FoamReaderPanel::ShowGroupsOnlyToggled()
void pqPV4FoamReaderPanel::ShowGroupsOnlyToggled()
{
vtkSMProperty* prop;
@ -407,7 +407,7 @@ void pqPV398FoamReaderPanel::ShowGroupsOnlyToggled()
}
void pqPV398FoamReaderPanel::IncludeSetsToggled()
void pqPV4FoamReaderPanel::IncludeSetsToggled()
{
vtkSMProperty* prop;
@ -423,7 +423,7 @@ void pqPV398FoamReaderPanel::IncludeSetsToggled()
}
void pqPV398FoamReaderPanel::IncludeZonesToggled()
void pqPV4FoamReaderPanel::IncludeZonesToggled()
{
vtkSMProperty* prop;
@ -439,7 +439,7 @@ void pqPV398FoamReaderPanel::IncludeZonesToggled()
}
void pqPV398FoamReaderPanel::ExtrapolatePatchesToggled()
void pqPV4FoamReaderPanel::ExtrapolatePatchesToggled()
{
vtkSMProperty* prop;
@ -452,7 +452,7 @@ void pqPV398FoamReaderPanel::ExtrapolatePatchesToggled()
}
void pqPV398FoamReaderPanel::InterpolateVolFieldsToggled()
void pqPV4FoamReaderPanel::InterpolateVolFieldsToggled()
{
vtkSMProperty* prop;

View File

@ -22,19 +22,19 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
pqPV398FoamReaderPanel
pqPV4FoamReaderPanel
Description
GUI modifications for the ParaView reader panel
A custom panel for the PV398FoamReader.
A custom panel for the PV4FoamReader.
SourceFiles
pqPV398FoamReaderPanel.cxx
pqPV4FoamReaderPanel.cxx
\*---------------------------------------------------------------------------*/
#ifndef pqPV398FoamReaderPanel_h
#define pqPV398FoamReaderPanel_h
#ifndef pqPV4FoamReaderPanel_h
#define pqPV4FoamReaderPanel_h
#include "pqAutoGeneratedObjectPanel.h"
@ -51,10 +51,10 @@ class vtkSMSourceProxy;
/*---------------------------------------------------------------------------*\
Class pqPV398FoamReaderPanel Declaration
Class pqPV4FoamReaderPanel Declaration
\*---------------------------------------------------------------------------*/
class pqPV398FoamReaderPanel
class pqPV4FoamReaderPanel
:
public pqAutoGeneratedObjectPanel
{
@ -105,11 +105,11 @@ public:
// Constructors
//- Construct from components
pqPV398FoamReaderPanel(pqProxy*, QWidget*);
pqPV4FoamReaderPanel(pqProxy*, QWidget*);
//- Destructor
// virtual ~pqPV398FoamReaderPanel();
// virtual ~pqPV4FoamReaderPanel();
};

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "vtkPV398FoamReader.h"
#include "vtkPV4FoamReader.h"
#include "pqApplicationCore.h"
#include "pqRenderView.h"
@ -40,18 +40,18 @@ License
#include "vtkStringArray.h"
// OpenFOAM includes
#include "vtkPV398Foam.H"
#include "vtkPV4Foam.H"
#undef EXPERIMENTAL_TIME_CACHING
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
vtkStandardNewMacro(vtkPV398FoamReader);
vtkStandardNewMacro(vtkPV4FoamReader);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
vtkPV398FoamReader::vtkPV398FoamReader()
vtkPV4FoamReader::vtkPV4FoamReader()
{
Debug = 0;
vtkDebugMacro(<<"Constructor");
@ -63,7 +63,7 @@ vtkPV398FoamReader::vtkPV398FoamReader()
output0_ = NULL;
#ifdef VTKPV398FOAM_DUALPORT
#ifdef VTKPV4FOAM_DUALPORT
// Add second output for the Lagrangian
this->SetNumberOfOutputPorts(2);
vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New();
@ -100,7 +100,7 @@ vtkPV398FoamReader::vtkPV398FoamReader()
SelectionObserver = vtkCallbackCommand::New();
SelectionObserver->SetCallback
(
&vtkPV398FoamReader::SelectionModifiedCallback
&vtkPV4FoamReader::SelectionModifiedCallback
);
SelectionObserver->SetClientData(this);
@ -129,7 +129,7 @@ vtkPV398FoamReader::vtkPV398FoamReader()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
vtkPV398FoamReader::~vtkPV398FoamReader()
vtkPV4FoamReader::~vtkPV4FoamReader()
{
vtkDebugMacro(<<"Deconstructor");
@ -168,7 +168,7 @@ vtkPV398FoamReader::~vtkPV398FoamReader()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// Do everything except set the output info
int vtkPV398FoamReader::RequestInformation
int vtkPV4FoamReader::RequestInformation
(
vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector),
@ -177,7 +177,7 @@ int vtkPV398FoamReader::RequestInformation
{
vtkDebugMacro(<<"RequestInformation");
if (Foam::vtkPV398Foam::debug)
if (Foam::vtkPV4Foam::debug)
{
cout<<"REQUEST_INFORMATION\n";
}
@ -190,7 +190,7 @@ int vtkPV398FoamReader::RequestInformation
int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV398Foam::debug)
if (Foam::vtkPV4Foam::debug)
{
cout<<"RequestInformation with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI)
@ -201,7 +201,7 @@ int vtkPV398FoamReader::RequestInformation
if (!foamData_)
{
foamData_ = new Foam::vtkPV398Foam(FileName, this);
foamData_ = new Foam::vtkPV4Foam(FileName, this);
}
else
{
@ -238,7 +238,7 @@ int vtkPV398FoamReader::RequestInformation
timeRange[0] = timeSteps[0];
timeRange[1] = timeSteps[nTimeSteps-1];
if (Foam::vtkPV398Foam::debug > 1)
if (Foam::vtkPV4Foam::debug > 1)
{
cout<<"nTimeSteps " << nTimeSteps << "\n"
<<"timeRange " << timeRange[0] << " to " << timeRange[1]
@ -268,7 +268,7 @@ int vtkPV398FoamReader::RequestInformation
// Set the output info
int vtkPV398FoamReader::RequestData
int vtkPV4FoamReader::RequestData
(
vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector),
@ -292,7 +292,7 @@ int vtkPV398FoamReader::RequestData
int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV398Foam::debug)
if (Foam::vtkPV4Foam::debug)
{
cout<<"RequestData with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI)
@ -310,7 +310,7 @@ int vtkPV398FoamReader::RequestData
// taking port0 as the lead for other outputs would be nice, but fails when
// a filter is added - we need to check everything
// but since PREVIOUS_UPDATE_TIME_STEPS() is protected, relay the logic
// to the vtkPV398Foam::setTime() method
// to the vtkPV4Foam::setTime() method
for (int infoI = 0; infoI < nInfo; ++infoI)
{
vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
@ -342,7 +342,7 @@ int vtkPV398FoamReader::RequestData
)
);
if (Foam::vtkPV398Foam::debug)
if (Foam::vtkPV4Foam::debug)
{
cout<< "update output with "
<< output->GetNumberOfBlocks() << " blocks\n";
@ -370,7 +370,7 @@ int vtkPV398FoamReader::RequestData
output->ShallowCopy(output0_);
}
if (Foam::vtkPV398Foam::debug)
if (Foam::vtkPV4Foam::debug)
{
if (needsUpdate)
{
@ -390,7 +390,7 @@ int vtkPV398FoamReader::RequestData
#else
#ifdef VTKPV398FOAM_DUALPORT
#ifdef VTKPV4FOAM_DUALPORT
foamData_->Update
(
output,
@ -417,13 +417,13 @@ int vtkPV398FoamReader::RequestData
}
void vtkPV398FoamReader::SetRefresh(int val)
void vtkPV4FoamReader::SetRefresh(int val)
{
Modified();
}
void vtkPV398FoamReader::SetIncludeSets(int val)
void vtkPV4FoamReader::SetIncludeSets(int val)
{
if (IncludeSets != val)
{
@ -436,7 +436,7 @@ void vtkPV398FoamReader::SetIncludeSets(int val)
}
void vtkPV398FoamReader::SetIncludeZones(int val)
void vtkPV4FoamReader::SetIncludeZones(int val)
{
if (IncludeZones != val)
{
@ -449,7 +449,7 @@ void vtkPV398FoamReader::SetIncludeZones(int val)
}
void vtkPV398FoamReader::SetShowPatchNames(int val)
void vtkPV4FoamReader::SetShowPatchNames(int val)
{
if (ShowPatchNames != val)
{
@ -459,7 +459,7 @@ void vtkPV398FoamReader::SetShowPatchNames(int val)
}
void vtkPV398FoamReader::SetShowGroupsOnly(int val)
void vtkPV4FoamReader::SetShowGroupsOnly(int val)
{
if (ShowGroupsOnly != val)
{
@ -472,7 +472,7 @@ void vtkPV398FoamReader::SetShowGroupsOnly(int val)
}
void vtkPV398FoamReader::updatePatchNamesView(const bool show)
void vtkPV4FoamReader::updatePatchNamesView(const bool show)
{
pqApplicationCore* appCore = pqApplicationCore::instance();
@ -506,7 +506,7 @@ void vtkPV398FoamReader::updatePatchNamesView(const bool show)
}
void vtkPV398FoamReader::PrintSelf(ostream& os, vtkIndent indent)
void vtkPV4FoamReader::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDebugMacro(<<"PrintSelf");
@ -522,7 +522,7 @@ void vtkPV398FoamReader::PrintSelf(ostream& os, vtkIndent indent)
}
int vtkPV398FoamReader::GetTimeStep()
int vtkPV4FoamReader::GetTimeStep()
{
return foamData_ ? foamData_->timeIndex() : -1;
}
@ -531,35 +531,35 @@ int vtkPV398FoamReader::GetTimeStep()
// ----------------------------------------------------------------------
// Parts selection list control
vtkDataArraySelection* vtkPV398FoamReader::GetPartSelection()
vtkDataArraySelection* vtkPV4FoamReader::GetPartSelection()
{
vtkDebugMacro(<<"GetPartSelection");
return PartSelection;
}
int vtkPV398FoamReader::GetNumberOfPartArrays()
int vtkPV4FoamReader::GetNumberOfPartArrays()
{
vtkDebugMacro(<<"GetNumberOfPartArrays");
return PartSelection->GetNumberOfArrays();
}
const char* vtkPV398FoamReader::GetPartArrayName(int index)
const char* vtkPV4FoamReader::GetPartArrayName(int index)
{
vtkDebugMacro(<<"GetPartArrayName");
return PartSelection->GetArrayName(index);
}
int vtkPV398FoamReader::GetPartArrayStatus(const char* name)
int vtkPV4FoamReader::GetPartArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetPartArrayStatus");
return PartSelection->ArrayIsEnabled(name);
}
void vtkPV398FoamReader::SetPartArrayStatus(const char* name, int status)
void vtkPV4FoamReader::SetPartArrayStatus(const char* name, int status)
{
vtkDebugMacro("Set mesh part \"" << name << "\" status to: " << status);
@ -577,35 +577,35 @@ void vtkPV398FoamReader::SetPartArrayStatus(const char* name, int status)
// ----------------------------------------------------------------------
// volField selection list control
vtkDataArraySelection* vtkPV398FoamReader::GetVolFieldSelection()
vtkDataArraySelection* vtkPV4FoamReader::GetVolFieldSelection()
{
vtkDebugMacro(<<"GetVolFieldSelection");
return VolFieldSelection;
}
int vtkPV398FoamReader::GetNumberOfVolFieldArrays()
int vtkPV4FoamReader::GetNumberOfVolFieldArrays()
{
vtkDebugMacro(<<"GetNumberOfVolFieldArrays");
return VolFieldSelection->GetNumberOfArrays();
}
const char* vtkPV398FoamReader::GetVolFieldArrayName(int index)
const char* vtkPV4FoamReader::GetVolFieldArrayName(int index)
{
vtkDebugMacro(<<"GetVolFieldArrayName");
return VolFieldSelection->GetArrayName(index);
}
int vtkPV398FoamReader::GetVolFieldArrayStatus(const char* name)
int vtkPV4FoamReader::GetVolFieldArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetVolFieldArrayStatus");
return VolFieldSelection->ArrayIsEnabled(name);
}
void vtkPV398FoamReader::SetVolFieldArrayStatus(const char* name, int status)
void vtkPV4FoamReader::SetVolFieldArrayStatus(const char* name, int status)
{
vtkDebugMacro(<<"SetVolFieldArrayStatus");
if (status)
@ -622,35 +622,35 @@ void vtkPV398FoamReader::SetVolFieldArrayStatus(const char* name, int status)
// ----------------------------------------------------------------------
// pointField selection list control
vtkDataArraySelection* vtkPV398FoamReader::GetPointFieldSelection()
vtkDataArraySelection* vtkPV4FoamReader::GetPointFieldSelection()
{
vtkDebugMacro(<<"GetPointFieldSelection");
return PointFieldSelection;
}
int vtkPV398FoamReader::GetNumberOfPointFieldArrays()
int vtkPV4FoamReader::GetNumberOfPointFieldArrays()
{
vtkDebugMacro(<<"GetNumberOfPointFieldArrays");
return PointFieldSelection->GetNumberOfArrays();
}
const char* vtkPV398FoamReader::GetPointFieldArrayName(int index)
const char* vtkPV4FoamReader::GetPointFieldArrayName(int index)
{
vtkDebugMacro(<<"GetPointFieldArrayName");
return PointFieldSelection->GetArrayName(index);
}
int vtkPV398FoamReader::GetPointFieldArrayStatus(const char* name)
int vtkPV4FoamReader::GetPointFieldArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetPointFieldArrayStatus");
return PointFieldSelection->ArrayIsEnabled(name);
}
void vtkPV398FoamReader::SetPointFieldArrayStatus(const char* name, int status)
void vtkPV4FoamReader::SetPointFieldArrayStatus(const char* name, int status)
{
vtkDebugMacro(<<"SetPointFieldArrayStatus");
if (status)
@ -667,35 +667,35 @@ void vtkPV398FoamReader::SetPointFieldArrayStatus(const char* name, int status)
// ----------------------------------------------------------------------
// lagrangianField selection list control
vtkDataArraySelection* vtkPV398FoamReader::GetLagrangianFieldSelection()
vtkDataArraySelection* vtkPV4FoamReader::GetLagrangianFieldSelection()
{
vtkDebugMacro(<<"GetLagrangianFieldSelection");
return LagrangianFieldSelection;
}
int vtkPV398FoamReader::GetNumberOfLagrangianFieldArrays()
int vtkPV4FoamReader::GetNumberOfLagrangianFieldArrays()
{
vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays");
return LagrangianFieldSelection->GetNumberOfArrays();
}
const char* vtkPV398FoamReader::GetLagrangianFieldArrayName(int index)
const char* vtkPV4FoamReader::GetLagrangianFieldArrayName(int index)
{
vtkDebugMacro(<<"GetLagrangianFieldArrayName");
return LagrangianFieldSelection->GetArrayName(index);
}
int vtkPV398FoamReader::GetLagrangianFieldArrayStatus(const char* name)
int vtkPV4FoamReader::GetLagrangianFieldArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetLagrangianFieldArrayStatus");
return LagrangianFieldSelection->ArrayIsEnabled(name);
}
void vtkPV398FoamReader::SetLagrangianFieldArrayStatus
void vtkPV4FoamReader::SetLagrangianFieldArrayStatus
(
const char* name,
int status
@ -715,7 +715,7 @@ void vtkPV398FoamReader::SetLagrangianFieldArrayStatus
// ----------------------------------------------------------------------
void vtkPV398FoamReader::SelectionModifiedCallback
void vtkPV4FoamReader::SelectionModifiedCallback
(
vtkObject*,
unsigned long,
@ -723,18 +723,18 @@ void vtkPV398FoamReader::SelectionModifiedCallback
void*
)
{
static_cast<vtkPV398FoamReader*>(clientdata)->SelectionModified();
static_cast<vtkPV4FoamReader*>(clientdata)->SelectionModified();
}
void vtkPV398FoamReader::SelectionModified()
void vtkPV4FoamReader::SelectionModified()
{
vtkDebugMacro(<<"SelectionModified");
Modified();
}
int vtkPV398FoamReader::FillOutputPortInformation
int vtkPV4FoamReader::FillOutputPortInformation
(
int port,
vtkInformation* info

View File

@ -22,21 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
vtkPV398FoamReader
vtkPV4FoamReader
Description
reads a dataset in OpenFOAM format
vtkPV398blockMeshReader creates an multiblock dataset.
vtkPV4blockMeshReader creates an multiblock dataset.
It uses the OpenFOAM infrastructure (fvMesh, etc) to handle mesh and
field data.
SourceFiles
vtkPV398blockMeshReader.cxx
vtkPV4blockMeshReader.cxx
\*---------------------------------------------------------------------------*/
#ifndef vtkPV398FoamReader_h
#define vtkPV398FoamReader_h
#ifndef vtkPV4FoamReader_h
#define vtkPV4FoamReader_h
// VTK includes
#include "vtkMultiBlockDataSetAlgorithm.h"
@ -50,23 +50,23 @@ class vtkCallbackCommand;
// OpenFOAM forward declarations
namespace Foam
{
class vtkPV398Foam;
class vtkPV4Foam;
}
/*---------------------------------------------------------------------------*\
Class vtkPV398FoamReader Declaration
Class vtkPV4FoamReader Declaration
\*---------------------------------------------------------------------------*/
class vtkPV398FoamReader
class vtkPV4FoamReader
:
public vtkMultiBlockDataSetAlgorithm
{
public:
vtkTypeMacro(vtkPV398FoamReader, vtkMultiBlockDataSetAlgorithm);
vtkTypeMacro(vtkPV4FoamReader, vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream&, vtkIndent);
static vtkPV398FoamReader* New();
static vtkPV4FoamReader* New();
// Description:
// Get the current timestep and the timestep range.
@ -184,10 +184,10 @@ public:
protected:
//- Construct null
vtkPV398FoamReader();
vtkPV4FoamReader();
//- Destructor
~vtkPV398FoamReader();
~vtkPV4FoamReader();
//- Return information about mesh, times, etc without loading anything
virtual int RequestInformation
@ -218,10 +218,10 @@ protected:
private:
//- Disallow default bitwise copy construct
vtkPV398FoamReader(const vtkPV398FoamReader&);
vtkPV4FoamReader(const vtkPV4FoamReader&);
//- Disallow default bitwise assignment
void operator=(const vtkPV398FoamReader&);
void operator=(const vtkPV4FoamReader&);
//- Add/remove patch names to/from the view
void updatePatchNamesView(const bool show);
@ -251,7 +251,7 @@ private:
vtkMultiBlockDataSet* output0_;
//BTX
Foam::vtkPV398Foam* foamData_;
Foam::vtkPV4Foam* foamData_;
//ETX
};

View File

@ -0,0 +1,11 @@
vtkPV4Foam.C
vtkPV4FoamFields.C
vtkPV4FoamMesh.C
vtkPV4FoamMeshLagrangian.C
vtkPV4FoamMeshSet.C
vtkPV4FoamMeshVolume.C
vtkPV4FoamMeshZone.C
vtkPV4FoamUpdateInfo.C
vtkPV4FoamUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPV4Foam

View File

@ -4,8 +4,8 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I../../vtkPV398Readers/lnInclude \
-I../PV398FoamReader \
-I../../vtkPV4Readers/lnInclude \
-I../PV4FoamReader \
-I$(ParaView_INCLUDE_DIR) \
$(shell \
test -f $(ParaView_INCLUDE_DIR)/vtkPolyhedron.h && \
@ -17,5 +17,5 @@ LIB_LIBS = \
-lfiniteVolume \
-lgenericPatchFields \
-llagrangian \
-L$(FOAM_LIBBIN) -lvtkPV398Readers \
-L$(FOAM_LIBBIN) -lvtkPV4Readers \
$(GLIBS)

Some files were not shown because too many files have changed in this diff Show More