Merge branch 'master' into dsmc

This commit is contained in:
graham
2009-10-21 14:12:36 +01:00
346 changed files with 9946 additions and 2903 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@ License
#include "kineticTheoryModel.H" #include "kineticTheoryModel.H"
#include "surfaceInterpolate.H" #include "surfaceInterpolate.H"
#include "mathConstants.H" #include "mathematicalConstants.H"
#include "fvCFD.H" #include "fvCFD.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -204,7 +204,7 @@ void Foam::kineticTheoryModel::solve()
volScalarField alpha = alpha_; volScalarField alpha = alpha_;
alpha.max(1.0e-6); 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_); surfaceScalarField phi = 1.5*rhoa_*phia_*fvc::interpolate(alpha_);

View File

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

View File

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

View File

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

View File

@ -0,0 +1,3 @@
fieldDependency.C
EXE = $(FOAM_USER_APPBIN)/fieldDependency

View File

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

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Test field dependencies.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "volFields.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
Info<< "Creating field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimless, 0)
);
Info<< "Creating field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimless, 0)
);
Info<< "p.eventNo:" << p.eventNo() << endl;
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
// Change T and mark as uptodate.
Info<< "Changing T" << endl;
T = 0.0;
T.setUpToDate();
Info<< "T.eventNo:" << T.eventNo() << endl;
// Check p dependency:
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
// Change p and mark as uptodate.
Info<< "Changing p." << endl;
p.setUpToDate();
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
Info<< "p.eventNo:" << p.eventNo() << endl;
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ Description
#include "graph.H" #include "graph.H"
#include "OFstream.H" #include "OFstream.H"
#include "mathConstants.H" #include "mathematicalConstants.H"
using namespace Foam; using namespace Foam;
@ -50,7 +50,7 @@ int main()
scalarField b = 0.5*(1.0 + erf(x)); scalarField b = 0.5*(1.0 + erf(x));
scalarField c = 1.0 - b; 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; scalarField lapb = -2*x*gradb;
r = lapb*b*c/(gradb*gradb); r = lapb*b*c/(gradb*gradb);

View File

@ -27,6 +27,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "stringListOps.H" #include "stringListOps.H"
#include "IStringStream.H"
#include "IOstreams.H" #include "IOstreams.H"
using namespace Foam; using namespace Foam;
@ -36,21 +37,59 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
stringList sl(3); stringList strLst
sl[0] = "hello"; (
sl[1] = "heello"; IStringStream
sl[2] = "heeello"; (
"("
"\"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) forAll(matches, i)
{ {
Info<< " " << sl[matches[i]]; Info<< " -> " << strLst[matches[i]] << nl;
} }
Info<< endl; 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; return 0;
} }

View File

@ -47,7 +47,7 @@ Description
#include "polyTopoChanger.H" #include "polyTopoChanger.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "mathConstants.H" #include "mathematicalConstants.H"
#include "PackedBoolList.H" #include "PackedBoolList.H"
#include "SortableList.H" #include "SortableList.H"
@ -467,7 +467,7 @@ int main(int argc, char *argv[])
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])())); scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.optionFound("overwrite"); 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 Info<< "Merging:" << nl
<< " edges with length less than " << minLen << " meters" << nl << " edges with length less than " << minLen << " meters" << nl

View File

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

View File

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

View File

@ -43,7 +43,7 @@ Description
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H" #include "wedgePolyPatch.H"
#include "cyclicPolyPatch.H" #include "cyclicPolyPatch.H"
#include "mathConstants.H" #include "mathematicalConstants.H"
using namespace Foam; 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 // 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(degToRad(2.5));
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin(); SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin(); SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();

View File

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

View File

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

View File

