Merge branch 'master' into particleInteractions

This commit is contained in:
graham
2009-10-19 11:37:48 +01:00
300 changed files with 7474 additions and 2787 deletions

View File

@ -30,7 +30,7 @@ scalar gasMass0 = fvc::domainIntegrate(rho).value();
if (dieselSpray.twoD())
{
gasMass0 *= constant::math::twoPi/dieselSpray.angleOfWedge();
gasMass0 *= constant::mathematical::twoPi/dieselSpray.angleOfWedge();
}
gasMass0 -=

View File

@ -43,7 +43,7 @@ Description
#include "OFstream.H"
#include "volPointInterpolation.H"
#include "thermoPhysicsTypes.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -20,7 +20,7 @@
if (dieselSpray.twoD())
{
gasMass *= constant::math::twoPi/dieselSpray.angleOfWedge();
gasMass *= constant::mathematical::twoPi/dieselSpray.angleOfWedge();
}
scalar addedMass = gasMass - gasMass0;

View File

@ -41,7 +41,7 @@ Description
#include "IFstream.H"
#include "OFstream.H"
#include "Switch.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -58,7 +58,7 @@ Description
#include "ignition.H"
#include "Switch.H"
#include "OFstream.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,7 +28,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -182,7 +182,7 @@ void smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
}
Field<scalar> C2 = pmu/prho
*sqrt(ppsi*constant::math::piByTwo)
*sqrt(ppsi*constant::mathematical::piByTwo)
*2.0*gamma_/Pr.value()/(gamma_ + 1.0)
*(2.0 - accommodationCoeff_)/accommodationCoeff_;

View File

@ -28,7 +28,7 @@ Description
#include "maxwellSlipUFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -147,7 +147,7 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs()
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>("psi");
Field<scalar> C1 = sqrt(ppsi*constant::math::piByTwo)
Field<scalar> C1 = sqrt(ppsi*constant::mathematical::piByTwo)
*(2.0 - accommodationCoeff_)/accommodationCoeff_;
Field<scalar> pnu = pmu/prho;

View File

@ -21,7 +21,7 @@
fvm::laplacian(rhorUAf, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, p[pRefCell]);
pEqn.setReference(pRefCell, pRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "SchnerrSauer.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -77,7 +77,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
{
return pow
(
((4*constant::math::pi*n_)/3)
((4*constant::mathematical::pi*n_)/3)
*limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
1.0/3.0
);
@ -87,7 +87,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
Foam::dimensionedScalar
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
{
dimensionedScalar Vnuc = n_*constant::math::pi*pow3(dNuc_)/6;
dimensionedScalar Vnuc = n_*constant::mathematical::pi*pow3(dNuc_)/6;
return Vnuc/(1 + Vnuc);
}

View File

@ -29,12 +29,12 @@ License
#include "Time.H"
#include "subCycle.H"
#include "fvCFD.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
const scalar Foam::multiphaseMixture::convertToRad =
Foam::constant::math::pi/180.0;
Foam::constant::mathematical::pi/180.0;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "GidaspowConductivity.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::GidaspowConductivity::kappa
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(constant::math::pi);
const scalar sqrtPi = sqrt(constant::mathematical::pi);
return rhoa*da*sqrt(Theta)*
(

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "HrenyaSinclairConductivity.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -74,7 +74,7 @@ Foam::tmp<Foam::volScalarField> Foam::HrenyaSinclairConductivity::kappa
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(constant::math::pi);
const scalar sqrtPi = sqrt(constant::mathematical::pi);
volScalarField lamda =
scalar(1) + da/(6.0*sqrt(2.0)*(alpha + scalar(1.0e-5)))/L_;

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "SyamlalConductivity.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::SyamlalConductivity::kappa
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(constant::math::pi);
const scalar sqrtPi = sqrt(constant::mathematical::pi);
return rhoa*da*sqrt(Theta)*
(

View File

@ -26,7 +26,7 @@ License
#include "kineticTheoryModel.H"
#include "surfaceInterpolate.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "fvCFD.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -204,7 +204,7 @@ void Foam::kineticTheoryModel::solve()
volScalarField alpha = alpha_;
alpha.max(1.0e-6);
const scalar sqrtPi = sqrt(constant::math::pi);
const scalar sqrtPi = sqrt(constant::mathematical::pi);
surfaceScalarField phi = 1.5*rhoa_*phia_*fvc::interpolate(alpha_);

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "GidaspowViscosity.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -70,7 +70,7 @@ Foam::kineticTheoryModels::GidaspowViscosity::mua
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(constant::math::pi);
const scalar sqrtPi = sqrt(constant::mathematical::pi);
return rhoa*da*sqrt(Theta)*
(

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "HrenyaSinclairViscosity.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -77,7 +77,7 @@ Foam::kineticTheoryModels::HrenyaSinclairViscosity::mua
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(constant::math::pi);
const scalar sqrtPi = sqrt(constant::mathematical::pi);
volScalarField lamda =
scalar(1) + da/(6.0*sqrt(2.0)*(alpha + scalar(1.0e-5)))/L_;

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "SyamlalViscosity.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModels::SyamlalViscosity::mua
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(constant::math::pi);
const scalar sqrtPi = sqrt(constant::mathematical::pi);
return rhoa*da*sqrt(Theta)*
(

View File

@ -78,10 +78,7 @@ int main(int argc, char *argv[])
Serr<< "slave sending to master "
<< Pstream::masterNo() << endl;
OPstream toMaster
(
Pstream::blocking, Pstream::masterNo(), IOstream::ASCII
);
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
FixedList<label, 2> list3;
list3[0] = 0;
@ -98,10 +95,7 @@ int main(int argc, char *argv[])
)
{
Serr << "master receiving from slave " << slave << endl;
IPstream fromSlave
(
Pstream::blocking, slave, IOstream::ASCII
);
IPstream fromSlave(Pstream::blocking, slave);
FixedList<label, 2> list3(fromSlave);
Serr<< list3 << endl;

View File

@ -32,7 +32,7 @@ Description
#include "graph.H"
#include "OFstream.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
using namespace Foam;
@ -50,7 +50,7 @@ int main()
scalarField b = 0.5*(1.0 + erf(x));
scalarField c = 1.0 - b;
scalarField gradb = (1/::sqrt(constant::math::pi))*exp(-sqr(x));
scalarField gradb = (1/::sqrt(constant::mathematical::pi))*exp(-sqr(x));
scalarField lapb = -2*x*gradb;
r = lapb*b*c/(gradb*gradb);

View File

@ -27,6 +27,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "stringListOps.H"
#include "IStringStream.H"
#include "IOstreams.H"
using namespace Foam;
@ -36,21 +37,59 @@ using namespace Foam;
int main(int argc, char *argv[])
{
stringList sl(3);
sl[0] = "hello";
sl[1] = "heello";
sl[2] = "heeello";
stringList strLst
(
IStringStream
(
"("
"\"hello\""
"\"heello\""
"\"heeello\""
"\"bye\""
"\"bbye\""
"\"bbbye\""
"\"okey\""
"\"okkey\""
"\"okkkey\""
")"
)()
);
labelList matches = findStrings(".*ee.*", sl);
wordReList reLst(IStringStream("( okey \"[hy]e+.*\" )")());
Info<< "matches found for regexp .*ee.* : ";
Info<< "stringList " << strLst << nl;
labelList matches = findStrings(".*ee.*", strLst);
Info<< "matches found for regexp .*ee.* :" << nl << matches << nl;
forAll(matches, i)
{
Info<< " " << sl[matches[i]];
Info<< " -> " << strLst[matches[i]] << nl;
}
Info<< endl;
Info << "End\n" << endl;
matches = findStrings(reLst, strLst);
Info<< "matches found for " << reLst << nl << matches << nl;
forAll(matches, i)
{
Info<< " -> " << strLst[matches[i]] << nl;
}
Info<< endl;
stringList subLst = subsetStrings(".*ee.*", strLst);
Info<< "subset stringList: " << subLst << nl;
subLst = subsetStrings(reLst, strLst);
Info<< "subset stringList: " << subLst << nl;
inplaceSubsetStrings(reLst, strLst);
Info<< "subsetted stringList: " << strLst << nl;
inplaceSubsetStrings(".*l.*", strLst);
Info<< "subsetted stringList: " << strLst << nl;
Info<< "\nEnd\n" << endl;
return 0;
}

View File

@ -47,7 +47,7 @@ Description
#include "polyTopoChanger.H"
#include "polyMesh.H"
#include "mapPolyMesh.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "PackedBoolList.H"
#include "SortableList.H"
@ -467,7 +467,7 @@ int main(int argc, char *argv[])
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.optionFound("overwrite");
scalar maxCos = Foam::cos(angle*180/constant::math::pi);
scalar maxCos = Foam::cos(angle*180/constant::mathematical::pi);
Info<< "Merging:" << nl
<< " edges with length less than " << minLen << " meters" << nl

View File

@ -53,7 +53,7 @@ Description
#include "removePoints.H"
#include "polyMesh.H"
#include "mapPolyMesh.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
using namespace Foam;
@ -445,12 +445,12 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0);
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
scalar concaveAngle = defaultConcaveAngle;
args.optionReadIfPresent("concaveAngle", concaveAngle);
scalar concaveSin = Foam::sin(concaveAngle*constant::math::pi/180.0);
scalar concaveSin = Foam::sin(concaveAngle*constant::mathematical::pi/180.0);
bool snapMeshDict = args.optionFound("snapMesh");
bool overwrite = args.optionFound("overwrite");

View File

@ -49,7 +49,7 @@ Description
#include "cellSet.H"
#include "cellModeller.H"
#include "meshCutter.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "geomCellLooper.H"
#include "plane.H"
#include "edgeVertex.H"
@ -539,7 +539,7 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar radAngle = featureAngle*constant::math::pi/180.0;
scalar radAngle = featureAngle*constant::mathematical::pi/180.0;
scalar minCos = Foam::cos(radAngle);
scalar minSin = Foam::sin(radAngle);

View File

@ -43,7 +43,7 @@ Description
#include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H"
#include "cyclicPolyPatch.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
using namespace Foam;

View File

@ -434,7 +434,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
{
// Distribute the points to be +/- 2.5deg from the x-z plane
scalar tanTheta = Foam::tan(2.5*constant::math::pi/180.0);
scalar tanTheta = Foam::tan(2.5*constant::mathematical::pi/180.0);
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();

View File

@ -59,7 +59,7 @@ Usage
#include "Time.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "polyTopoChange.H"
#include "mapPolyMesh.H"
#include "PackedBoolList.H"
@ -91,7 +91,7 @@ void simpleMarkFeatures
labelList& multiCellFeaturePoints
)
{
scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0);
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -387,7 +387,7 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0);
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl

View File

@ -33,7 +33,7 @@ Description
#include "IOmanip.H"
#include "boundBox.H"
#include "Map.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -99,7 +99,7 @@ void starMesh::createCoupleMatches()
<< coupleI << ". STAR couple ID: "
<< couples_[coupleI].coupleID() << endl
<< "The angle between face normals is "
<< Foam::acos(faceAreaAngle)/constant::math::pi*180
<< Foam::acos(faceAreaAngle)/constant::mathematical::pi*180
<< " deg." << endl
<< "master cell: " << fp.masterCell()
<< " STAR number: " << starCellID_[fp.masterCell()]

View File

@ -1,31 +1,3 @@
curvedEdges = curvedEdges
$(curvedEdges)/curvedEdge.C
$(curvedEdges)/lineEdge.C
$(curvedEdges)/polyLine.C
$(curvedEdges)/polyLineEdge.C
$(curvedEdges)/arcEdge.C
$(curvedEdges)/spline.C
$(curvedEdges)/BSpline.C
$(curvedEdges)/simpleSplineEdge.C
$(curvedEdges)/polySplineEdge.C
$(curvedEdges)/lineDivide.C
blockMesh.C
blockDescriptor.C
setEdge.C
block.C
createTopology.C
checkBlockMesh.C
createBlockOffsets.C
createMergeList.C
createPoints.C
createCells.C
createPatches.C
blockPoints.C
blockCells.C
blockBoundary.C
blockMeshApp.C
EXE = $(FOAM_APPBIN)/blockMesh

View File

@ -1,8 +1,9 @@
EXE_INC = \
-I$(curvedEdges) \
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lblockMesh \
-lmeshTools \
-ldynamicMesh

View File

@ -1,209 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Description
private member of block. Creates boundary patches for the block
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockBoundary()
{
label ni = blockDef_.n().x();
label nj = blockDef_.n().y();
label nk = blockDef_.n().z();
// x-direction
label wallLabel = 0;
label wallCellLabel = 0;
// x-min
boundaryPatches_[wallLabel].setSize(nj*nk);
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(0, j, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(0, j, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(0, j + 1, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(0, j + 1, k);
// update the counter
wallCellLabel++;
}
}
// x-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(nj*nk);
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(ni, j, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(ni, j+1, k);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(ni, j+1, k+1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(ni, j, k+1);
// update the counter
wallCellLabel++;
}
}
// y-direction
// y-min
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nk);
for (label i = 0; i <= ni - 1; i++)
{
for (label k = 0; k <= nk - 1; k++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, 0, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i + 1, 0, k);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, 0, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i, 0, k + 1);
// update the counter
wallCellLabel++;
}
}
// y-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nk);
for (label i = 0; i <= ni - 1; i++)
{
for (label k = 0; k <= nk - 1; k++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, nj, k);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i, nj, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, nj, k + 1);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i + 1, nj, k);
// update the counter
wallCellLabel++;
}
}
// z-direction
// z-min
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nj);
for (label i = 0; i <= ni - 1; i++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, j, 0);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i, j + 1, 0);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, j + 1, 0);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i + 1, j, 0);
// update the counter
wallCellLabel++;
}
}
// z-max
wallLabel++;
wallCellLabel = 0;
boundaryPatches_[wallLabel].setSize(ni*nj);
for (label i = 0; i <= ni - 1; i++)
{
for (label j = 0; j <= nj - 1; j++)
{
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
// set the points
boundaryPatches_[wallLabel][wallCellLabel][0] =
vtxLabel(i, j, nk);
boundaryPatches_[wallLabel][wallCellLabel][1] =
vtxLabel(i + 1, j, nk);
boundaryPatches_[wallLabel][wallCellLabel][2] =
vtxLabel(i + 1, j + 1, nk);
boundaryPatches_[wallLabel][wallCellLabel][3] =
vtxLabel(i, j + 1, nk);
// update the counter
wallCellLabel++;
}
}
}
// ************************************************************************* //