@ -1,8 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(curvedEdges) \ -I$(LIB_SRC)/mesh/blockMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude -I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lblockMesh \
-lmeshTools \ -lmeshTools \
-ldynamicMesh -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); << exit(FatalError);
} }
Info<< nl << "Creating block mesh from\n " Info<< "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << nl << endl; << meshDictIoPtr->objectPath() << endl;
blockMesh::verbose(true);
IOdictionary meshDict(meshDictIoPtr()); IOdictionary meshDict(meshDictIoPtr());
blockMesh blocks(meshDict); blockMesh blocks(meshDict);
@ -195,8 +197,7 @@ int main(int argc, char *argv[])
} }
Info<< nl << "Creating polyMesh from blockMesh" << endl;
Info<< nl << "Creating mesh from block mesh" << endl;
wordList patchNames = blocks.patchNames(); wordList patchNames = blocks.patchNames();
wordList patchTypes = blocks.patchTypes(); wordList patchTypes = blocks.patchTypes();
@ -204,6 +205,7 @@ int main(int argc, char *argv[])
word defaultFacesType = emptyPolyPatch::typeName; word defaultFacesType = emptyPolyPatch::typeName;
wordList patchPhysicalTypes = blocks.patchPhysicalTypes(); wordList patchPhysicalTypes = blocks.patchPhysicalTypes();
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
@ -339,7 +341,7 @@ int main(int argc, char *argv[])
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(10); IOstream::defaultPrecision(10);
Info << nl << "Writing polyMesh" << endl; Info<< nl << "Writing polyMesh" << endl;
mesh.removeFiles(); mesh.removeFiles();
if (!mesh.write()) if (!mesh.write())
{ {
@ -348,6 +350,38 @@ int main(int argc, char *argv[])
<< exit(FatalError); << 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; Info<< nl << "End" << endl;
return 0; 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 "wedge.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "mathConstants.H" #include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,8 +51,7 @@ wedge::wedge(const dictionary& dict)
axis_(coeffDict_.lookup("axis")), axis_(coeffDict_.lookup("axis")),
angle_ angle_
( (
readScalar(coeffDict_.lookup("angle")) degToRad(readScalar(coeffDict_.lookup("angle")))
*constant::math::pi/180.0
) )
{} {}

View File

@ -1,7 +1,7 @@
EXE_INC = \ EXE_INC = \
/* -g -DFULLDEBUG -O0 */ \ /* -g -DFULLDEBUG -O0 */ \
-I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \ -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)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -385,14 +385,7 @@ int vtkPV3FoamReader::RequestData
foamData_->Update(output, output); foamData_->Update(output, output);
#endif #endif
if (ShowPatchNames) updatePatchNamesView(ShowPatchNames);
{
addPatchNamesToView();
}
else
{
removePatchNamesFromView();
}
#endif #endif
@ -403,7 +396,7 @@ int vtkPV3FoamReader::RequestData
} }
void vtkPV3FoamReader::addPatchNamesToView() void vtkPV3FoamReader::updatePatchNamesView(const bool show)
{ {
pqApplicationCore* appCore = pqApplicationCore::instance(); pqApplicationCore* appCore = pqApplicationCore::instance();
@ -415,29 +408,10 @@ void vtkPV3FoamReader::addPatchNamesToView()
for (int viewI=0; viewI<renderViews.size(); viewI++) for (int viewI=0; viewI<renderViews.size(); viewI++)
{ {
foamData_->addPatchNames foamData_->renderPatchNames
( (
renderViews[viewI]->getRenderViewProxy()->GetRenderer() renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
); show
}
}
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()
); );
} }
} }

View File

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

View File

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

View File

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

View File