View File

@ -1,65 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Description
private member of block. Creates cells for the block.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockCells()
{
label ni = blockDef_.n().x();
label nj = blockDef_.n().y();
label nk = blockDef_.n().z();
label cellNo = 0;
for (label k = 0; k <= nk - 1; k++)
{
for (label j = 0; j <= nj - 1; j++)
{
for (label i = 0; i <= ni - 1; i++)
{
cells_[cellNo].setSize(8);
cells_[cellNo][0] = vtxLabel(i, j, k);
cells_[cellNo][1] = vtxLabel(i+1, j, k);
cells_[cellNo][2] = vtxLabel(i+1, j+1, k);
cells_[cellNo][3] = vtxLabel(i, j+1, k);
cells_[cellNo][4] = vtxLabel(i, j, k+1);
cells_[cellNo][5] = vtxLabel(i+1, j, k+1);
cells_[cellNo][6] = vtxLabel(i+1, j+1, k+1);
cells_[cellNo][7] = vtxLabel(i, j+1, k+1);
cellNo++;
}
}
}
}
// ************************************************************************* //

View File

@ -1,248 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockDescriptor.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void blockDescriptor::makeBlockEdges()
{
// for all edges check the list of curved edges. If the edge is curved,
// add it to the list. If the edge is not found, create is as a line
setEdge(0, 0, 1, n_.x());
setEdge(1, 3, 2, n_.x());
setEdge(2, 7, 6, n_.x());
setEdge(3, 4, 5, n_.x());
setEdge(4, 0, 3, n_.y());
setEdge(5, 1, 2, n_.y());
setEdge(6, 5, 6, n_.y());
setEdge(7, 4, 7, n_.y());
setEdge(8, 0, 4, n_.z());
setEdge(9, 1, 5, n_.z());
setEdge(10, 2, 6, n_.z());
setEdge(11, 3, 7, n_.z());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
blockDescriptor::blockDescriptor
(
const cellShape& bshape,
const pointField& blockMeshPoints,
const curvedEdgeList& edges,
const Vector<label>& n,
const scalarList& expand,
const word& zoneName
)
:
blockMeshPoints_(blockMeshPoints),
blockShape_(bshape),
curvedEdges_(edges),
edgePoints_(12),
edgeWeights_(12),
n_(n),
expand_(expand),
zoneName_(zoneName)
{
if (expand_.size() != 12)
{
FatalErrorIn
(
"blockDescriptor::blockDescriptor"
"(const cellShape& bshape, const pointField& blockMeshPoints, "
"const curvedEdgeList& edges, label xnum, label ynum, label znum, "
"const scalarList& expand, const word& zoneName)"
) << "Unknown definition of expansion ratios"
<< exit(FatalError);
}
makeBlockEdges();
}
// from Istream
blockDescriptor::blockDescriptor
(
const pointField& blockMeshPoints,
const curvedEdgeList& edges,
Istream& is
)
:
blockMeshPoints_(blockMeshPoints),
blockShape_(is),
curvedEdges_(edges),
edgePoints_(12),
edgeWeights_(12),
n_(),
expand_(12),
zoneName_()
{
// Look at first token
token t(is);
is.putBack(t);
// Optional zone name
if (t.isWord())
{
zoneName_ = t.wordToken();
// Consume zoneName token
is >> t;
// New look-ahead
is >> t;
is.putBack(t);
}
if (t.isPunctuation())
{
if (t.pToken() == token::BEGIN_LIST)
{
is >> n_;
}
else
{
FatalIOErrorIn
(
"blockDescriptor::blockDescriptor"
"(const pointField&, const curvedEdgeList&, Istream& is)",
is
) << "incorrect token while reading n, expected '(', found "
<< t.info()
<< exit(FatalIOError);
}
}
else
{
is >> n_.x() >> n_.y() >> n_.z();
}
is >> t;
if (!t.isWord())
{
is.putBack(t);
}
scalarList expRatios(is);
if (expRatios.size() == 3)
{
expand_[0] = expRatios[0];
expand_[1] = expRatios[0];
expand_[2] = expRatios[0];
expand_[3] = expRatios[0];
expand_[4] = expRatios[1];
expand_[5] = expRatios[1];
expand_[6] = expRatios[1];
expand_[7] = expRatios[1];
expand_[8] = expRatios[2];
expand_[9] = expRatios[2];
expand_[10] = expRatios[2];
expand_[11] = expRatios[2];
}
else if (expRatios.size() == 12)
{
expand_ = expRatios;
}
else
{
FatalErrorIn
(
"blockDescriptor::blockDescriptor"
"(const pointField& blockMeshPoints, const curvedEdgeList& edges,"
"Istream& is)"
) << "Unknown definition of expansion ratios"
<< exit(FatalError);
}
// create a list of edges
makeBlockEdges();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const pointField& blockDescriptor::points() const
{
return blockMeshPoints_;
}
const cellShape& blockDescriptor::blockShape() const
{
return blockShape_;
}
const List<List<point> >& blockDescriptor::blockEdgePoints() const
{
return edgePoints_;
}
const scalarListList& blockDescriptor::blockEdgeWeights() const
{
return edgeWeights_;
}
const Vector<label>& blockDescriptor::n() const
{
return n_;
}
const word& blockDescriptor::zoneName() const
{
return zoneName_;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void blockDescriptor::operator=(const blockDescriptor&)
{
notImplemented("void blockDescriptor::operator=(const blockDescriptor&)");
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -146,8 +146,10 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
Info<< nl << "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << nl << endl;
Info<< "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << endl;
blockMesh::verbose(true);
IOdictionary meshDict(meshDictIoPtr());
blockMesh blocks(meshDict);
@ -195,8 +197,7 @@ int main(int argc, char *argv[])
}
Info<< nl << "Creating mesh from block mesh" << endl;
Info<< nl << "Creating polyMesh from blockMesh" << endl;
wordList patchNames = blocks.patchNames();
wordList patchTypes = blocks.patchTypes();
@ -204,6 +205,7 @@ int main(int argc, char *argv[])
word defaultFacesType = emptyPolyPatch::typeName;
wordList patchPhysicalTypes = blocks.patchPhysicalTypes();
preservePatchTypes
(
runTime,
@ -339,7 +341,7 @@ int main(int argc, char *argv[])
// Set the precision of the points data to 10
IOstream::defaultPrecision(10);
Info << nl << "Writing polyMesh" << endl;
Info<< nl << "Writing polyMesh" << endl;
mesh.removeFiles();
if (!mesh.write())
{
@ -348,6 +350,38 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
//
// write some information
//
{
const polyPatchList& patches = mesh.boundaryMesh();
Info<< "----------------" << nl
<< "Mesh Information" << nl
<< "----------------" << nl
<< " " << "boundingBox: " << boundBox(mesh.points()) << nl
<< " " << "nPoints: " << mesh.nPoints() << nl
<< " " << "nCells: " << mesh.nCells() << nl
<< " " << "nFaces: " << mesh.nFaces() << nl
<< " " << "nInternalFaces: " << mesh.nInternalFaces() << nl;
Info<< "----------------" << nl
<< "Patches" << nl
<< "----------------" << nl;
forAll(patches, patchI)
{
const polyPatch& p = patches[patchI];
Info<< " " << "patch " << patchI
<< " (start: " << p.start()
<< " size: " << p.size()
<< ") name: " << p.name()
<< nl;
}
}
Info<< nl << "End" << endl;
return 0;

View File

@ -1,232 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Description
private member of block. Creates vertices for cells filling the block.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::block::blockPoints()
{
// set local variables for mesh specification
const label ni = blockDef_.n().x();
const label nj = blockDef_.n().y();
const label nk = blockDef_.n().z();
const point p000 = blockDef_.points()[blockDef_.blockShape()[0]];
const point p100 = blockDef_.points()[blockDef_.blockShape()[1]];
const point p110 = blockDef_.points()[blockDef_.blockShape()[2]];
const point p010 = blockDef_.points()[blockDef_.blockShape()[3]];
const point p001 = blockDef_.points()[blockDef_.blockShape()[4]];
const point p101 = blockDef_.points()[blockDef_.blockShape()[5]];
const point p111 = blockDef_.points()[blockDef_.blockShape()[6]];
const point p011 = blockDef_.points()[blockDef_.blockShape()[7]];
// list of edge point and weighting factors
const List<List<point> >& p = blockDef_.blockEdgePoints();
const scalarListList& w = blockDef_.blockEdgeWeights();
// generate vertices
for (label k = 0; k <= nk; k++)
{
for (label j = 0; j <= nj; j++)
{
for (label i = 0; i <= ni; i++)
{
label vertexNo = vtxLabel(i, j, k);
// points on edges
vector edgex1 = p000 + (p100 - p000)*w[0][i];
vector edgex2 = p010 + (p110 - p010)*w[1][i];
vector edgex3 = p011 + (p111 - p011)*w[2][i];
vector edgex4 = p001 + (p101 - p001)*w[3][i];
vector edgey1 = p000 + (p010 - p000)*w[4][j];
vector edgey2 = p100 + (p110 - p100)*w[5][j];
vector edgey3 = p101 + (p111 - p101)*w[6][j];
vector edgey4 = p001 + (p011 - p001)*w[7][j];
vector edgez1 = p000 + (p001 - p000)*w[8][k];
vector edgez2 = p100 + (p101 - p100)*w[9][k];
vector edgez3 = p110 + (p111 - p110)*w[10][k];
vector edgez4 = p010 + (p011 - p010)*w[11][k];
// calculate the importance factors for all edges
// x - direction
scalar impx1 =
(
(1.0 - w[0][i])*(1.0 - w[4][j])*(1.0 - w[8][k])
+ w[0][i]*(1.0 - w[5][j])*(1.0 - w[9][k])
);
scalar impx2 =
(
(1.0 - w[1][i])*w[4][j]*(1.0 - w[11][k])
+ w[1][i]*w[5][j]*(1.0 - w[10][k])
);
scalar impx3 =
(
(1.0 - w[2][i])*w[7][j]*w[11][k]
+ w[2][i]*w[6][j]*w[10][k]
);
scalar impx4 =
(
(1.0 - w[3][i])*(1.0 - w[7][j])*w[8][k]
+ w[3][i]*(1.0 - w[6][j])*w[9][k]
);
scalar magImpx = impx1 + impx2 + impx3 + impx4;
impx1 /= magImpx;
impx2 /= magImpx;
impx3 /= magImpx;
impx4 /= magImpx;
// y - direction
scalar impy1 =
(
(1.0 - w[4][j])*(1.0 - w[0][i])*(1.0 - w[8][k])
+ w[4][j]*(1.0 - w[1][i])*(1.0 - w[11][k])
);
scalar impy2 =
(
(1.0 - w[5][j])*w[0][i]*(1.0 - w[9][k])
+ w[5][j]*w[1][i]*(1.0 - w[10][k])
);
scalar impy3 =
(
(1.0 - w[6][j])*w[3][i]*w[9][k]
+ w[6][j]*w[2][i]*w[10][k]
);
scalar impy4 =
(
(1.0 - w[7][j])*(1.0 - w[3][i])*w[8][k]
+ w[7][j]*(1.0 - w[2][i])*w[11][k]
);
scalar magImpy = impy1 + impy2 + impy3 + impy4;
impy1 /= magImpy;
impy2 /= magImpy;
impy3 /= magImpy;
impy4 /= magImpy;
// z - direction
scalar impz1 =
(
(1.0 - w[8][k])*(1.0 - w[0][i])*(1.0 - w[4][j])
+ w[8][k]*(1.0 - w[3][i])*(1.0 - w[7][j])
);
scalar impz2 =
(
(1.0 - w[9][k])*w[0][i]*(1.0 - w[5][j])
+ w[9][k]*w[3][i]*(1.0 - w[6][j])
);
scalar impz3 =
(
(1.0 - w[10][k])*w[1][i]*w[5][j]
+ w[10][k]*w[2][i]*w[6][j]
);
scalar impz4 =
(
(1.0 - w[11][k])*(1.0 - w[1][i])*w[4][j]
+ w[11][k]*(1.0 - w[2][i])*w[7][j]
);
scalar magImpz = impz1 + impz2 + impz3 + impz4;
impz1 /= magImpz;
impz2 /= magImpz;
impz3 /= magImpz;
impz4 /= magImpz;
// calculate the correction vectors
vector corx1 = impx1*(p[0][i] - edgex1);
vector corx2 = impx2*(p[1][i] - edgex2);
vector corx3 = impx3*(p[2][i] - edgex3);
vector corx4 = impx4*(p[3][i] - edgex4);
vector cory1 = impy1*(p[4][j] - edgey1);
vector cory2 = impy2*(p[5][j] - edgey2);
vector cory3 = impy3*(p[6][j] - edgey3);
vector cory4 = impy4*(p[7][j] - edgey4);
vector corz1 = impz1*(p[8][k] - edgez1);
vector corz2 = impz2*(p[9][k] - edgez2);
vector corz3 = impz3*(p[10][k] - edgez3);
vector corz4 = impz4*(p[11][k] - edgez4);
// multiply by the importance factor
// x - direction
edgex1 *= impx1;
edgex2 *= impx2;
edgex3 *= impx3;
edgex4 *= impx4;
// y - direction
edgey1 *= impy1;
edgey2 *= impy2;
edgey3 *= impy3;
edgey4 *= impy4;
// z - direction
edgez1 *= impz1;
edgez2 *= impz2;
edgez3 *= impz3;
edgez4 *= impz4;
// add the contributions
vertices_[vertexNo] = edgex1 + edgex2 + edgex3 + edgex4;
vertices_[vertexNo] += edgey1 + edgey2 + edgey3 + edgey4;
vertices_[vertexNo] += edgez1 + edgez2 + edgez3 + edgez4;
vertices_[vertexNo] /= 3.0;
vertices_[vertexNo] += corx1 + corx2 + corx3 + corx4;
vertices_[vertexNo] += cory1 + cory2 + cory3 + cory4;
vertices_[vertexNo] += corz1 + corz2 + corz3 + corz4;
}
}
}
}
// ************************************************************************* //

View File

@ -1,74 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "error.H"
#include "blockMesh.H"
#include "cellModeller.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::cellShapeList Foam::blockMesh::createCells()
{
Info<< nl << "Creating cells" << endl;
PtrList<cellShape> cells(nCells_);
blockMesh& blocks = *this;
const cellModel& hex = *(cellModeller::lookup("hex"));
label cellLabel = 0;
forAll(blocks, blockLabel)
{
const labelListList& blockCells = blocks[blockLabel].cells();
forAll(blockCells, blockCellLabel)
{
labelList cellPoints(blockCells[blockCellLabel].size());
forAll(cellPoints, cellPointLabel)
{
cellPoints[cellPointLabel] =
mergeList_
[
blockCells[blockCellLabel][cellPointLabel]
+ blockOffsets_[blockLabel]
];
}
// Construct collapsed cell and all to list
cells.set(cellLabel, new cellShape(hex, cellPoints, true));
cellLabel++;
}
}
return cells;
}
// ************************************************************************* //

View File

@ -1,71 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Description
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict)
{
blockMesh& blocks = *this;
scalar scaleFactor = 1.0;
// optional 'convertToMeters' (or 'scale'?)
if (!dict.readIfPresent("convertToMeters", scaleFactor))
{
dict.readIfPresent("scale", scaleFactor);
}
Info<< nl << "Creating points with scale " << scaleFactor << endl;
pointField points(nPoints_);
forAll(blocks, blockLabel)
{
const pointField& blockPoints = blocks[blockLabel].points();
forAll(blockPoints, blockPointLabel)
{
points
[
mergeList_
[
blockPointLabel
+ blockOffsets_[blockLabel]
]
] = scaleFactor * blockPoints[blockPointLabel];
}
}
return points;
}
// ************************************************************************* //

View File

@ -26,7 +26,7 @@ License
#include "wedge.H"
#include "addToRunTimeSelectionTable.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ wedge::wedge(const dictionary& dict)
angle_
(
readScalar(coeffDict_.lookup("angle"))
*constant::math::pi/180.0
*constant::mathematical::pi/180.0
)
{}

View File

@ -1,7 +1,7 @@
EXE_INC = \
/* -g -DFULLDEBUG -O0 */ \
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
-I$(LIB_SRC)/autoMesh/lnInclude \
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \

View File

@ -33,7 +33,7 @@ Description
#include "Time.H"
#include "boundaryMesh.H"
#include "repatchPolyTopoChanger.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "OFstream.H"
#include "ListOps.H"
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.optionFound("overwrite");
scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0);
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl

View File

@ -67,10 +67,10 @@ Usage
#include "transformField.H"
#include "transformGeometricField.H"
#include "IStringStream.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
using namespace Foam;
using namespace Foam::constant::math;
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,5 +1,2 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -39,4 +39,5 @@ EXE_LIBS = \
-lthermophysicalFunctions \
-ltopoChangerFvMesh \
-ltriSurface \
-lautoMesh
-lautoMesh \
-lblockMesh

View File

@ -0,0 +1,2 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -113,13 +113,8 @@ int main(int argc, char *argv[])
}
// control for renumbering iterations
bool optIndex = false;
label indexingNumber = 0;
if (args.optionFound("index"))
{
optIndex = true;
indexingNumber = args.optionRead<label>("index");
}
bool optIndex = args.optionReadIfPresent("index", indexingNumber);
// always write the geometry, unless the -noMesh option is specified
bool optNoMesh = args.optionFound("noMesh");
@ -134,7 +129,7 @@ int main(int argc, char *argv[])
// or a particular time interval
if (isDir(ensightDir))
{
Info<<"Warning: reusing existing directory" << nl
Info<<"Warning: re-using existing directory" << nl
<< " " << ensightDir << endl;
}
mkDir(ensightDir);

View File

@ -106,7 +106,7 @@
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
A simple way cause a reader GUI modification.
A simple way to cause a reader GUI modification.
</Documentation>
</IntVectorProperty>

View File

@ -385,14 +385,7 @@ int vtkPV3FoamReader::RequestData
foamData_->Update(output, output);
#endif
if (ShowPatchNames)
{
addPatchNamesToView();
}
else
{
removePatchNamesFromView();
}
updatePatchNamesView(ShowPatchNames);
#endif
@ -403,7 +396,7 @@ int vtkPV3FoamReader::RequestData
}
void vtkPV3FoamReader::addPatchNamesToView()
void vtkPV3FoamReader::updatePatchNamesView(const bool show)
{
pqApplicationCore* appCore = pqApplicationCore::instance();
@ -415,29 +408,10 @@ void vtkPV3FoamReader::addPatchNamesToView()
for (int viewI=0; viewI<renderViews.size(); viewI++)
{
foamData_->addPatchNames
foamData_->renderPatchNames
(
renderViews[viewI]->getRenderViewProxy()->GetRenderer()
);
}
}
void vtkPV3FoamReader::removePatchNamesFromView()
{
pqApplicationCore* appCore = pqApplicationCore::instance();
// Server manager model for querying items in the server manager
pqServerManagerModel* smModel = appCore->getServerManagerModel();
// Get all the pqRenderView instances
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
for (int viewI=0; viewI<renderViews.size(); viewI++)
{
foamData_->removePatchNames
(
renderViews[viewI]->getRenderViewProxy()->GetRenderer()
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
show
);
}
}

View File

@ -174,11 +174,8 @@ private:
//- Disallow default bitwise assignment
void operator=(const vtkPV3FoamReader&);
//- Add patch names to the view
void addPatchNamesToView();
//- Remove patch names from the view
void removePatchNamesFromView();
//- Add/remove patch names to/from the view
void updatePatchNamesView(const bool show);
int TimeStepRange[2];
int CacheMesh;

View File

@ -7,6 +7,6 @@ vtkPV3FoamMeshSet.C
vtkPV3FoamMeshVolume.C
vtkPV3FoamMeshZone.C
vtkPV3FoamUpdateInfo.C
vtkPV3FoamUtilities.C
vtkPV3FoamUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPV3Foam

View File

@ -27,15 +27,15 @@ InClass
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamPoints_H
#define vtkPV3FoamPoints_H
#ifndef vtkOpenFOAMPoints_H
#define vtkOpenFOAMPoints_H
// VTK includes
#include "vtkPoints.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline void vtkPV3FoamInsertNextPoint
inline void vtkInsertNextOpenFOAMPoint
(
vtkPoints *points,
const Foam::point& p
@ -46,7 +46,7 @@ inline void vtkPV3FoamInsertNextPoint
#if 0
// this should be faster, but didn't get it working ...
inline void vtkPV3FoamSetPoint
inline void vtkSetOpenFOAMPoint
(
vtkPoints *points,
const Foam::label id,
@ -58,7 +58,7 @@ inline void vtkPV3FoamSetPoint
// Convert Foam mesh vertices to VTK
inline vtkPoints* vtkPV3FoamVTKPoints(const Foam::pointField& points)
inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points)
{
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->SetNumberOfPoints(points.size());

View File

@ -590,220 +590,204 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
}
void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
void Foam::vtkPV3Foam::renderPatchNames(vtkRenderer* renderer, const bool show)
{
// Remove any patch names previously added to the renderer
removePatchNames(renderer);
// always remove old actors first
// get the display patches, strip off any suffix
wordHashSet selectedPatches = getSelected
(
reader_->GetPartSelection(),
partInfoPatches_
);
if (!selectedPatches.size())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::addPatchNames" << nl
<<"... add patches: " << selectedPatches << endl;
}
const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh();
// Find the total number of zones
// Each zone will take the patch name
// Number of zones per patch ... zero zones should be skipped
labelList nZones(pbMesh.size(), 0);
// Per global zone number the average face centre position
DynamicList<point> zoneCentre(pbMesh.size());
if (debug)
{
Info<< "... determining patch zones" << endl;
}
// Loop through all patches to determine zones, and centre of each zone
forAll(pbMesh, patchI)
{
const polyPatch& pp = pbMesh[patchI];
// Only include the patch if it is selected
if (!selectedPatches.found(pp.name()))
{
continue;
}
const labelListList& edgeFaces = pp.edgeFaces();
const vectorField& n = pp.faceNormals();
boolList featEdge(pp.nEdges(), false);
forAll(edgeFaces, edgeI)
{
const labelList& eFaces = edgeFaces[edgeI];
if (eFaces.size() == 1)
{
// Note: could also do ones with > 2 faces but this gives
// too many zones for baffles
featEdge[edgeI] = true;
}
else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5)
{
featEdge[edgeI] = true;
}
}
// Do topological analysis of patch, find disconnected regions
patchZones pZones(pp, featEdge);
nZones[patchI] = pZones.nZones();
labelList zoneNFaces(pZones.nZones(), 0);
// Save start of information for current patch
label patchStart = zoneCentre.size();
// Create storage for additional zone centres
forAll(zoneNFaces, zoneI)
{
zoneCentre.append(vector::zero);
}
// Do averaging per individual zone
forAll(pp, faceI)
{
label zoneI = pZones[faceI];
zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points());
zoneNFaces[zoneI]++;
}
for (label i=0; i<nZones[patchI]; i++)
{
zoneCentre[patchStart + i] /= zoneNFaces[i];
}
}
// Count number of zones we're actually going to display. This is truncated
// to a max per patch
const label MAXPATCHZONES = 20;
label displayZoneI = 0;
forAll(pbMesh, patchI)
{
displayZoneI += min(MAXPATCHZONES, nZones[patchI]);
}
zoneCentre.shrink();
if (debug)
{
Info<< "patch zone centres = " << zoneCentre << nl
<< "displayed zone centres = " << displayZoneI << nl
<< "zones per patch = " << nZones << endl;
}
// Set the size of the patch labels to max number of zones
patchTextActorsPtrs_.setSize(displayZoneI);
if (debug)
{
Info<< "constructing patch labels" << endl;
}
// Actor index
displayZoneI = 0;
// Index in zone centres
label globalZoneI = 0;
forAll(pbMesh, patchI)
{
const polyPatch& pp = pbMesh[patchI];
// Only selected patches will have a non-zero number of zones
label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]);
label increment = 1;
if (nZones[patchI] >= MAXPATCHZONES)
{
increment = nZones[patchI]/MAXPATCHZONES;
}
for (label i = 0; i < nDisplayZones; i++)
{
if (debug)
{
Info<< "patch name = " << pp.name() << nl
<< "anchor = " << zoneCentre[globalZoneI] << nl
<< "globalZoneI = " << globalZoneI << endl;
}
vtkTextActor* txt = vtkTextActor::New();
txt->SetInput(pp.name().c_str());
// Set text properties
vtkTextProperty* tprop = txt->GetTextProperty();
tprop->SetFontFamilyToArial();
tprop->BoldOff();
tprop->ShadowOff();
tprop->SetLineSpacing(1.0);
tprop->SetFontSize(12);
tprop->SetColor(1.0, 0.0, 0.0);
tprop->SetJustificationToCentered();
// Set text to use 3-D world co-ordinates
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
txt->GetPositionCoordinate()->SetValue
(
zoneCentre[globalZoneI].x(),
zoneCentre[globalZoneI].y(),
zoneCentre[globalZoneI].z()
);
// Add text to each renderer
renderer->AddViewProp(txt);
// Maintain a list of text labels added so that they can be
// removed later
patchTextActorsPtrs_[displayZoneI] = txt;
globalZoneI += increment;
displayZoneI++;
}
}
// Resize the patch names list to the actual number of patch names added
patchTextActorsPtrs_.setSize(displayZoneI);
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::addPatchNames" << endl;
}
}
void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer)
{
forAll(patchTextActorsPtrs_, patchI)
{
renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]);
patchTextActorsPtrs_[patchI]->Delete();
}
patchTextActorsPtrs_.clear();
if (show)
{
// get the display patches, strip off any suffix
wordHashSet selectedPatches = getSelected
(
reader_->GetPartSelection(),
partInfoPatches_
);
if (!selectedPatches.size())
{
return;
}
const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh();
// Find the total number of zones
// Each zone will take the patch name
// Number of zones per patch ... zero zones should be skipped
labelList nZones(pbMesh.size(), 0);
// Per global zone number the average face centre position
DynamicList<point> zoneCentre(pbMesh.size());
// Loop through all patches to determine zones, and centre of each zone
forAll(pbMesh, patchI)
{
const polyPatch& pp = pbMesh[patchI];
// Only include the patch if it is selected
if (!selectedPatches.found(pp.name()))
{
continue;
}
const labelListList& edgeFaces = pp.edgeFaces();
const vectorField& n = pp.faceNormals();
boolList featEdge(pp.nEdges(), false);
forAll(edgeFaces, edgeI)
{
const labelList& eFaces = edgeFaces[edgeI];
if (eFaces.size() == 1)
{
// Note: could also do ones with > 2 faces but this gives
// too many zones for baffles
featEdge[edgeI] = true;
}
else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5)
{
featEdge[edgeI] = true;
}
}
// Do topological analysis of patch, find disconnected regions
patchZones pZones(pp, featEdge);
nZones[patchI] = pZones.nZones();
labelList zoneNFaces(pZones.nZones(), 0);
// Save start of information for current patch
label patchStart = zoneCentre.size();
// Create storage for additional zone centres
forAll(zoneNFaces, zoneI)
{
zoneCentre.append(vector::zero);
}
// Do averaging per individual zone
forAll(pp, faceI)
{
label zoneI = pZones[faceI];
zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points());
zoneNFaces[zoneI]++;
}
for (label i=0; i<nZones[patchI]; i++)
{
zoneCentre[patchStart + i] /= zoneNFaces[i];
}
}
// Count number of zones we're actually going to display. This is truncated
// to a max per patch
const label MAXPATCHZONES = 20;
label displayZoneI = 0;
forAll(pbMesh, patchI)
{
displayZoneI += min(MAXPATCHZONES, nZones[patchI]);
}
zoneCentre.shrink();
if (debug)
{
Info<< "patch zone centres = " << zoneCentre << nl
<< "displayed zone centres = " << displayZoneI << nl
<< "zones per patch = " << nZones << endl;
}
// Set the size of the patch labels to max number of zones
patchTextActorsPtrs_.setSize(displayZoneI);
if (debug)
{
Info<< "constructing patch labels" << endl;
}
// Actor index
displayZoneI = 0;
// Index in zone centres
label globalZoneI = 0;
forAll(pbMesh, patchI)
{
const polyPatch& pp = pbMesh[patchI];
// Only selected patches will have a non-zero number of zones
label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]);
label increment = 1;
if (nZones[patchI] >= MAXPATCHZONES)
{
increment = nZones[patchI]/MAXPATCHZONES;
}
for (label i = 0; i < nDisplayZones; i++)
{
if (debug)
{
Info<< "patch name = " << pp.name() << nl
<< "anchor = " << zoneCentre[globalZoneI] << nl
<< "globalZoneI = " << globalZoneI << endl;
}
vtkTextActor* txt = vtkTextActor::New();
txt->SetInput(pp.name().c_str());
// Set text properties
vtkTextProperty* tprop = txt->GetTextProperty();
tprop->SetFontFamilyToArial();
tprop->BoldOff();
tprop->ShadowOff();
tprop->SetLineSpacing(1.0);
tprop->SetFontSize(12);
tprop->SetColor(1.0, 0.0, 0.0);
tprop->SetJustificationToCentered();
// Set text to use 3-D world co-ordinates
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
txt->GetPositionCoordinate()->SetValue
(
zoneCentre[globalZoneI].x(),
zoneCentre[globalZoneI].y(),
zoneCentre[globalZoneI].z()
);
// Add text to each renderer
renderer->AddViewProp(txt);
// Maintain a list of text labels added so that they can be
// removed later
patchTextActorsPtrs_[displayZoneI] = txt;
globalZoneI += increment;
displayZoneI++;
}
}
// Resize the patch names list to the actual number of patch names added
patchTextActorsPtrs_.setSize(displayZoneI);
}
}
void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const
{
os << indent << "Number of nodes: "

View File

@ -31,7 +31,6 @@ Description
SourceFiles
vtkPV3Foam.C
vtkPV3Foam.H
vtkPV3FoamI.H
vtkPV3FoamFields.C
vtkPV3FoamMesh.C
vtkPV3FoamMeshLagrangian.C
@ -46,7 +45,7 @@ SourceFiles
vtkPV3FoamPoints.H
vtkPV3FoamUpdateInfo.C
vtkPV3FoamUpdateInfoFields.H
vtkPV3FoamUtilities.C
vtkPV3FoamUtils.C
vtkPV3FoamVolFields.H
vtkPV3FoamAddToSelection.H
@ -316,7 +315,7 @@ class vtkPV3Foam
vtkDataSet* dataset,
const partInfo&,
const label datasetNo,
const string& datasetName
const std::string& datasetName
);
// Convenience method use to convert the readers from VTK 5
@ -627,9 +626,6 @@ class vtkPV3Foam
// GUI selection helper functions
//- Extract up to the first non-word characters
inline static word getFirstWord(const char*);
//- Only keep what is listed in hashSet
static void pruneObjectList
(
@ -715,11 +711,8 @@ public:
// returns the count via the parameter
double* findTimes(int& nTimeSteps);
//- Add patch names to the display
void addPatchNames(vtkRenderer* renderer);
//- Remove patch names from the display
void removePatchNames(vtkRenderer* renderer);
//- Add/remove patch names to/from the view
void renderPatchNames(vtkRenderer*, const bool show);
//- set the runTime to the first plausible request time,
// returns the timeIndex
@ -751,8 +744,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "vtkPV3FoamI.H"
#endif
// ************************************************************************* //

View File

@ -33,7 +33,7 @@ Description
#include "fvMesh.H"
#include "IOobjectList.H"
#include "passiveParticle.H"
#include "vtkPV3FoamPoints.H"
#include "vtkOpenFOAMPoints.H"
// VTK includes
#include "vtkCellArray.h"
@ -86,7 +86,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
vtkIdType particleId = 0;
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
{
vtkPV3FoamInsertNextPoint(vtkpoints, iter().position());
vtkInsertNextOpenFOAMPoint(vtkpoints, iter().position());
vtkcells->InsertNextCell(1, &particleId);
particleId++;

View File

@ -31,7 +31,7 @@ Description
// Foam includes
#include "polyPatch.H"
#include "primitivePatch.H"
#include "vtkPV3FoamPoints.H"
#include "vtkOpenFOAMPoints.H"
// VTK includes
#include "vtkCellArray.h"
@ -60,7 +60,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
vtkpoints->Allocate( points.size() );
forAll(points, i)
{
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
}
vtkmesh->SetPoints(vtkpoints);

View File

@ -31,7 +31,7 @@ Description
// Foam includes
#include "faceSet.H"
#include "pointSet.H"
#include "vtkPV3FoamPoints.H"
#include "vtkOpenFOAMPoints.H"
// VTK includes
#include "vtkPoints.h"
@ -75,7 +75,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
vtkpoints->Allocate( points.size() );
forAll(points, i)
{
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
@ -132,7 +132,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh
forAllConstIter(pointSet, pSet, iter)
{
vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]);
vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[iter.key()]);
}
vtkmesh->SetPoints(vtkpoints);