@ -590,11 +590,19 @@ 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 // always remove old actors first
removePatchNames(renderer);
forAll(patchTextActorsPtrs_, patchI)
{
renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]);
patchTextActorsPtrs_[patchI]->Delete();
}
patchTextActorsPtrs_.clear();
if (show)
{
// get the display patches, strip off any suffix // get the display patches, strip off any suffix
wordHashSet selectedPatches = getSelected wordHashSet selectedPatches = getSelected
( (
@ -607,12 +615,6 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
return; return;
} }
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::addPatchNames" << nl
<<"... add patches: " << selectedPatches << endl;
}
const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh(); const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh();
// Find the total number of zones // Find the total number of zones
@ -623,10 +625,6 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
// Per global zone number the average face centre position // Per global zone number the average face centre position
DynamicList<point> zoneCentre(pbMesh.size()); DynamicList<point> zoneCentre(pbMesh.size());
if (debug)
{
Info<< "... determining patch zones" << endl;
}
// Loop through all patches to determine zones, and centre of each zone // Loop through all patches to determine zones, and centre of each zone
forAll(pbMesh, patchI) forAll(pbMesh, patchI)
@ -785,24 +783,10 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
// Resize the patch names list to the actual number of patch names added // Resize the patch names list to the actual number of patch names added
patchTextActorsPtrs_.setSize(displayZoneI); 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();
}
void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const
{ {

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ Description
// Foam includes // Foam includes
#include "fvMesh.H" #include "fvMesh.H"
#include "cellModeller.H" #include "cellModeller.H"
#include "vtkPV3FoamPoints.H" #include "vtkOpenFOAMPoints.H"
// VTK includes // VTK includes
#include "vtkCellArray.h" #include "vtkCellArray.h"
@ -143,7 +143,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
forAll(points, i) 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 // Insert the new vertex from the cell-centre
label newVertexLabel = mesh.nPoints() + addPointI; 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. // Whether to insert cell in place of original or not.
bool substituteCell = true; bool substituteCell = true;

View File

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

View File

@ -41,6 +41,34 @@ Description
#include "vtkMultiBlockDataSet.h" #include "vtkMultiBlockDataSet.h"
#include "vtkInformation.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 * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::vtkPV3Foam::AddToBlock void Foam::vtkPV3Foam::AddToBlock
@ -49,7 +77,7 @@ void Foam::vtkPV3Foam::AddToBlock
vtkDataSet* dataset, vtkDataSet* dataset,
const partInfo& selector, const partInfo& selector,
const label datasetNo, const label datasetNo,
const string& datasetName const std::string& datasetName
) )
{ {
const int blockNo = selector.block(); 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, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 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 void vtkInsertNextOpenFOAMPoint
(
inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str) vtkPoints *points,
const Foam::point& p
)
{ {
if (str) points->InsertNextPoint(p.x(), p.y(), p.z());
{
label n = 0;
while (str[n] && word::valid(str[n]))
{
++n;
}
return word(str, n, true);
}
else
{
return word::null;
}
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#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 "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 b1 = j1(swirlProfile).value();
scalar b2 = 2.0*b1/swirlProfile.value() - j0(swirlProfile).value(); scalar b2 = 2.0*b1/swirlProfile.value() - j0(swirlProfile).value();

View File

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

View File

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

View File

@ -38,8 +38,6 @@ wmake libso sampling
wmake libso dynamicMesh wmake libso dynamicMesh
wmake libso dynamicFvMesh wmake libso dynamicFvMesh
wmake libso topoChangerFvMesh wmake libso topoChangerFvMesh
wmake libso fvMotionSolver
wmake libso engine
wmake libso ODE wmake libso ODE
wmake libso randomProcesses wmake libso randomProcesses
@ -50,10 +48,13 @@ turbulenceModels/Allwmake
lagrangian/Allwmake lagrangian/Allwmake
postProcessing/Allwmake postProcessing/Allwmake
conversion/Allwmake conversion/Allwmake
mesh/Allwmake
wmake libso autoMesh
wmake libso errorEstimation wmake libso errorEstimation
fvAgglomerationMethods/Allwmake fvAgglomerationMethods/Allwmake
wmake libso fvMotionSolver
wmake libso engine
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -1,6 +1,6 @@
global/global.Cver global/global.Cver
global/dimensionedConstants/dimensionedConstants.C global/constants/constants.C
global/dimensionedConstants/constants/constants.C global/constants/dimensionedConstants.C
global/argList/argList.C global/argList/argList.C
global/clock/clock.C global/clock/clock.C

View File

@ -72,9 +72,7 @@ public:
TimeState(); TimeState();
// Destructor //- Destructor
//- Virtual destructor
virtual ~TimeState(); virtual ~TimeState();
@ -89,22 +87,34 @@ public:
virtual scalar timeToUserTime(const scalar t) const; virtual scalar timeToUserTime(const scalar t) const;
//- Return current time value //- Return current time value
virtual scalar timeOutputValue() const; scalar timeOutputValue() const;
//- Return current time index //- Return current time index
virtual label timeIndex() const; label timeIndex() const;
//- Return time step value
inline scalar deltaTValue() const
{
return deltaT_;
}
//- Return old time step value
inline scalar deltaT0Value() const
{
return deltaT0_;
}
//- Return time step //- Return time step
virtual dimensionedScalar deltaT() const; dimensionedScalar deltaT() const;
//- Return old time step //- Return old time step
virtual dimensionedScalar deltaT0() const; dimensionedScalar deltaT0() const;
// Check // Check
//- Return true if this is an output time //- Return true if this is an output time
virtual bool outputTime() const; bool outputTime() const;
}; };

View File

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

View File

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

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace Namespace
Foam::constant::atom Foam::constant::atomic
Description Description
Atomic constants Atomic constants
@ -68,7 +68,7 @@ namespace atomic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace atomic } // End namespace atomic
} // end namespace constant } // End namespace constant
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Collection of dimensioned constants
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