View File

@ -31,7 +31,7 @@ Description
// Foam includes
#include "fvMesh.H"
#include "cellModeller.H"
#include "vtkPV3FoamPoints.H"
#include "vtkOpenFOAMPoints.H"
// VTK includes
#include "vtkCellArray.h"
@ -143,7 +143,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
forAll(points, i)
{
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
}
@ -267,7 +267,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
// Insert the new vertex from the cell-centre
label newVertexLabel = mesh.nPoints() + addPointI;
vtkPV3FoamInsertNextPoint(vtkpoints, mesh.C()[cellI]);
vtkInsertNextOpenFOAMPoint(vtkpoints, mesh.C()[cellI]);
// Whether to insert cell in place of original or not.
bool substituteCell = true;

View File

@ -29,7 +29,7 @@ Description
#include "vtkPV3Foam.H"
// Foam includes
#include "vtkPV3FoamPoints.H"
#include "vtkOpenFOAMPoints.H"
// VTK includes
#include "vtkPoints.h"
@ -72,7 +72,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
vtkpoints->Allocate( points.size() );
forAll(points, i)
{
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
}
vtkmesh->SetPoints(vtkpoints);
@ -131,7 +131,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
forAll(pointLabels, pointI)
{
vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[pointLabels[pointI]]);
vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[pointLabels[pointI]]);
}
vtkmesh->SetPoints(vtkpoints);

View File

@ -41,6 +41,34 @@ Description
#include "vtkMultiBlockDataSet.h"
#include "vtkInformation.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
//! @cond fileScope
// Extract up to the first non-word characters
inline word getFirstWord(const char* str)
{
if (str)
{
label n = 0;
while (str[n] && word::valid(str[n]))
{
++n;
}
return word(str, n, true);
}
else
{
return word::null;
}
}
//! @endcond fileScope
} // End namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::vtkPV3Foam::AddToBlock
@ -49,7 +77,7 @@ void Foam::vtkPV3Foam::AddToBlock
vtkDataSet* dataset,
const partInfo& selector,
const label datasetNo,
const string& datasetName
const std::string& datasetName
)
{
const int blockNo = selector.block();

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
rm -rf PV3blockMeshReader/Make
wclean libso vtkPV3blockMesh
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,21 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
case "$ParaView_VERSION" in
3*)
wmake libso vtkPV3blockMesh
(
cd PV3blockMeshReader
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
cd Make/$WM_OPTIONS
cmake ../..
make
)
;;
esac
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,56 @@
# create a plugin that adds a reader to the ParaView GUI
# it is added in the file dialog when doing opens/saves.
# The qrc file is processed by Qt's resource compiler (rcc)
# the qrc file must have a resource prefix of "/ParaViewResources"
# and ParaView will read anything contained under that prefix
# the pqReader.xml file contains xml defining readers with their
# file extensions and descriptions.
cmake_minimum_required(VERSION 2.4)
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})
LINK_DIRECTORIES(
$ENV{FOAM_LIBBIN}
)
INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/meshing/blockMesh/lnInclude
${PROJECT_SOURCE_DIR}/../vtkPV3blockMesh
)
ADD_DEFINITIONS(
-DWM_$ENV{WM_PRECISION_OPTION}
)
# Set output library destination to plugin folder
SET(
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
CACHE INTERNAL
"Single output directory for building all libraries."
)
# Build the server-side plugin
ADD_PARAVIEW_PLUGIN(
PV3blockMeshReader_SM "1.0"
SERVER_MANAGER_XML PV3blockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPV3blockMeshReader.cxx
)
# Build the client-side plugin
ADD_PARAVIEW_PLUGIN(
PV3blockMeshReader
"1.0"
GUI_RESOURCES PV3blockMeshReader.qrc
)
TARGET_LINK_LIBRARIES(
PV3blockMeshReader_SM
OpenFOAM
blockMesh
vtkPV3blockMesh
)
#-----------------------------------------------------------------------------

View File

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

View File

@ -0,0 +1,6 @@
<ParaViewReaders>
<Reader name="PV3blockMeshReader"
extensions="blockMesh"
file_description="OpenFOAM blockMesh reader">
</Reader>
</ParaViewReaders>

View File

@ -0,0 +1,98 @@
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy
name="PV3blockMeshReader"
class="vtkPV3blockMeshReader">
<!-- File name - compulsory -->
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1"
animateable="0">
<FileListDomain name="files"/>
<Documentation>
Specifies the filename for the OpenFOAM blockMesh Reader.
</Documentation>
</StringVectorProperty>
<!-- Global settings -->
<!-- Show Point Numbers check-box -->
<IntVectorProperty
name="ShowPointNumbers"
command="SetShowPointNumbers"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show point numbers in render window.
</Documentation>
</IntVectorProperty>
<!-- Update GUI check box -->
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
A simple way to cause a reader GUI modification.
</Documentation>
</IntVectorProperty>
<!-- Selections -->
<!-- Available Parts (blocks) array -->
<StringVectorProperty
name="PartArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Part"/>
</StringVectorProperty>
<StringVectorProperty
name="PartStatus"
label="Blocks"
command="SetPartArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PartArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PartArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available Parts (blocks) array -->
<StringVectorProperty
name="CurvedEdgesArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
</StringVectorProperty>
<StringVectorProperty
name="CurvedEdgesStatus"
label="Curved Edges"
command="SetCurvedEdgesArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="CurvedEdgesArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="CurvedEdgesArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>

View File