@ -27,9 +27,10 @@ Global
Description Description
Dictionary reading and supplying the dimensioned constants used within Dictionary reading and supplying the dimensioned constants used within
OpenFOAM particularly for thermodynamics. The values are read from the OpenFOAM, particularly for thermodynamics.
OpenFOAM controlDict and should be changed to run with a different set of
units from the default SI units. The values are read from the OpenFOAM etc/controlDict and should be
changed to run with a different set of units from the default SI units.
SourceFiles SourceFiles
dimensionedConstants.C dimensionedConstants.C

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "mathConstants.H" #include "mathematicalConstants.H"
#include "universalConstants.H" #include "universalConstants.H"
#include "electromagneticConstants.H" #include "electromagneticConstants.H"
#include "atomicConstants.H" #include "atomicConstants.H"
@ -46,7 +46,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
( (
"mu0", "mu0",
dimless, 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 dimensionedScalar
( (
"kappa", "kappa",
dimensionedScalar("C", dimless, 1.0/(4.0*constant::math::pi)) dimensionedScalar("C", dimless, 1.0/(4.0*constant::mathematical::pi))
/epsilon0 /epsilon0
) )
) )

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace Namespace
Foam::constant::em Foam::constant::electromagnetic
Description Description
Electromagnetic constants Electromagnetic constants
@ -77,7 +77,7 @@ namespace electromagnetic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace electromagnetic } // End namespace electromagnetic
} // end namespace constant } // End namespace constant
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,15 +23,15 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace Namespace
Foam::constant::math Foam::constant::mathematical
Description Description
mathematical constants mathematical constants and conversion functions
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef mathConstants_H #ifndef mathematicalConstants_H
#define mathConstants_H #define mathematicalConstants_H
#include "scalar.H" #include "scalar.H"
@ -41,12 +41,12 @@ namespace Foam
{ {
namespace constant namespace constant
{ {
namespace math namespace mathematical
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static word group = "math"; static word group = "mathematical";
const scalar e(M_E); const scalar e(M_E);
const scalar pi(M_PI); const scalar pi(M_PI);
@ -55,8 +55,25 @@ namespace math
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace math } // End namespace mathematical
} // end namespace constant } // End namespace constant
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Conversion from degrees to radians
inline scalar degToRad(const scalar& deg)
{
return (deg*constant::mathematical::pi/180.0);
}
//- Conversion from radians to degrees
inline scalar radToDeg(const scalar& rad)
{
return (rad*180.0/constant::mathematical::pi);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,6 +81,3 @@ namespace math
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

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

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace Namespace
Foam::constant::phys Foam::constant::physicoChemical
Description Description
Physico-chemical constants Physico-chemical constants
@ -71,7 +71,7 @@ namespace physicoChemical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace physicoChemical } // End namespace physicoChemical
} // end namespace constant } // End namespace constant
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

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