@ -0,0 +1,381 @@
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkPV3blockMeshReader.cxx,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkPV3blockMeshReader.h"
#include "pqApplicationCore.h"
#include "pqRenderView.h"
#include "pqServerManagerModel.h"
// VTK includes
#include "vtkCallbackCommand.h"
#include "vtkDataArraySelection.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkObjectFactory.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkStringArray.h"
// Foam includes
#include "vtkPV3blockMesh.H"
vtkCxxRevisionMacro(vtkPV3blockMeshReader, "$Revision: 1.5$");
vtkStandardNewMacro(vtkPV3blockMeshReader);
vtkPV3blockMeshReader::vtkPV3blockMeshReader()
{
Debug = 0;
vtkDebugMacro(<<"Constructor");
SetNumberOfInputPorts(0);
FileName = NULL;
foamData_ = NULL;
ShowPointNumbers = 1;
UpdateGUI = 0;
PartSelection = vtkDataArraySelection::New();
CurvedEdgesSelection = vtkDataArraySelection::New();
// Setup the selection callback to modify this object when an array
// selection is changed.
SelectionObserver = vtkCallbackCommand::New();
SelectionObserver->SetCallback
(
&vtkPV3blockMeshReader::SelectionModifiedCallback
);
SelectionObserver->SetClientData(this);
PartSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
CurvedEdgesSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
}
vtkPV3blockMeshReader::~vtkPV3blockMeshReader()
{
vtkDebugMacro(<<"Deconstructor");
delete foamData_;
if (FileName)
{
delete [] FileName;
}
PartSelection->RemoveObserver(this->SelectionObserver);
CurvedEdgesSelection->RemoveObserver(this->SelectionObserver);
SelectionObserver->Delete();
PartSelection->Delete();
}
// Do everything except set the output info
int vtkPV3blockMeshReader::RequestInformation
(
vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector),
vtkInformationVector* outputVector
)
{
vtkDebugMacro(<<"RequestInformation");
if (Foam::vtkPV3blockMesh::debug)
{
cout<<"REQUEST_INFORMATION\n";
}
if (!FileName)
{
vtkErrorMacro("FileName has to be specified!");
return 0;
}
int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV3blockMesh::debug)
{
cout<<"RequestInformation with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI)
{
outputVector->GetInformationObject(infoI)->Print(cout);
}
}
if (!foamData_)
{
foamData_ = new Foam::vtkPV3blockMesh(FileName, this);
}
else
{
foamData_->updateInfo();
}
// might need some other type of error handling
// {
// vtkErrorMacro("could not find valid OpenFOAM blockMesh");
//
// // delete foamData and flag it as fatal error
// delete foamData_;
// foamData_ = NULL;
// return 0;
// }
return 1;
}
// Set the output info
int vtkPV3blockMeshReader::RequestData
(
vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector),
vtkInformationVector* outputVector
)
{
vtkDebugMacro(<<"RequestData");
if (!FileName)
{
vtkErrorMacro("FileName has to be specified!");
return 0;
}
// catch previous error
if (!foamData_)
{
vtkErrorMacro("Reader failed - perhaps no mesh?");
return 0;
}
int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV3blockMesh::debug)
{
cout<<"RequestData with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI)
{
outputVector->GetInformationObject(infoI)->Print(cout);
}
}
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
(
outputVector->GetInformationObject(0)->Get
(
vtkMultiBlockDataSet::DATA_OBJECT()
)
);
if (Foam::vtkPV3blockMesh::debug)
{
cout<< "update output with "
<< output->GetNumberOfBlocks() << " blocks\n";
}
foamData_->Update(output);
updatePointNumbersView(ShowPointNumbers);
// Do any cleanup on the Foam side
foamData_->CleanUp();
return 1;
}
void vtkPV3blockMeshReader::updatePointNumbersView(const bool show)
{
pqApplicationCore* appCore = pqApplicationCore::instance();
// Server manager model for querying items in the server manager
pqServerManagerModel* smModel = appCore->getServerManagerModel();
// Get all the pqRenderView instances
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
for (int viewI=0; viewI<renderViews.size(); ++viewI)
{
foamData_->renderPointNumbers
(
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
show
);
}
}
void vtkPV3blockMeshReader::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDebugMacro(<<"PrintSelf");
this->Superclass::PrintSelf(os,indent);
os<< indent << "File name: "
<< (this->FileName ? this->FileName : "(none)") << "\n";
foamData_->PrintSelf(os, indent);
}
// ----------------------------------------------------------------------
// Parts selection list control
vtkDataArraySelection* vtkPV3blockMeshReader::GetPartSelection()
{
vtkDebugMacro(<<"GetPartSelection");
return PartSelection;
}
int vtkPV3blockMeshReader::GetNumberOfPartArrays()
{
vtkDebugMacro(<<"GetNumberOfPartArrays");
return PartSelection->GetNumberOfArrays();
}
const char* vtkPV3blockMeshReader::GetPartArrayName(int index)
{
vtkDebugMacro(<<"GetPartArrayName");
return PartSelection->GetArrayName(index);
}
int vtkPV3blockMeshReader::GetPartArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetPartArrayStatus");
return PartSelection->ArrayIsEnabled(name);
}
void vtkPV3blockMeshReader::SetPartArrayStatus
(
const char* name,
int status
)
{
vtkDebugMacro(<<"SetPartArrayStatus");
if (status)
{
PartSelection->EnableArray(name);
}
else
{
PartSelection->DisableArray(name);
}
}
// ----------------------------------------------------------------------
// CurvedEdges selection list control
vtkDataArraySelection* vtkPV3blockMeshReader::GetCurvedEdgesSelection()
{
vtkDebugMacro(<<"GetCurvedEdgesSelection");
return CurvedEdgesSelection;
}
int vtkPV3blockMeshReader::GetNumberOfCurvedEdgesArrays()
{
vtkDebugMacro(<<"GetNumberOfCurvedEdgesArrays");
return CurvedEdgesSelection->GetNumberOfArrays();
}
const char* vtkPV3blockMeshReader::GetCurvedEdgesArrayName(int index)
{
vtkDebugMacro(<<"GetCurvedEdgesArrayName");
return CurvedEdgesSelection->GetArrayName(index);
}
int vtkPV3blockMeshReader::GetCurvedEdgesArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetCurvedEdgesArrayStatus");
return CurvedEdgesSelection->ArrayIsEnabled(name);
}
void vtkPV3blockMeshReader::SetCurvedEdgesArrayStatus
(
const char* name,
int status
)
{
vtkDebugMacro(<<"SetCurvedEdgesArrayStatus");
if (status)
{
CurvedEdgesSelection->EnableArray(name);
}
else
{
CurvedEdgesSelection->DisableArray(name);
}
}
// ----------------------------------------------------------------------
void vtkPV3blockMeshReader::SelectionModifiedCallback
(
vtkObject*,
unsigned long,
void* clientdata,
void*
)
{
static_cast<vtkPV3blockMeshReader*>(clientdata)->SelectionModified();
}
void vtkPV3blockMeshReader::SelectionModified()
{
vtkDebugMacro(<<"SelectionModified");
Modified();
}
int vtkPV3blockMeshReader::FillOutputPortInformation
(
int port,
vtkInformation* info
)
{
if (port == 0)
{
return this->Superclass::FillOutputPortInformation(port, info);
}
info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet");
return 1;
}
// ************************************************************************* //

View File

@ -0,0 +1,153 @@
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkPV3blockMeshReader.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPV3blockMeshReader - reads a dataset in OpenFOAM bockMesh format
// .SECTION Description
// vtkPV3blockMeshReader creates an multiblock dataset.
// It uses the OpenFOAM infrastructure (blockMesh).
#ifndef __vtkPV3blockMeshReader_h
#define __vtkPV3blockMeshReader_h
// Foam forward declarations
namespace Foam
{
class vtkPV3blockMesh;
}
// VTK includes
#include "vtkMultiBlockDataSetAlgorithm.h"
// VTK forward declarations
class vtkDataArraySelection;
class vtkCallbackCommand;
class VTK_IO_EXPORT vtkPV3blockMeshReader
:
public vtkMultiBlockDataSetAlgorithm
{
public:
vtkTypeRevisionMacro(vtkPV3blockMeshReader,vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream&, vtkIndent);
static vtkPV3blockMeshReader* New();
// Description:
// Set/Get the filename.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
// Description:
// GUI update control
vtkSetMacro(UpdateGUI, int);
vtkGetMacro(UpdateGUI, int);
// Description:
// FOAM display patch names control
vtkSetMacro(ShowPointNumbers, int);
vtkGetMacro(ShowPointNumbers, int);
// Description:
// Parts (blocks) selection list control
vtkDataArraySelection* GetPartSelection();
int GetNumberOfPartArrays();
int GetPartArrayStatus(const char*);
void SetPartArrayStatus(const char*, int status);
const char* GetPartArrayName(int index);
// Description:
// Parts (blocks) selection list control
vtkDataArraySelection* GetCurvedEdgesSelection();
int GetNumberOfCurvedEdgesArrays();
int GetCurvedEdgesArrayStatus(const char*);
void SetCurvedEdgesArrayStatus(const char*, int status);
const char* GetCurvedEdgesArrayName(int index);
// Description:
// Callback registered with the SelectionObserver
// for all the selection lists
static void SelectionModifiedCallback
(
vtkObject* caller,
unsigned long eid,
void* clientdata,
void* calldata
);
void SelectionModified();
protected:
//- Construct null
vtkPV3blockMeshReader();
//- Destructor
~vtkPV3blockMeshReader();
//- Return information about mesh, times, etc without loading anything
virtual int RequestInformation
(
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*
);
//- Get the mesh/fields for a particular time
virtual int RequestData
(
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*
);
//- Fill in additional port information
virtual int FillOutputPortInformation(int, vtkInformation*);
// The observer to modify this object when array selections are modified
vtkCallbackCommand* SelectionObserver;
char* FileName;
private:
//- Disallow default bitwise copy construct
vtkPV3blockMeshReader(const vtkPV3blockMeshReader&);
//- Disallow default bitwise assignment
void operator=(const vtkPV3blockMeshReader&);
//- Add/remove point numbers to/from the view
void updatePointNumbersView(const bool show);
int ShowPointNumbers;
//- Dummy variable/switch to invoke a reader update
int UpdateGUI;
vtkDataArraySelection* PartSelection;
vtkDataArraySelection* CurvedEdgesSelection;
//BTX
Foam::vtkPV3blockMesh* foamData_;
//ETX
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,5 @@
vtkPV3blockMesh.C
vtkPV3blockMeshConvert.C
vtkPV3blockMeshUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPV3blockMesh

View File

@ -0,0 +1,15 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
-I$(ParaView_DIR)/VTK \
-I$(ParaView_INST_DIR) \
-I$(ParaView_INST_DIR)/VTK \
-I$(ParaView_INST_DIR)/VTK/Common \
-I$(ParaView_INST_DIR)/VTK/Filtering \
-I$(ParaView_INST_DIR)/VTK/Rendering \
-I../PV3blockMeshReader
LIB_LIBS = \
-lmeshTools \
-lblockMesh \
$(GLIBS)

View File

@ -22,27 +22,30 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
vtkPV3blockMesh
\*---------------------------------------------------------------------------*/
#ifndef vtkOpenFOAMPoints_H
#define vtkOpenFOAMPoints_H
// VTK includes
#include "vtkPoints.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str)
inline void vtkInsertNextOpenFOAMPoint
(
vtkPoints *points,
const Foam::point& p
)
{
if (str)
{
label n = 0;
while (str[n] && word::valid(str[n]))
{
++n;
}
return word(str, n, true);
}
else
{
return word::null;
}
points->InsertNextPoint(p.x(), p.y(), p.z());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,433 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "vtkPV3blockMesh.H"
#include "vtkPV3blockMeshReader.h"
// Foam includes
#include "blockMesh.H"
#include "Time.H"
#include "patchZones.H"
#include "OStringStream.H"
// VTK includes
#include "vtkDataArraySelection.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkRenderer.h"
#include "vtkTextActor.h"
#include "vtkTextProperty.h"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::vtkPV3blockMesh, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::vtkPV3blockMesh::resetCounters()
{
// Reset mesh part ids and sizes
partInfoBlocks_.reset();
partInfoEdges_.reset();
partInfoCorners_.reset();
}
void Foam::vtkPV3blockMesh::updateInfoBlocks()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoBlocks"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
}
vtkDataArraySelection* selection = reader_->GetPartSelection();
partInfoBlocks_ = selection->GetNumberOfArrays();
const blockMesh& blkMesh = *meshPtr_;
const int nBlocks = blkMesh.size();
for (int blockI = 0; blockI < nBlocks; ++blockI)
{
const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
word partName = Foam::name(blockI);
// append the (optional) zone name
if (!blockDef.zoneName().empty())
{
partName += " - " + blockDef.zoneName();
}
// Add blockId and zoneName to GUI list
selection->AddArray(partName.c_str());
}
partInfoBlocks_ += nBlocks;
if (debug)
{
// just for debug info
getSelectedArrayEntries(selection);
Info<< "<end> Foam::vtkPV3blockMesh::updateInfoBlocks" << endl;
}
}
void Foam::vtkPV3blockMesh::updateInfoEdges()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoEdges"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
}
vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
partInfoEdges_ = selection->GetNumberOfArrays();
const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges();
const int nEdges = edges.size();
forAll(edges, edgeI)
{
OStringStream ostr;
ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
<< edges[edgeI].type();
// Add "beg:end - type" to GUI list
selection->AddArray(ostr.str().c_str());
}
partInfoEdges_ += nEdges;
if (debug)
{
// just for debug info
getSelectedArrayEntries(selection);
Info<< "<end> Foam::vtkPV3blockMesh::updateInfoEdges" << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::vtkPV3blockMesh::vtkPV3blockMesh
(
const char* const FileName,
vtkPV3blockMeshReader* reader
)
:
reader_(reader),
dbPtr_(NULL),
meshPtr_(NULL),
partInfoBlocks_("block"),
partInfoEdges_("edges"),
partInfoCorners_("corners")
{
if (debug)
{
Info<< "Foam::vtkPV3blockMesh::vtkPV3blockMesh - "
<< FileName << endl;
}
// avoid argList and get rootPath/caseName directly from the file
fileName fullCasePath(fileName(FileName).path());
if (!isDir(fullCasePath))
{
return;
}
if (fullCasePath == ".")
{
fullCasePath = cwd();
}
// Set the case as an environment variable - some BCs might use this
if (fullCasePath.name().find("processor", 0) == 0)
{
const fileName globalCase = fullCasePath.path();
setEnv("FOAM_CASE", globalCase, true);
setEnv("FOAM_CASENAME", globalCase.name(), true);
}
else
{
setEnv("FOAM_CASE", fullCasePath, true);
setEnv("FOAM_CASENAME", fullCasePath.name(), true);
}
// look for 'case{region}.OpenFOAM'
// could be stringent and insist the prefix match the directory name...
// Note: cannot use fileName::name() due to the embedded '{}'
string caseName(fileName(FileName).lessExt());
if (debug)
{
Info<< "fullCasePath=" << fullCasePath << nl
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << endl;
}
// Create time object
dbPtr_.reset
(
new Time
(
Time::controlDictName,
fileName(fullCasePath.path()),
fileName(fullCasePath.name())
)
);
dbPtr_().functionObjects().off();
updateInfo();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtkPV3blockMesh::~vtkPV3blockMesh()
{
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::~vtkPV3blockMesh" << endl;
}
delete meshPtr_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkPV3blockMesh::updateInfo()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] " << endl;
}
resetCounters();
vtkDataArraySelection* partSelection = reader_->GetPartSelection();
vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection();
// enable 'internalMesh' on the first call
// or preserve the enabled selections
stringList enabledParts;
stringList enabledEdges;
bool firstTime = false;
if (!partSelection->GetNumberOfArrays() && !meshPtr_)
{
firstTime = true;
}
else
{
enabledParts = getSelectedArrayEntries(partSelection);
enabledEdges = getSelectedArrayEntries(edgeSelection);
}
// Clear current mesh parts list
partSelection->RemoveAllArrays();
edgeSelection->RemoveAllArrays();
// need a blockMesh
updateFoamMesh();
// Update mesh parts list
updateInfoBlocks();
// Update curved edges list
updateInfoEdges();
// restore the enabled selections
if (!firstTime)
{
setSelectedArrayEntries(partSelection, enabledParts);
setSelectedArrayEntries(edgeSelection, enabledEdges);
}
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::updateInfo" << endl;
}
}
void Foam::vtkPV3blockMesh::updateFoamMesh()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateFoamMesh" << endl;
}
// Check to see if the FOAM mesh has been created
if (!meshPtr_)
{
if (debug)
{
Info<< "Creating blockMesh at time=" << dbPtr_().timeName()
<< endl;
}
IOdictionary meshDict
(
IOobject
(
"blockMeshDict",
dbPtr_().constant(),
polyMesh::meshSubDir,
dbPtr_(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
meshPtr_ = new blockMesh(meshDict);
}
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::updateFoamMesh" << endl;
}
}
void Foam::vtkPV3blockMesh::Update
(
vtkMultiBlockDataSet* output
)
{
reader_->UpdateProgress(0.1);
// Set up mesh parts selection(s)
updateBoolListStatus(partStatus_, reader_->GetPartSelection());
// Set up curved edges selection(s)
updateBoolListStatus(edgeStatus_, reader_->GetCurvedEdgesSelection());
reader_->UpdateProgress(0.2);
// Update the Foam mesh
updateFoamMesh();
reader_->UpdateProgress(0.5);
// Convert mesh elemente
int blockNo = 0;
convertMeshCorners(output, blockNo);
convertMeshBlocks(output, blockNo);
convertMeshEdges(output, blockNo);
reader_->UpdateProgress(0.8);
}
void Foam::vtkPV3blockMesh::CleanUp()
{
reader_->UpdateProgress(1.0);
}
void Foam::vtkPV3blockMesh::renderPointNumbers
(
vtkRenderer* renderer,
const bool show
)
{
// always remove old actors first
forAll(pointNumberTextActorsPtrs_, pointI)
{
renderer->RemoveViewProp(pointNumberTextActorsPtrs_[pointI]);
pointNumberTextActorsPtrs_[pointI]->Delete();
}
pointNumberTextActorsPtrs_.clear();
if (show && meshPtr_)
{
const pointField& cornerPts = meshPtr_->blockPointField();
pointNumberTextActorsPtrs_.setSize(cornerPts.size());
forAll(cornerPts, pointI)
{
vtkTextActor* txt = vtkTextActor::New();
txt->SetInput(Foam::name(pointI).c_str());
// Set text properties
vtkTextProperty* tprop = txt->GetTextProperty();
tprop->SetFontFamilyToArial();
tprop->BoldOn();
tprop->ShadowOff();
tprop->SetLineSpacing(1.0);
tprop->SetFontSize(14);
tprop->SetColor(1.0, 0.0, 1.0);
tprop->SetJustificationToCentered();
// Set text to use 3-D world co-ordinates
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
txt->GetPositionCoordinate()->SetValue
(
cornerPts[pointI].x(),
cornerPts[pointI].y(),
cornerPts[pointI].z()
);
// Add text to each renderer
renderer->AddViewProp(txt);
// Maintain a list of text labels added so that they can be
// removed later
pointNumberTextActorsPtrs_[pointI] = txt;
}
}
}
void Foam::vtkPV3blockMesh::PrintSelf(ostream& os, vtkIndent indent) const
{
#if 0
os << indent << "Number of nodes: "
<< (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n";
os << indent << "Number of cells: "
<< (meshPtr_ ? meshPtr_->nCells() : 0) << "\n";
os << indent << "Number of available time steps: "
<< (dbPtr_.valid() ? dbPtr_().times().size() : 0) << endl;
#endif
}
// ************************************************************************* //

View File

@ -0,0 +1,353 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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::vtkPV3blockMesh
Description
Provides a reader interface for OpenFOAM blockMesh to VTK interaction
SourceFiles
vtkPV3blockMesh.C
vtkPV3blockMeshConvert.C
vtkPV3blockMeshUpdate.C
vtkPV3blockMeshUtils.C
// Needed by VTK:
vtkDataArrayTemplateImplicit.txx
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3blockMesh_H
#define vtkPV3blockMesh_H
// do not include legacy strstream headers
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
# define VTK_EXCLUDE_STRSTREAM_HEADERS
#endif
#include "className.H"
#include "fileName.H"
#include "stringList.H"
#include "wordList.H"
#include "primitivePatch.H"
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
class vtkDataArraySelection;
class vtkDataSet;
class vtkPoints;
class vtkPV3blockMeshReader;
class vtkRenderer;
class vtkTextActor;
class vtkMultiBlockDataSet;
class vtkPolyData;
class vtkUnstructuredGrid;
class vtkIndent;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Foam class forward declarations
class argList;
class Time;
class blockMesh;
template<class Type> class List;
/*---------------------------------------------------------------------------*\
Class vtkPV3blockMesh Declaration
\*---------------------------------------------------------------------------*/
class vtkPV3blockMesh
{
// Private classes
//- Bookkeeping for GUI checklists and the multi-block organization
class partInfo
{
const char *name_;
int block_;
int start_;
int size_;
public:
partInfo(const char *name, const int blockNo=0)
:
name_(name),
block_(blockNo),
start_(-1),
size_(0)
{}
//- Return the block holding these datasets
int block() const
{
return block_;
}
//- Assign block number, return previous value
int block(int blockNo)
{
int prev = block_;
block_ = blockNo;
return prev;
}
const char* name() const
{
return name_;
}
int start() const
{
return start_;
}
int end() const
{
return start_ + size_;
}
int size() const
{
return size_;
}
bool empty() const
{
return !size_;
}
void reset()
{
start_ = -1;
size_ = 0;
}
//- Assign new start and reset the size
void operator=(const int i)
{
start_ = i;
size_ = 0;
}
//- Increment the size
void operator+=(const int n)
{
size_ += n;
}
};
// Private Data
//- Access to the controlling vtkPV3blockMeshReader
vtkPV3blockMeshReader* reader_;
//- Foam time control
autoPtr<Time> dbPtr_;
//- Foam mesh
blockMesh* meshPtr_;
//- Selected geometrical parts
boolList partStatus_;
//- Selected curved edges
boolList edgeStatus_;
//- First instance and size of bleckMesh blocks
// used to index into partStatus_
partInfo partInfoBlocks_;
//- First instance and size of CurvedEdges
// only partially used
partInfo partInfoEdges_;
//- First instance and size of block corners
// only partially used
partInfo partInfoCorners_;
//- List of point numbers for rendering to window
List<vtkTextActor*> pointNumberTextActorsPtrs_;
// Private Member Functions
// Convenience method use to convert the readers from VTK 5
// multiblock API to the current composite data infrastructure
static void AddToBlock
(
vtkMultiBlockDataSet* output,
vtkDataSet* dataset,
const partInfo&,
const label datasetNo,
const std::string& datasetName
);
// Convenience method use to convert the readers from VTK 5
// multiblock API to the current composite data infrastructure
static vtkDataSet* GetDataSetFromBlock
(
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo
);
// Convenience method use to convert the readers from VTK 5
// multiblock API to the current composite data infrastructure
static label GetNumberOfDataSets
(
vtkMultiBlockDataSet* output,
const partInfo&
);
//- Update boolList from GUI selection
static void updateBoolListStatus
(
boolList&,
vtkDataArraySelection*
);
//- Reset data counters
void resetCounters();
// Update information helper functions
//- Internal block info
void updateInfoBlocks();
//- block curved edges info
void updateInfoEdges();
// Update helper functions
//- Foam mesh
void updateFoamMesh();
// Mesh conversion functions
//- mesh blocks
void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo);
//- mesh curved edges
void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo);
//- mesh corners
void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo);
// GUI selection helper functions
//- Retrieve the current selections
static wordHashSet getSelected(vtkDataArraySelection*);
//- Retrieve a sub-list of the current selections
static wordHashSet getSelected
(
vtkDataArraySelection*,
const partInfo&
);
//- Retrieve the current selections
static stringList getSelectedArrayEntries(vtkDataArraySelection*);
//- Retrieve a sub-list of the current selections
static stringList getSelectedArrayEntries
(
vtkDataArraySelection*,
const partInfo&
);
//- Set selection(s)
static void setSelectedArrayEntries
(
vtkDataArraySelection*,
const stringList&
);
//- Disallow default bitwise copy construct
vtkPV3blockMesh(const vtkPV3blockMesh&);
//- Disallow default bitwise assignment
void operator=(const vtkPV3blockMesh&);
public:
//- Static data members
ClassName("vtkPV3blockMesh");
// Constructors
//- Construct from components
vtkPV3blockMesh
(
const char* const FileName,
vtkPV3blockMeshReader* reader
);
//- Destructor
~vtkPV3blockMesh();
// Member Functions
//- Update
void updateInfo();
void Update(vtkMultiBlockDataSet* output);
//- Clean any storage
void CleanUp();
//- Add/remove point numbers to/from the view
void renderPointNumbers(vtkRenderer*, const bool show);
// Access
//- Debug information
void PrintSelf(ostream&, vtkIndent) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,318 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV3blockMesh.H"
#include "vtkPV3blockMeshReader.h"
// Foam includes
#include "blockMesh.H"
#include "Time.H"
#include "vtkOpenFOAMPoints.H"
// VTK includes
#include "vtkCellArray.h"
#include "vtkDataArraySelection.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkUnstructuredGrid.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkPV3blockMesh::convertMeshBlocks
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
vtkDataArraySelection* selection = reader_->GetPartSelection();
partInfo& selector = partInfoBlocks_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const Foam::pointField& blockPoints = blkMesh.blockPointField();
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::convertMeshBlocks" << endl;
}
int blockI = 0;
for
(
int partId = selector.start();
partId < selector.end();
++partId, ++blockI
)
{
if (!partStatus_[partId])
{
continue;
}
const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
word partName("block");
// // append the (optional) zone name
// if (!blockDef.zoneName().empty())
// {
// partName += " - " + blockDef.zoneName();
// }
//
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
// Convert Foam mesh vertices to VTK
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate( blockDef.nPoints() );
const labelList& blockLabels = blockDef.blockShape();
vtkmesh->Allocate(1);
vtkIdType nodeIds[8];
forAll(blockLabels, ptI)
{
vtkInsertNextOpenFOAMPoint
(
vtkpoints,
blockPoints[blockLabels[ptI]]
);
nodeIds[ptI] = ptI;
}
vtkmesh->InsertNextCell
(
VTK_HEXAHEDRON,
8,
nodeIds
);
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
AddToBlock
(
output, vtkmesh, selector, datasetNo,
selection->GetArrayName(partId)
);
vtkmesh->Delete();
datasetNo++;
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::convertMeshBlocks" << endl;
}
}
void Foam::vtkPV3blockMesh::convertMeshEdges
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
partInfo& selector = partInfoEdges_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges();
int edgeI = 0;
for
(
int partId = selector.start();
partId < selector.end();
++partId, ++edgeI
)
{
if (!edgeStatus_[partId])
{
continue;
}
OStringStream ostr;
ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
<< edges[edgeI].type();
// search each block
forAll(blkMesh, blockI)
{
const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
edgeList blkEdges = blockDef.blockShape().edges();
// find the corresponding edge within the block
label foundEdgeI = -1;
forAll(blkEdges, blkEdgeI)
{
if (edges[edgeI].compare(blkEdges[blkEdgeI]))
{
foundEdgeI = blkEdgeI;
break;
}
}
if (foundEdgeI != -1)
{
const List<point>& edgePoints =
blockDef.blockEdgePoints()[foundEdgeI];
vtkPolyData* vtkmesh = vtkPolyData::New();
vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( edgePoints.size() );
vtkmesh->Allocate(1);
vtkIdType pointIds[edgePoints.size()];
forAll(edgePoints, ptI)
{
vtkInsertNextOpenFOAMPoint(vtkpoints, edgePoints[ptI]);
pointIds[ptI] = ptI;
}
vtkmesh->InsertNextCell
(
VTK_POLY_LINE,
edgePoints.size(),
pointIds
);
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
AddToBlock
(
output, vtkmesh, selector, datasetNo,
selection->GetArrayName(partId)
);
vtkmesh->Delete();
datasetNo++;
break;
}
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::convertMeshEdges" << endl;
}
}
void Foam::vtkPV3blockMesh::convertMeshCorners
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoCorners_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const pointField& blockPoints = meshPtr_->blockPointField();
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::convertMeshCorners" << endl;
}
if (true) // or some flag or other condition
{
vtkPolyData* vtkmesh = vtkPolyData::New();
vtkPoints* vtkpoints = vtkPoints::New();
vtkCellArray* vtkcells = vtkCellArray::New();
vtkpoints->Allocate( blockPoints.size() );
vtkcells->Allocate( blockPoints.size() );
vtkIdType pointId = 0;
forAll(blockPoints, ptI)
{
vtkInsertNextOpenFOAMPoint(vtkpoints, blockPoints[ptI]);
vtkcells->InsertNextCell(1, &pointId);
pointId++;
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
vtkmesh->SetVerts(vtkcells);
vtkcells->Delete();
AddToBlock(output, vtkmesh, selector, datasetNo, partInfoCorners_.name());
vtkmesh->Delete();
datasetNo++;
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::convertMeshCorners" << endl;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,358 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Description
Misc helper methods and utilities
\*---------------------------------------------------------------------------*/
#include "vtkPV3blockMesh.H"
#include "vtkPV3blockMeshReader.h"
// VTK includes
#include "vtkDataArraySelection.h"
#include "vtkDataSet.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkInformation.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
//! @cond fileScope
// Extract up to the first non-word characters
inline word getFirstWord(const char* str)
{
if (str)
{
label n = 0;
while (str[n] && word::valid(str[n]))
{
++n;
}
return word(str, n, true);
}
else
{
return word::null;
}
}
//! @endcond fileScope
} // End namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::vtkPV3blockMesh::AddToBlock
(
vtkMultiBlockDataSet* output,
vtkDataSet* dataset,
const partInfo& selector,
const label datasetNo,
const std::string& datasetName
)
{
const int blockNo = selector.block();
vtkDataObject* blockDO = output->GetBlock(blockNo);
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
if (!block)
{
if (blockDO)
{
FatalErrorIn("Foam::vtkPV3blockMesh::AddToBlock")
<< "Block already has a vtkDataSet assigned to it"
<< endl;
return;
}
block = vtkMultiBlockDataSet::New();
output->SetBlock(blockNo, block);
block->Delete();
}
if (debug)
{
Info<< "block[" << blockNo << "] has "
<< block->GetNumberOfBlocks()
<< " datasets prior to adding set " << datasetNo
<< " with name: " << datasetName << endl;
}
block->SetBlock(datasetNo, dataset);
// name the block when assigning dataset 0
if (datasetNo == 0)
{
output->GetMetaData(blockNo)->Set
(
vtkCompositeDataSet::NAME(),
selector.name()
);
}
if (datasetName.size())
{
block->GetMetaData(datasetNo)->Set
(
vtkCompositeDataSet::NAME(),
datasetName.c_str()
);
}
}
vtkDataSet* Foam::vtkPV3blockMesh::GetDataSetFromBlock
(
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo
)
{
const int blockNo = selector.block();
vtkDataObject* blockDO = output->GetBlock(blockNo);
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
if (block)
{
return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
}
return 0;
}
// ununsed at the moment
Foam::label Foam::vtkPV3blockMesh::GetNumberOfDataSets
(
vtkMultiBlockDataSet* output,
const partInfo& selector
)
{
const int blockNo = selector.block();
vtkDataObject* blockDO = output->GetBlock(blockNo);
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
if (block)
{
return block->GetNumberOfBlocks();
}
return 0;
}
Foam::wordHashSet Foam::vtkPV3blockMesh::getSelected
(
vtkDataArraySelection* select
)
{
int nElem = select->GetNumberOfArrays();
wordHashSet selections(2*nElem);
for (int elemI=0; elemI < nElem; ++elemI)
{
if (select->GetArraySetting(elemI))
{
selections.insert(getFirstWord(select->GetArrayName(elemI)));
}
}
return selections;
}
Foam::wordHashSet Foam::vtkPV3blockMesh::getSelected
(
vtkDataArraySelection* select,
const partInfo& selector
)
{
int nElem = select->GetNumberOfArrays();
wordHashSet selections(2*nElem);
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
{
if (select->GetArraySetting(elemI))
{
selections.insert(getFirstWord(select->GetArrayName(elemI)));
}
}
return selections;
}
Foam::stringList Foam::vtkPV3blockMesh::getSelectedArrayEntries
(
vtkDataArraySelection* select
)
{
stringList selections(select->GetNumberOfArrays());
label nElem = 0;
forAll(selections, elemI)
{
if (select->GetArraySetting(elemI))
{
selections[nElem++] = select->GetArrayName(elemI);
}
}
selections.setSize(nElem);
if (debug)
{
label nElem = select->GetNumberOfArrays();
Info<< "available(";
for (int elemI = 0; elemI < nElem; ++elemI)
{
Info<< " \"" << select->GetArrayName(elemI) << "\"";
}
Info<< " )\nselected(";
forAll(selections, elemI)
{
Info<< " " << selections[elemI];
}
Info<< " )\n";
}
return selections;
}
Foam::stringList Foam::vtkPV3blockMesh::getSelectedArrayEntries
(
vtkDataArraySelection* select,
const partInfo& selector
)
{
stringList selections(selector.size());
label nElem = 0;
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
{
if (select->GetArraySetting(elemI))
{
selections[nElem++] = select->GetArrayName(elemI);
}
}
selections.setSize(nElem);
if (debug)
{
Info<< "available(";
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
{
Info<< " \"" << select->GetArrayName(elemI) << "\"";
}
Info<< " )\nselected(";
forAll(selections, elemI)
{
Info<< " " << selections[elemI];
}
Info<< " )\n";
}
return selections;
}
void Foam::vtkPV3blockMesh::setSelectedArrayEntries
(
vtkDataArraySelection* select,
const stringList& selections
)
{
const int nElem = select->GetNumberOfArrays();
select->DisableAllArrays();
// Loop through entries, setting values from selectedEntries
for (int elemI=0; elemI < nElem; ++elemI)
{
string arrayName(select->GetArrayName(elemI));
forAll(selections, elemI)
{
if (selections[elemI] == arrayName)
{
select->EnableArray(arrayName.c_str());
break;
}
}
}
}
void Foam::vtkPV3blockMesh::updateBoolListStatus
(
boolList& status,
vtkDataArraySelection* selection
)
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateBoolListStatus" << endl;
}
const label nElem = selection->GetNumberOfArrays();
if (status.size() != nElem)
{
status.setSize(nElem);
status = false;
}
forAll(status, elemI)
{
const int setting = selection->GetArraySetting(elemI);
status[elemI] = setting;
if (debug)
{
Info<< " part[" << elemI << "] = "
<< status[elemI]
<< " : " << selection->GetArrayName(elemI) << endl;
}
}
if (debug)
{
Info<< "<end> Foam::vtkPV3blockMesh::updateBoolListStatus" << endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
foamListTimes.C
EXE = $(FOAM_APPBIN)/foamListTimes

View File

@ -0,0 +1,2 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Application
foamListTimes
Description
List times using timeSelector
Usage
- foamListTimes [OPTION]
@param -processor \n
List times from processor0 directory
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
timeSelector::addOptions(); // -constant enabled
argList::noBanner();
argList::noParallel();
argList::validOptions.insert("processor", "");
# include "setRootCase.H"
label nProcs = 0;
// Create the processor databases
PtrList<Time> databases(1);
if (args.optionFound("processor"))
{
// determine the processor count directly
while (isDir(args.path()/(word("processor") + name(nProcs))))
{
++nProcs;
}
if (!nProcs)
{
FatalErrorIn(args.executable())
<< "No processor* directories found"
<< exit(FatalError);
}
// Create the processor databases
databases.setSize(nProcs);
forAll(databases, procI)
{
databases.set
(
procI,
new Time
(
Time::controlDictName,
args.rootPath(),
args.caseName()/fileName(word("processor") + name(procI))
)
);
}
}
else
{
databases.set
(
0,
new Time
(
Time::controlDictName,
args.rootPath(),
args.caseName()
)
);
}
// use the times list from the master processor
// and select a subset based on the command-line options
instantList timeDirs = timeSelector::select
(
databases[0].times(),
args
);
forAll(timeDirs, timeI)
{
Info<< timeDirs[timeI].name() << endl;
}
return 0;
}
// ************************************************************************* //

View File

@ -31,7 +31,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,7 +45,7 @@ int main(int argc, char *argv[])
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scalar Vphi = (constant::math::pi*swirlRPMRatio*rpm/30).value();
scalar Vphi = (constant::mathematical::pi*swirlRPMRatio*rpm/30).value();
scalar b1 = j1(swirlProfile).value();
scalar b2 = 2.0*b1/swirlProfile.value() - j0(swirlProfile).value();

View File

@ -43,10 +43,10 @@ Description
#include "transformField.H"
#include "Pair.H"
#include "quaternion.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
using namespace Foam;
using namespace Foam::constant::math;
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,6 +29,8 @@
# Description
# start paraview with the OpenFOAM libraries
#
# Note
# combining -block and -region options yields undefined behaviour
#------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
@ -38,6 +40,7 @@ usage: ${0##*/} [OPTION]
options:
-case dir specify alternative case directory
-region name specify mesh region name
-block use blockMesh reader (and .blockMesh file)
-touch only create the .OpenFOAM file
* start paraview $ParaView_VERSION with the OpenFOAM libraries
@ -48,6 +51,9 @@ USAGE
unset regionName touchOnly
# reader extension
reader=OpenFOAM
# parse options
while [ "$#" -gt 0 ]
do
@ -55,6 +61,10 @@ do
-h | -help)
usage
;;
-block | -blockMesh)
reader=blockMesh
shift
;;
-case)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
@ -75,14 +85,14 @@ do
esac
done
# get a sensible caseName
# get a sensible caseName from the directory name
caseName=${PWD##*/}
caseFile="$caseName.OpenFOAM"
caseFile="$caseName.$reader"
fvControls="system"
if [ -n "$regionName" ]
then
caseFile="$caseName{$regionName}.OpenFOAM"
caseFile="$caseName{$regionName}.$reader"
fvControls="$fvControls/$regionName"
fi
@ -99,12 +109,25 @@ case "$caseName" in
*) parentDir="." ;;
esac
# check existence of essential files
for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution
do
[ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'"
done
#
# check existence of essential files
#
case $reader in
blockMesh)
for check in system/controlDict constant/polyMesh/blockMeshDict
do
[ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'"
done
;;
OpenFOAM)
for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution
do
[ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'"
done
;;
esac
case "$ParaView_VERSION" in
2*)

View File

@ -50,8 +50,8 @@ turbulenceModels/Allwmake
lagrangian/Allwmake
postProcessing/Allwmake
conversion/Allwmake
mesh/Allwmake
wmake libso autoMesh
wmake libso errorEstimation
fvAgglomerationMethods/Allwmake

View File

@ -66,7 +66,9 @@ bool Foam::functionEntries::removeEntry::execute
)
{
wordList dictKeys = parentDict.toc();
labelList indices = findStrings<word>(readList<wordRe>(is), dictKeys);
wordReList patterns(is);
labelList indices = findStrings(patterns, dictKeys);
forAll(indices, indexI)
{

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "atomicConstants.H"
@ -83,7 +83,7 @@ const Foam::dimensionedScalar Foam::constant::atomic::a0
(
"a0",
alpha
/(dimensionedScalar("C", dimless, 4.0*constant::math::pi)*Rinf)
/(dimensionedScalar("C", dimless, 4.0*constant::mathematical::pi)*Rinf)
)
)
);
@ -100,7 +100,7 @@ const Foam::dimensionedScalar Foam::constant::atomic::re
"re",
sqr(constant::electromagnetic::e)
/(
dimensionedScalar("C", dimless, 4.0*constant::math::pi)
dimensionedScalar("C", dimless, 4.0*constant::mathematical::pi)
*constant::electromagnetic::epsilon0
*me
*sqr(constant::universal::c)

View File

@ -38,7 +38,7 @@ Description
// Dimensionless coefficents
// Mathematical constants
#include "mathConstants.H"
#include "mathematicalConstants.H"
// Dimensioned constants

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "atomicConstants.H"
@ -46,7 +46,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
(
"mu0",
dimless,
4.0*constant::math::pi*1e-07
4.0*constant::mathematical::pi*1e-07
)
)
);
@ -92,7 +92,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::kappa
dimensionedScalar
(
"kappa",
dimensionedScalar("C", dimless, 1.0/(4.0*constant::math::pi))
dimensionedScalar("C", dimless, 1.0/(4.0*constant::mathematical::pi))
/epsilon0
)
)

View File

@ -23,15 +23,15 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::math
Foam::constant::mathematical
Description
mathematical constants
\*---------------------------------------------------------------------------*/
#ifndef mathConstants_H
#define mathConstants_H
#ifndef mathematicalConstants_H
#define mathematicalConstants_H
#include "scalar.H"
@ -41,12 +41,12 @@ namespace Foam
{
namespace constant
{
namespace math
namespace mathematical
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static word group = "math";
static word group = "mathematical";
const scalar e(M_E);
const scalar pi(M_PI);
@ -55,7 +55,7 @@ namespace math
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace math
} // End namespace mathematical
} // end namespace constant
} // End namespace Foam
@ -64,6 +64,3 @@ namespace math
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "physicoChemicalConstants.H"
@ -75,7 +75,7 @@ const Foam::dimensionedScalar Foam::constant::physicoChemical::sigma
dimensionedScalar
(
"sigma",
dimensionedScalar("C", dimless, sqr(constant::math::pi)/60.0)
dimensionedScalar("C", dimless, sqr(constant::mathematical::pi)/60.0)
*pow4(k)/(pow3(constant::universal::hr)*sqr(constant::universal::c))
)
)
@ -107,7 +107,7 @@ const Foam::dimensionedScalar Foam::constant::physicoChemical::c1
dimensionedScalar
(
"c1",
dimensionedScalar("C", dimless, constant::math::twoPi)
dimensionedScalar("C", dimless, constant::mathematical::twoPi)
*constant::universal::h*sqr(constant::universal::c)
)
)

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "universalConstants.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "dimensionedConstants.H"
@ -43,7 +43,7 @@ const Foam::dimensionedScalar Foam::constant::universal::hr
dimensionedScalar
(
"hr",
h/(dimensionedScalar("C", dimless, constant::math::twoPi))
h/(dimensionedScalar("C", dimless, constant::mathematical::twoPi))
)
)
);

View File

@ -27,7 +27,7 @@ License
#include "face.H"
#include "triFace.H"
#include "triPointRef.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -99,13 +99,13 @@ Foam::label Foam::face::mostConcaveAngle
if ((edgeNormal & n) > 0)
{
// Concave angle.
angle = constant::math::pi + edgeAngle;
angle = constant::mathematical::pi + edgeAngle;
}
else
{
// Convex angle. Note '-' to take into account that rightEdge
// and leftEdge are head-to-tail connected.
angle = constant::math::pi - edgeAngle;
angle = constant::mathematical::pi - edgeAngle;
}
if (angle > maxAngle)
@ -214,7 +214,7 @@ Foam::label Foam::face::split
label index = fcIndex(fcIndex(startIndex));
label minIndex = index;
scalar minDiff = constant::math::pi;
scalar minDiff = constant::mathematical::pi;
for(label i = 0; i < size() - 3; i++)
{

View File

@ -450,7 +450,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
const polyBoundaryMesh& bm = *this;
bool boundaryError = false;
bool hasError = false;
// Collect non-proc patches and check proc patches are last.
wordList names(bm.size());
@ -464,8 +464,8 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
{
if (nonProcI != patchI)
{
// There is processor patch inbetween normal patches.
boundaryError = true;
// There is processor patch in between normal patches.
hasError = true;
if (debug || report)
{
@ -508,7 +508,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
|| (allTypes[procI] != allTypes[0])
)
{
boundaryError = true;
hasError = true;
if (debug || (report && Pstream::master()))
{
@ -523,7 +523,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
}
}
return boundaryError;
return hasError;
}
@ -532,13 +532,13 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
label nextPatchStart = mesh().nInternalFaces();
const polyBoundaryMesh& bm = *this;
bool boundaryError = false;
bool hasError = false;
forAll (bm, patchI)
{
if (bm[patchI].start() != nextPatchStart && !boundaryError)
if (bm[patchI].start() != nextPatchStart && !hasError)
{
boundaryError = true;
hasError = true;
Info<< " ****Problem with boundary patch " << patchI
<< " named " << bm[patchI].name()
@ -553,26 +553,21 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
nextPatchStart += bm[patchI].size();
}
reduce(boundaryError, orOp<bool>());
reduce(hasError, orOp<bool>());
if (boundaryError)
if (debug || report)
{
if (debug || report)
if (hasError)
{
Pout << " ***Boundary definition is in error." << endl;
}
return true;
}
else
{
if (debug || report)
else
{
Info << " Boundary definition OK." << endl;
}
return false;
}
return hasError;
}

View File

@ -37,11 +37,11 @@ License
namespace Foam
{
defineTypeNameAndDebug(cellZone, 0);
defineRunTimeSelectionTable(cellZone, dictionary);
addToRunTimeSelectionTable(cellZone, cellZone, dictionary);
}
const char * const Foam::cellZone::labelsName = "cellLabels";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -79,7 +79,7 @@ Foam::cellZone::cellZone
const cellZoneMesh& zm
)
:
zone("cell", name, dict, index),
zone(name, dict, this->labelsName, index),
zoneMesh_(zm)
{}
@ -140,7 +140,7 @@ void Foam::cellZone::writeDict(Ostream& os) const
os << nl << name() << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("cellLabels", os);
writeEntry(this->labelsName, os);
os << token::END_BLOCK << endl;
}
@ -148,10 +148,10 @@ void Foam::cellZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::cellZone::operator=(const cellZone& cz)
void Foam::cellZone::operator=(const cellZone& zn)
{
clearAddressing();
labelList::operator=(cz);
labelList::operator=(zn);
}
@ -164,10 +164,10 @@ void Foam::cellZone::operator=(const labelList& addr)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& cz)
Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& zn)
{
cz.write(os);
os.check("Ostream& operator<<(Ostream& os, const cellZone& cz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const cellZone&");
return os;
}

View File

@ -81,6 +81,12 @@ protected:
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("cellZone");

View File

@ -42,6 +42,8 @@ namespace Foam
addToRunTimeSelectionTable(faceZone, faceZone, dictionary);
}
const char* const Foam::faceZone::labelsName = "faceLabels";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::faceZone::calcFaceZonePatch() const
@ -226,7 +228,7 @@ Foam::faceZone::faceZone
const faceZoneMesh& zm
)
:
zone("face", name, dict, index),
zone(name, dict, this->labelsName, index),
flipMap_(dict.lookup("flipMap")),
zoneMesh_(zm),
patchPtr_(NULL),
@ -442,7 +444,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
const polyMesh& mesh = zoneMesh().mesh();
const polyBoundaryMesh& bm = mesh.boundaryMesh();
bool boundaryError = false;
bool hasError = false;
// Check that zone faces are synced
@ -479,7 +481,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
// Check face in zone on both sides
if (myZoneFace[bFaceI] != neiZoneFace[bFaceI])
{
boundaryError = true;
hasError = true;
if (report)
{
@ -491,12 +493,17 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
<< " is not consistent with its coupled neighbour."
<< endl;
}
else
{
// w/o report - can stop checking now
break;
}
}
// Flip state should be opposite.
if (myZoneFlip[bFaceI] == neiZoneFlip[bFaceI])
{
boundaryError = true;
hasError = true;
if (report)
{
@ -509,12 +516,17 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
<< " across coupled faces."
<< endl;
}
else
{
// w/o report - can stop checking now
break;
}
}
}
}
}
return returnReduce(boundaryError, orOp<bool>());
return returnReduce(hasError, orOp<bool>());
}
@ -539,7 +551,7 @@ void Foam::faceZone::writeDict(Ostream& os) const
os << nl << name() << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("faceLabels", os);
writeEntry(this->labelsName, os);
flipMap().writeEntry("flipMap", os);
os << token::END_BLOCK << endl;
@ -548,10 +560,10 @@ void Foam::faceZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& fz)
Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& zn)
{
fz.write(os);
os.check("Ostream& operator<<(Ostream& os, const faceZone& fz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const faceZone&");
return os;
}

View File

@ -60,13 +60,17 @@ Ostream& operator<<(Ostream&, const faceZone&);
/*---------------------------------------------------------------------------*\
Class faceZone Declaration
Class faceZone Declaration
\*---------------------------------------------------------------------------*/
class faceZone
:
public zone
{
// Private data
//- The name associated with the zone-labels dictionary entry
static const word labelsName_;
protected:
@ -118,6 +122,12 @@ protected:
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("faceZone");
@ -283,7 +293,7 @@ public:
virtual void movePoints(const pointField&);
//- Update for changes in topology
virtual void updateMesh(const mapPolyMesh& mpm);
virtual void updateMesh(const mapPolyMesh&);
//- Write
virtual void write(Ostream&) const;
@ -291,7 +301,6 @@ public:
//- Write dictionary
virtual void writeDict(Ostream&) const;
// I-O
//- Ostream Operator

View File

@ -40,6 +40,7 @@ namespace Foam
addToRunTimeSelectionTable(pointZone, pointZone, dictionary);
}
const char* const Foam::pointZone::labelsName = "pointLabels";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -77,7 +78,7 @@ Foam::pointZone::pointZone
const pointZoneMesh& zm
)
:
zone("point", name, dict, index),
zone(name, dict, this->labelsName, index),
zoneMesh_(zm)
{}
@ -139,7 +140,7 @@ void Foam::pointZone::writeDict(Ostream& os) const
os << nl << name_ << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("pointLabels", os);
writeEntry(this->labelsName, os);
os << token::END_BLOCK << endl;
}
@ -147,10 +148,10 @@ void Foam::pointZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pointZone::operator=(const pointZone& pz)
void Foam::pointZone::operator=(const pointZone& zn)
{
clearAddressing();
labelList::operator=(pz);
labelList::operator=(zn);
}
@ -163,10 +164,10 @@ void Foam::pointZone::operator=(const labelList& addr)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& pz)
Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& zn)
{
pz.write(os);
os.check("Ostream& operator<<(Ostream& os, const pointZone& pz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const pointZone&");
return os;
}

View File

@ -58,7 +58,7 @@ Ostream& operator<<(Ostream&, const pointZone&);
/*---------------------------------------------------------------------------*\
Class pointZone Declaration
Class pointZone Declaration
\*---------------------------------------------------------------------------*/
class pointZone
@ -68,20 +68,24 @@ class pointZone
protected:
// Private data
// Protected data
//- Reference to zone list
const pointZoneMesh& zoneMesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
pointZone(const pointZone&);
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("pointZone");

View File

@ -115,13 +115,13 @@ Foam::zone::zone
Foam::zone::zone
(
const word& zoneType,
const word& name,
const dictionary& dict,
const word& labelsName,
const label index
)
:
labelList(dict.lookup(zoneType + "Labels")),
labelList(dict.lookup(labelsName)),
name_(name),
index_(index),
lookupMapPtr_(NULL)
@ -193,13 +193,13 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
{
const labelList& addr = *this;
bool boundaryError = false;
bool hasError = false;
forAll(addr, i)
{
if (addr[i] < 0 || addr[i] >= maxSize)
{
boundaryError = true;
hasError = true;
if (report)
{
@ -212,10 +212,15 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
<< "Valid index labels are 0.."
<< maxSize-1 << endl;
}
else
{
// w/o report - can stop checking now
break;
}
}
}
return boundaryError;
return hasError;
}

View File

@ -117,9 +117,9 @@ public:
//- Construct from dictionary
zone
(
const word& zoneType,
const word& name,
const dictionary&,
const word& labelsName,
const label index
);

View File

@ -27,7 +27,7 @@ License
#include "primitiveMesh.H"
#include "pyramidPointFaceRef.H"
#include "ListOps.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "SortableList.H"
@ -410,7 +410,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
// Severe nonorthogonality threshold
const scalar severeNonorthogonalityThreshold =
::cos(nonOrthThreshold_/180.0*constant::math::pi);
::cos(nonOrthThreshold_/180.0*constant::mathematical::pi);
scalar minDDotS = GREAT;
@ -472,9 +472,9 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
if (debug || report)
{
Info<< " Mesh non-orthogonality Max: "
<< ::acos(minDDotS)/constant::math::pi*180.0
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
<< " average: " <<
::acos(sumDDotS/neiSize)/constant::math::pi*180.0
::acos(sumDDotS/neiSize)/constant::mathematical::pi*180.0
<< endl;
}
}
@ -839,7 +839,7 @@ bool Foam::primitiveMesh::checkFaceAngles
<< exit(FatalError);
}
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::math::pi);
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
const pointField& p = points();
const faceList& fcs = faces();
@ -916,7 +916,7 @@ bool Foam::primitiveMesh::checkFaceAngles
{
scalar maxConcaveDegr =
Foam::asin(Foam::min(1.0, maxEdgeSin))
*180.0/constant::math::pi;
*180.0/constant::mathematical::pi;
if (debug || report)
{

View File

@ -31,7 +31,7 @@ Description
#include "primitiveMesh.H"
#include "pyramidPointFaceRef.H"
#include "cell.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -200,7 +200,7 @@ bool Foam::primitiveMesh::checkMeshMotion
) << "Severe non-orthogonality in mesh motion for face "
<< faceI
<< " between cells " << own[faceI] << " and " << nei[faceI]
<< ": Angle = " << ::acos(dDotS)/constant::math::pi*180.0
<< ": Angle = " << ::acos(dDotS)/constant::mathematical::pi*180.0
<< " deg." << endl;
nDotProductErrors++;

View File

@ -26,7 +26,7 @@ License
#include "IOstreams.H"
#include "pointHit.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -307,7 +307,7 @@ inline scalar triangle<Point, PointRef>::quality() const
return
mag()
/ (
constant::math::pi
constant::mathematical::pi
*Foam::sqr(circumRadius())
*0.413497
+ VSMALL

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