Compare commits
128 Commits
feature-he
...
maintenanc
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f5aae75e0 | |||
| ba8fa9f2ca | |||
| e8885c868d | |||
| cc676d1820 | |||
| 61ea8936bb | |||
| e6695e7354 | |||
| 79d4e466a2 | |||
| 085ff44ea4 | |||
| 967a5c2216 | |||
| 983a1d1b15 | |||
| 3d7b6bdba2 | |||
| 8d7379bc72 | |||
| 9d168b2b8e | |||
| 24a6c4810d | |||
| c97b1f21e1 | |||
| c7ec42c3da | |||
| 1497394c7a | |||
| b70b0bb5cb | |||
| e661d2382f | |||
| 331d24ed0c | |||
| a79eaa2d64 | |||
| 19b5952c35 | |||
| 83db6f793c | |||
| c9e9815b86 | |||
| 1ff9ae9ff5 | |||
| 1f408ffd1b | |||
| 1df1f8fe20 | |||
| dad301d81c | |||
| 779f884355 | |||
| 5682eb6035 | |||
| a5e1c11a4b | |||
| 2b5e278ffc | |||
| b386d8a1c2 | |||
| 9cfce48c9c | |||
| 8f7ad9130a | |||
| 0ceb2cd230 | |||
| 025eebca13 | |||
| a5ff48870f | |||
| 59418c711a | |||
| 4093fcd66b | |||
| 85885adea8 | |||
| 26b6f93b33 | |||
| 67970d02b6 | |||
| 9fbb796135 | |||
| fbc1a1d82a | |||
| 7d2ea92570 | |||
| af13209920 | |||
| 53ed99b084 | |||
| 6f4509b938 | |||
| 4e5d2d8e04 | |||
| b0d1deeb69 | |||
| 008a583992 | |||
| b4f050ad52 | |||
| a5fbb36d73 | |||
| 3aa54d114d | |||
| a70e4ef8fe | |||
| 2bbbcf60de | |||
| a32c043944 | |||
| 0e5054c3c7 | |||
| b74cf47bc3 | |||
| 0d9fc569c5 | |||
| 7110aa8236 | |||
| b5231f2ec1 | |||
| fa2ae8e7b4 | |||
| 86c214de81 | |||
| 71e1f300c8 | |||
| 4e1ce0241a | |||
| ef4ae3063b | |||
| d716c59f57 | |||
| b12b50548b | |||
| 8524c72854 | |||
| ce1abf5b42 | |||
| ea1c9a1559 | |||
| feed30d63c | |||
| 9e766b8bc5 | |||
| 616cb0f137 | |||
| ed2017aa21 | |||
| 215f9a8555 | |||
| e219399d93 | |||
| d6e15499b8 | |||
| 267409dc62 | |||
| 7241e7ddd0 | |||
| 571fc94077 | |||
| 2b40688ebd | |||
| b548540589 | |||
| 3fbd69b9e7 | |||
| 633c0fcc37 | |||
| 0e13a0462f | |||
| 57e36b5252 | |||
| ec478c9636 | |||
| 4302ddf47e | |||
| 28c15a6ec1 | |||
| 42325c9cf1 | |||
| b34b7fab82 | |||
| 8af962c7b2 | |||
| 03f552aa6e | |||
| a985c5520b | |||
| 93119a478a | |||
| d57867da1d | |||
| 5ad923bf50 | |||
| 4076d9c9d4 | |||
| 9b848b64e0 | |||
| 7a3f0f3feb | |||
| 3772e2ea44 | |||
| 0c1962ca06 | |||
| 9317ca55dc | |||
| 9b052de408 | |||
| e340c86b62 | |||
| 8f2a40a960 | |||
| 0c28b34833 | |||
| 2df891993c | |||
| daf86f8b7d | |||
| 211754795b | |||
| 3aa32c4830 | |||
| 803871ae48 | |||
| ecbe31d210 | |||
| 3637024d45 | |||
| a17c282104 | |||
| b062ca29e7 | |||
| 18842a7069 | |||
| acd51c8d7e | |||
| 758900bf39 | |||
| 06aa7205d0 | |||
| 8ab25d7d31 | |||
| c4511687c4 | |||
| b2c5e66699 | |||
| b1a419d576 | |||
| e120a7698e |
@ -53,6 +53,8 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
|
||||
radiation->correct();
|
||||
|
||||
volScalarField& he = thermo.he();
|
||||
|
||||
fvScalarMatrix EEqn
|
||||
|
||||
@ -41,7 +41,6 @@
|
||||
p_rghDDtEqn =
|
||||
(
|
||||
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
||||
+ fvc::div(phiHbyA)
|
||||
==
|
||||
fvOptions(psi, p_rgh, rho.name())
|
||||
);
|
||||
@ -52,6 +51,7 @@
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
p_rghDDtEqn()
|
||||
+ fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rhorAUf, p_rgh)
|
||||
);
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
+ fvm::div(rhoPhi, T)
|
||||
- fvm::laplacian(mixture.alphaEff(turbulence->mut()), T)
|
||||
+ (
|
||||
fvc::div(fvc::absolute(phi, U), p)
|
||||
+ fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
|
||||
divU*p
|
||||
+ fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
|
||||
)
|
||||
*(
|
||||
alpha1/mixture.thermo1().Cv()
|
||||
@ -20,4 +20,4 @@
|
||||
mixture.correct();
|
||||
|
||||
Info<< "min(T) " << min(T).value() << endl;
|
||||
}
|
||||
}
|
||||
@ -70,6 +70,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
turbulence->validate();
|
||||
|
||||
|
||||
volScalarField rAU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rAU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("rAU", dimTime/rho.dimensions(), 1.0)
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
@ -77,45 +92,17 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "readControls.H"
|
||||
|
||||
{
|
||||
// Store divU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
|
||||
// Store divU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
volScalarField divU("divU0",fvc::div(fvc::absolute(phi, U)));
|
||||
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
}
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
@ -127,6 +114,46 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter())
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
if ((correctPhi && mesh.changing()) || mesh.topoChanging())
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
// SAF: temporary fix until mapped Uf is assessed
|
||||
Uf = fvc::interpolate(U);
|
||||
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
mixture.correct();
|
||||
|
||||
mesh.topoChanging(false);
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "alphaEqnsSubCycle.H"
|
||||
|
||||
// correct interface on first PIMPLE corrector
|
||||
@ -145,6 +172,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
@ -87,15 +87,6 @@
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
|
||||
p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
|
||||
|
||||
dgdt =
|
||||
(
|
||||
pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
|
||||
- pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
|
||||
);
|
||||
|
||||
phi = phiHbyA + p_rghEqnIncomp.flux();
|
||||
|
||||
U = HbyA
|
||||
@ -116,8 +107,19 @@
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
p = max(p_rgh + rho*gh, pMin);
|
||||
p_rgh = p - rho*gh;
|
||||
|
||||
dgdt =
|
||||
(
|
||||
pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
|
||||
- pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
|
||||
);
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -93,6 +93,7 @@ int main(int argc, char *argv[])
|
||||
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
||||
|
||||
#include "UEqn.H"
|
||||
volScalarField divU(fvc::div(fvc::absolute(phi, U)));
|
||||
#include "TEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -84,15 +84,6 @@
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
|
||||
p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
|
||||
|
||||
dgdt =
|
||||
(
|
||||
pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
|
||||
- pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
|
||||
);
|
||||
|
||||
phi = phiHbyA + p_rghEqnIncomp.flux();
|
||||
|
||||
U = HbyA
|
||||
@ -101,14 +92,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
// p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
|
||||
|
||||
// Update densities from change in p_rgh
|
||||
rho1 += psi1*(p_rgh - p_rgh_0);
|
||||
rho2 += psi2*(p_rgh - p_rgh_0);
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
p = max(p_rgh + rho*gh, pMin);
|
||||
p_rgh = p - rho*gh;
|
||||
|
||||
dgdt =
|
||||
(
|
||||
pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
|
||||
- pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
|
||||
);
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
|
||||
@ -133,9 +133,12 @@ int main(int argc, char *argv[])
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
if ((mesh.changing() && correctPhi) || mesh.topoChanging())
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
// SAF: temporary fix until mapped Uf is assessed
|
||||
Uf = fvc::interpolate(U);
|
||||
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
@ -144,6 +147,8 @@ int main(int argc, char *argv[])
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
mixture.correct();
|
||||
|
||||
mesh.topoChanging(false);
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-namedEnum.C
|
||||
Test-NamedEnum.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-NamedEnum
|
||||
|
||||
114
applications/test/NamedEnum/Test-NamedEnum.C
Normal file
114
applications/test/NamedEnum/Test-NamedEnum.C
Normal file
@ -0,0 +1,114 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
class namedEnumTest
|
||||
{
|
||||
public:
|
||||
|
||||
enum option
|
||||
{
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
};
|
||||
|
||||
static const Foam::NamedEnum<option, 4> namedEnum;
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum<namedEnumTest::option, 4>::names[] =
|
||||
{
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d"
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<namedEnumTest::option, 4> namedEnumTest::namedEnum;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const List<namedEnumTest::option> options
|
||||
= namedEnumTest::namedEnum.enums();
|
||||
|
||||
Info<< "enums: " << options << nl;
|
||||
|
||||
Info<< "loop over enums (as list):" << nl;
|
||||
forAll(options, i)
|
||||
{
|
||||
const namedEnumTest::option& opt = options[i];
|
||||
|
||||
Info<< "option[" << opt
|
||||
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
|
||||
}
|
||||
|
||||
#if __cplusplus > 201100L
|
||||
// C++11
|
||||
Info<< "loop over enums (C++11 for range):" << nl;
|
||||
for (auto const& opt : options)
|
||||
{
|
||||
Info<< "option[" << opt
|
||||
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
|
||||
}
|
||||
#else
|
||||
Info<< "loop over enums (via iterator):" << nl;
|
||||
forAllConstIter(List<namedEnumTest::option>, options, iter)
|
||||
{
|
||||
const namedEnumTest::option& opt = *iter;
|
||||
|
||||
Info<< "option[" << opt
|
||||
<< "] = '" << namedEnumTest::namedEnum[opt] << "'" << nl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Info<< nl
|
||||
<< namedEnumTest::namedEnum["a"] << nl
|
||||
<< namedEnumTest::namedEnum[namedEnumTest::a] << nl;
|
||||
|
||||
Info<< "--- test read construction ---" << endl;
|
||||
|
||||
namedEnumTest::option dummy(namedEnumTest::namedEnum.read(Sin));
|
||||
Info<< namedEnumTest::namedEnum[dummy] << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/test/boundBox/Make/files
Normal file
3
applications/test/boundBox/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-boundBox.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-boundBox
|
||||
7
applications/test/boundBox/Make/options
Normal file
7
applications/test/boundBox/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,38 +22,28 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Test bounding box behaviour
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "IOstreams.H"
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "boundBox.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
class namedEnumTest
|
||||
//- simple helper to create a cube
|
||||
boundBox cube(scalar start, scalar width)
|
||||
{
|
||||
public:
|
||||
|
||||
enum options
|
||||
{
|
||||
a,
|
||||
b,
|
||||
c
|
||||
};
|
||||
|
||||
static const Foam::NamedEnum<options, 3> namedEnum;
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum<namedEnumTest::options, 3>::names[] =
|
||||
{
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
};
|
||||
|
||||
const Foam::NamedEnum<namedEnumTest::options, 3> namedEnumTest::namedEnum;
|
||||
return boundBox
|
||||
(
|
||||
point(start, start, start),
|
||||
point(start + width, start + width, start + width)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -61,13 +51,14 @@ const Foam::NamedEnum<namedEnumTest::options, 3> namedEnumTest::namedEnum;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< namedEnumTest::namedEnum["a"] << endl;
|
||||
Info<< namedEnumTest::namedEnum[namedEnumTest::a] << endl;
|
||||
#include "setRootCase.H"
|
||||
// #include "createTime.H"
|
||||
// #include "createMesh.H"
|
||||
|
||||
namedEnumTest::options hmm(namedEnumTest::namedEnum.read(Sin));
|
||||
Info<< namedEnumTest::namedEnum[hmm] << endl;
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
Info<<"boundBox faces: " << boundBox::faces << endl;
|
||||
Info<<"hex faces: " << hex.modelFaces() << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -30,7 +30,8 @@ writeInterval #codeStream
|
||||
|
||||
codeOptions
|
||||
#{
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
#};
|
||||
|
||||
localCode
|
||||
|
||||
3
applications/test/cstring/Make/files
Normal file
3
applications/test/cstring/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-cstring.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-cstring
|
||||
2
applications/test/cstring/Make/options
Normal file
2
applications/test/cstring/Make/options
Normal file
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
|
||||
/* EXE_LIBS = -lfiniteVolume */
|
||||
99
applications/test/cstring/Test-cstring.C
Normal file
99
applications/test/cstring/Test-cstring.C
Normal file
@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Test some string functionality
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CStringList.H"
|
||||
#include "DynamicList.H"
|
||||
#include "IOstreams.H"
|
||||
#include "fileNameList.H"
|
||||
#include "stringList.H"
|
||||
#include "wordList.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int print(int argc, char *argv[])
|
||||
{
|
||||
Info<< "argc=" << argc << endl;
|
||||
for (int i=0; i<argc; ++i)
|
||||
{
|
||||
Info<< " argv[" << i << "] = \"" << argv[i] << "\"" << endl;
|
||||
}
|
||||
return argc;
|
||||
}
|
||||
|
||||
int print(const CStringList& cstrLst)
|
||||
{
|
||||
return print(cstrLst.size(), cstrLst.strings());
|
||||
}
|
||||
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
DynamicList<string> dynlst;
|
||||
dynlst.reserve(16);
|
||||
|
||||
dynlst.append("string1 with content");
|
||||
dynlst.append("string2 other content");
|
||||
dynlst.append("string3 done");
|
||||
|
||||
{
|
||||
CStringList inC(dynlst);
|
||||
|
||||
Info<< "input: " << dynlst << endl;
|
||||
print(inC);
|
||||
}
|
||||
|
||||
Info<<"command-line with " << CStringList::count(argv) << " items"<< endl;
|
||||
|
||||
print(argc, argv);
|
||||
{
|
||||
dynlst.clear();
|
||||
for (int i=0; i<argc; ++i)
|
||||
{
|
||||
dynlst.append(argv[i]);
|
||||
}
|
||||
|
||||
Info<< "input: " << dynlst << endl;
|
||||
CStringList inC(dynlst);
|
||||
inC.reset(dynlst);
|
||||
|
||||
print(inC);
|
||||
Info<< "length: " << inC.length() << endl;
|
||||
std::cout.write(inC.data(), inC.length());
|
||||
}
|
||||
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,6 +34,7 @@ Description
|
||||
#include "IOobject.H"
|
||||
#include "IOstreams.H"
|
||||
#include "OSspecific.H"
|
||||
#include "POSIX.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -99,6 +100,98 @@ int main()
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Test some copying and deletion
|
||||
{
|
||||
const fileName dirA("dirA");
|
||||
const fileName lnA("lnA");
|
||||
const fileName lnB("lnB");
|
||||
const fileName dirB("dirB");
|
||||
|
||||
Foam::rmDir(dirA);
|
||||
Foam::rm(lnA);
|
||||
Foam::rm(lnB);
|
||||
Foam::rmDir(dirB);
|
||||
|
||||
|
||||
Info<< "Creating directory " << dirA << endl;
|
||||
Foam::mkDir(dirA);
|
||||
|
||||
|
||||
const int oldPosix = POSIX::debug;
|
||||
POSIX::debug = 1;
|
||||
|
||||
|
||||
// Create link and test it
|
||||
Info<< "Creating softlink " << lnA << endl;
|
||||
Foam::ln(dirA, lnA);
|
||||
|
||||
fileName::Type lnAType = lnA.type(false);
|
||||
|
||||
if (lnAType != fileName::LINK)
|
||||
{
|
||||
FatalErrorIn("Test-fileName") << "Type of softlink " << lnA
|
||||
<< " should be " << fileName::LINK
|
||||
<< " but is " << lnAType << exit(FatalError);
|
||||
}
|
||||
|
||||
fileName::Type dirAType = lnA.type(true);
|
||||
|
||||
if (dirAType != fileName::DIRECTORY)
|
||||
{
|
||||
FatalErrorIn("Test-fileName") << "Type of what softlink " << lnA
|
||||
<< " points to should be " << fileName::DIRECTORY
|
||||
<< " but is " << dirAType << exit(FatalError);
|
||||
}
|
||||
|
||||
// Copy link only
|
||||
{
|
||||
Info<< "Copying (non-follow) softlink " << lnA << " to " << lnB
|
||||
<< endl;
|
||||
|
||||
Foam::cp(lnA, lnB, false);
|
||||
if (lnB.type(false) != fileName::LINK)
|
||||
{
|
||||
FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
|
||||
<< " should be " << fileName::LINK
|
||||
<< " but is " << lnB.type(false) << exit(FatalError);
|
||||
}
|
||||
if (lnB.type(true) != fileName::DIRECTORY)
|
||||
{
|
||||
FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
|
||||
<< " should be " << fileName::DIRECTORY
|
||||
<< " but is " << lnB.type(true) << exit(FatalError);
|
||||
}
|
||||
|
||||
// Delete
|
||||
Foam::rm(lnB);
|
||||
}
|
||||
|
||||
// Copy contents of link
|
||||
{
|
||||
Info<< "Copying (contents of) softlink " << lnA << " to " << lnB
|
||||
<< endl;
|
||||
|
||||
Foam::cp(lnA, lnB, true);
|
||||
if (lnB.type(false) != fileName::DIRECTORY)
|
||||
{
|
||||
FatalErrorIn("Test-fileName") << "Type of softlink " << lnB
|
||||
<< " should be " << fileName::DIRECTORY
|
||||
<< " but is " << lnB.type(false) << exit(FatalError);
|
||||
}
|
||||
|
||||
// Delete
|
||||
Foam::rm(lnB);
|
||||
}
|
||||
|
||||
POSIX::debug = oldPosix;
|
||||
|
||||
Foam::rmDir(dirA);
|
||||
Foam::rm(lnA);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// test findEtcFile
|
||||
Info<< "\n\nfindEtcFile tests:" << nl
|
||||
<< " controlDict => " << findEtcFile("controlDict") << nl
|
||||
|
||||
3
applications/test/fvc2D/Make/files
Normal file
3
applications/test/fvc2D/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-fvc2D.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-fvc2D
|
||||
7
applications/test/fvc2D/Make/options
Normal file
7
applications/test/fvc2D/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
75
applications/test/fvc2D/Test-fvc2D.C
Normal file
75
applications/test/fvc2D/Test-fvc2D.C
Normal file
@ -0,0 +1,75 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
test
|
||||
|
||||
Description
|
||||
Finite volume method test code.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "vector2D.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
namespace Foam
|
||||
{
|
||||
typedef GeometricField<vector2D, fvPatchField, volMesh> volVector2DField;
|
||||
|
||||
defineTemplate2TypeNameAndDebug
|
||||
(
|
||||
volVector2DField::DimensionedInternalField,
|
||||
0
|
||||
);
|
||||
defineTemplateTypeNameAndDebug(volVector2DField, 0);
|
||||
|
||||
typedef fvPatchField<vector2D> fvPatchVector2DField;
|
||||
makeFvPatchField(fvPatchVector2DField)
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
GeometricField<vector2D, fvPatchField, volMesh> fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "end" << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -75,8 +75,8 @@ int main(int argc, char *argv[])
|
||||
wre.info(Info) << " after DETECT" << endl;
|
||||
wre.uncompile();
|
||||
wre.info(Info) << " uncompiled" << endl;
|
||||
wre.recompile();
|
||||
wre.info(Info) << " recompiled" << endl;
|
||||
wre.compile();
|
||||
wre.info(Info) << " re-compiled" << endl;
|
||||
|
||||
wre.set("something .* value", wordRe::LITERAL);
|
||||
wre.info(Info) << " set as LITERAL" << endl;
|
||||
|
||||
@ -8,15 +8,15 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
# Get version info and arch-path
|
||||
. $WM_PROJECT_DIR/etc/config.sh/functions
|
||||
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/libccmio)
|
||||
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
|
||||
|
||||
set -x
|
||||
|
||||
# Build libccmio (.so)
|
||||
$WM_THIRD_PARTY_DIR/makeCCMIO
|
||||
# Build libccmio (.a|.so)
|
||||
$WM_THIRD_PARTY_DIR/makeCCMIO lib # libso
|
||||
|
||||
if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \
|
||||
-a -e $FOAM_EXT_LIBBIN/libccmio.so ]
|
||||
-a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o $FOAM_EXT_LIBBIN/libccmio.so \) ]
|
||||
then
|
||||
wmake ccm26ToFoam
|
||||
fi
|
||||
|
||||
@ -6,4 +6,4 @@ EXE_INC = \
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-L$(FOAM_EXT_LIBBIN) -lccmio
|
||||
-L$(CCMIO_ARCH_PATH)/lib -L$(FOAM_EXT_LIBBIN) -lccmio
|
||||
|
||||
@ -63,12 +63,17 @@ using namespace Foam;
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Element type numbers
|
||||
|
||||
static label MSHLINE = 1;
|
||||
|
||||
static label MSHTRI = 2;
|
||||
static label MSHQUAD = 3;
|
||||
static label MSHTET = 4;
|
||||
static label MSHPYR = 7;
|
||||
static label MSHPRISM = 6;
|
||||
|
||||
|
||||
static label MSHHEX = 5;
|
||||
static label MSHPRISM = 6;
|
||||
static label MSHPYR = 7;
|
||||
|
||||
|
||||
// Skips till end of section. Returns false if end of file.
|
||||
@ -424,6 +429,11 @@ void readCells
|
||||
List<DynamicList<label>>& zoneCells
|
||||
)
|
||||
{
|
||||
//$Elements
|
||||
//number-of-elements
|
||||
//elm-number elm-type number-of-tags < tag > \u2026 node-number-list
|
||||
|
||||
|
||||
Info<< "Starting to read cells at line " << inFile.lineNumber() << endl;
|
||||
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
@ -473,13 +483,12 @@ void readCells
|
||||
IStringStream lineStr(line);
|
||||
|
||||
label elmNumber, elmType, regPhys;
|
||||
|
||||
if (versionFormat >= 2)
|
||||
{
|
||||
lineStr >> elmNumber >> elmType;
|
||||
|
||||
label nTags;
|
||||
lineStr>> nTags;
|
||||
lineStr >> nTags;
|
||||
|
||||
if (nTags > 0)
|
||||
{
|
||||
@ -488,7 +497,7 @@ void readCells
|
||||
for (label i = 1; i < nTags; i++)
|
||||
{
|
||||
label dummy;
|
||||
lineStr>> dummy;
|
||||
lineStr >> dummy;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -499,8 +508,12 @@ void readCells
|
||||
}
|
||||
|
||||
// regPhys on surface elements is region number.
|
||||
|
||||
if (elmType == MSHTRI)
|
||||
if (elmType == MSHLINE)
|
||||
{
|
||||
label meshPti;
|
||||
lineStr >> meshPti >> meshPti;
|
||||
}
|
||||
else if (elmType == MSHTRI)
|
||||
{
|
||||
lineStr >> triPoints[0] >> triPoints[1] >> triPoints[2];
|
||||
|
||||
|
||||
@ -107,16 +107,12 @@ int main(int argc, char *argv[])
|
||||
fileName dictPath;
|
||||
|
||||
// Check if the dictionary is specified on the command-line
|
||||
if (args.optionFound("dict"))
|
||||
if (args.optionReadIfPresent("dict", dictPath))
|
||||
{
|
||||
dictPath = args["dict"];
|
||||
|
||||
dictPath =
|
||||
(
|
||||
isDir(dictPath)
|
||||
? dictPath/dictName
|
||||
: dictPath
|
||||
);
|
||||
if (isDir(dictPath))
|
||||
{
|
||||
dictPath = dictPath / dictName;
|
||||
}
|
||||
}
|
||||
// Check if dictionary is present in the constant directory
|
||||
else if
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::tmp<Foam::Field<Type>> filterFarPoints
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
|
||||
Field<Type>& newField = tNewField();
|
||||
Field<Type>& newField = tNewField.ref();
|
||||
|
||||
label added = 0;
|
||||
label count = 0;
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::tmp<Foam::Field<Type>> Foam::smoothAlignmentSolver::filterFarPoints
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
|
||||
Field<Type>& newField = tNewField();
|
||||
Field<Type>& newField = tNewField.ref();
|
||||
|
||||
label added = 0;
|
||||
label count = 0;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,14 +67,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile;
|
||||
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
|
||||
{
|
||||
if (isDir(decompDictFile))
|
||||
{
|
||||
decompDictFile = decompDictFile / "decomposeParDict";
|
||||
}
|
||||
}
|
||||
|
||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||
|
||||
IOdictionary foamyHexMeshDict
|
||||
(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -524,13 +524,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile;
|
||||
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
|
||||
{
|
||||
if (isDir(decompDictFile))
|
||||
{
|
||||
decompDictFile = decompDictFile / "decomposeParDict";
|
||||
}
|
||||
}
|
||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||
|
||||
labelList decomp = decompositionModel::New
|
||||
(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright 2015-2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -613,6 +613,7 @@ void writeMesh
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addRegionOption.H"
|
||||
#include "addOverwriteOption.H"
|
||||
Foam::argList::addBoolOption
|
||||
(
|
||||
@ -762,20 +763,29 @@ int main(int argc, char *argv[])
|
||||
// }
|
||||
// else
|
||||
{
|
||||
Foam::Info
|
||||
<< "Create mesh for time = "
|
||||
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||
word regionName;
|
||||
if (args.optionReadIfPresent("region", regionName))
|
||||
{
|
||||
Info<< "Create mesh " << regionName << " for time = "
|
||||
<< runTime.timeName() << nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
regionName = fvMesh::defaultRegion;
|
||||
Info<< "Create mesh for time = "
|
||||
<< runTime.timeName() << nl << endl;
|
||||
}
|
||||
|
||||
meshPtr.set
|
||||
(
|
||||
new fvMesh
|
||||
(
|
||||
Foam::IOobject
|
||||
IOobject
|
||||
(
|
||||
Foam::fvMesh::defaultRegion,
|
||||
regionName,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
Foam::IOobject::MUST_READ
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -827,13 +837,7 @@ int main(int argc, char *argv[])
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
fileName decompDictFile;
|
||||
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
|
||||
{
|
||||
if (isDir(decompDictFile))
|
||||
{
|
||||
decompDictFile = decompDictFile/"decomposeParDict";
|
||||
}
|
||||
}
|
||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||
|
||||
decomposeDict = IOdictionary
|
||||
(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -100,7 +100,7 @@ int main(int argc, char *argv[])
|
||||
IOobject
|
||||
(
|
||||
singleCellName,
|
||||
mesh.polyMesh::instance(),
|
||||
mesh.pointsInstance(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
@ -108,6 +108,8 @@ int main(int argc, char *argv[])
|
||||
mesh
|
||||
)
|
||||
);
|
||||
scMesh().setInstance(mesh.pointsInstance());
|
||||
|
||||
// For convenience create any fv* files
|
||||
if (!exists(scMesh().fvSolution::objectPath()))
|
||||
{
|
||||
@ -140,7 +142,7 @@ int main(int argc, char *argv[])
|
||||
IOobject
|
||||
(
|
||||
singleCellName,
|
||||
mesh.polyMesh::instance(),
|
||||
mesh.pointsInstance(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
|
||||
11
applications/utilities/miscellaneous/foamDebugSwitches/Allwmake
Executable file
11
applications/utilities/miscellaneous/foamDebugSwitches/Allwmake
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
if [ -f "$FFTW_ARCH_PATH/include/fftw3.h" ] || \
|
||||
[ "${FFTW_ARCH_PATH##*-}" = system -a -f "/usr/include/fftw3.h" ]
|
||||
then
|
||||
export LINK_FLAGS="-lrandomProcesses"
|
||||
fi
|
||||
wmake
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_LIBS = \
|
||||
$(LINK_FLAGS) \
|
||||
-lsnappyHexMesh \
|
||||
-lbarotropicCompressibilityModel \
|
||||
-lsolidThermo \
|
||||
@ -41,7 +42,6 @@ EXE_LIBS = \
|
||||
-lOpenFOAM \
|
||||
-lpotential \
|
||||
-lradiationModels \
|
||||
-lrandomProcesses \
|
||||
-lreactionThermophysicalModels \
|
||||
-lreconstruct \
|
||||
-lsampling \
|
||||
|
||||
@ -151,7 +151,7 @@ void Foam::helpType::displayDoc
|
||||
Info<< "Source file: " << classDirectory.c_str() << classFile << nl
|
||||
<< endl;
|
||||
|
||||
system(docBrowser);
|
||||
Foam::system(docBrowser);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -23,6 +23,8 @@ License
|
||||
|
||||
Application
|
||||
foamInfoExec
|
||||
To simplify parsing of the output, The normal banner information
|
||||
is suppressed.
|
||||
|
||||
Group
|
||||
grpMiscUtilities
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -211,14 +211,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile;
|
||||
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
|
||||
{
|
||||
if (isDir(decompDictFile))
|
||||
{
|
||||
decompDictFile = decompDictFile/"decomposeParDict";
|
||||
}
|
||||
}
|
||||
|
||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||
|
||||
wordList regionNames;
|
||||
wordList regionDirs;
|
||||
@ -301,7 +294,6 @@ int main(int argc, char *argv[])
|
||||
),
|
||||
decompDictFile
|
||||
)
|
||||
|
||||
).lookup("numberOfSubdomains")
|
||||
);
|
||||
|
||||
@ -425,7 +417,8 @@ int main(int argc, char *argv[])
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("cellDist", dimless, 0)
|
||||
dimensionedScalar("cellDist", dimless, -1),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
forAll(procIds, celli)
|
||||
@ -433,6 +426,7 @@ int main(int argc, char *argv[])
|
||||
cellDist[celli] = procIds[celli];
|
||||
}
|
||||
|
||||
cellDist.correctBoundaryConditions();
|
||||
cellDist.write();
|
||||
|
||||
Info<< nl << "Wrote decomposition as volScalarField to "
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -64,6 +64,7 @@ Usage
|
||||
#include "fvMeshTools.H"
|
||||
#include "fvMeshDistribute.H"
|
||||
#include "decompositionMethod.H"
|
||||
#include "decompositionModel.H"
|
||||
#include "timeSelector.H"
|
||||
#include "PstreamReduceOps.H"
|
||||
#include "volFields.H"
|
||||
@ -74,7 +75,6 @@ Usage
|
||||
#include "loadOrCreateMesh.H"
|
||||
#include "processorFvPatchField.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "decompositionModel.H"
|
||||
|
||||
#include "parFvFieldReconstructor.H"
|
||||
#include "parLagrangianRedistributor.H"
|
||||
@ -2153,7 +2153,6 @@ int main(int argc, char *argv[])
|
||||
bool newTimes = args.optionFound("newTimes");
|
||||
|
||||
|
||||
|
||||
if (env("FOAM_SIGFPE"))
|
||||
{
|
||||
WarningInFunction
|
||||
@ -2246,8 +2245,6 @@ int main(int argc, char *argv[])
|
||||
Pstream::scatter(decompose);
|
||||
|
||||
|
||||
|
||||
|
||||
// If running distributed we have problem of new processors not finding
|
||||
// a system/controlDict. However if we switch on the master-only reading
|
||||
// the problem becomes that the time directories are differing sizes and
|
||||
@ -2331,7 +2328,6 @@ int main(int argc, char *argv[])
|
||||
// Determine any region
|
||||
word regionName = polyMesh::defaultRegion;
|
||||
fileName meshSubDir;
|
||||
|
||||
if (args.optionReadIfPresent("region", regionName))
|
||||
{
|
||||
meshSubDir = regionName/polyMesh::meshSubDir;
|
||||
@ -2775,13 +2771,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
fileName decompDictFile;
|
||||
if (args.optionReadIfPresent("decomposeParDict", decompDictFile))
|
||||
{
|
||||
if (isDir(decompDictFile))
|
||||
{
|
||||
decompDictFile = decompDictFile / "decomposeParDict";
|
||||
}
|
||||
}
|
||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||
|
||||
|
||||
// Determine decomposition
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
itoa.C
|
||||
ensightMesh.C
|
||||
ensightParticlePositions.C
|
||||
ensightCloud.C
|
||||
foamToEnsight.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/foamToEnsight
|
||||
|
||||
@ -5,7 +5,8 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/conversion/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
@ -13,5 +14,5 @@ EXE_LIBS = \
|
||||
-lfileFormats \
|
||||
-lsampling \
|
||||
-lgenericPatchFields \
|
||||
-llagrangian
|
||||
|
||||
-llagrangian \
|
||||
-lconversion
|
||||
|
||||
@ -1,21 +1,33 @@
|
||||
// ignore special fields or fields that we don't handle
|
||||
//
|
||||
bool variableGood = true;
|
||||
for (label n1=0; n1<Times.size() && variableGood; ++n1)
|
||||
// ignore special fields (_0 fields),
|
||||
// ignore fields we don't handle,
|
||||
// ignore fields that are not available for all time-steps
|
||||
|
||||
// hash by field-name in fieldsToUse
|
||||
if (!fieldsToUse.found(fieldName))
|
||||
{
|
||||
// ignore _0 fields
|
||||
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
|
||||
bool variableGood = false;
|
||||
|
||||
forAll(timeDirs, n1)
|
||||
{
|
||||
variableGood = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
variableGood = IOobject
|
||||
variableGood =
|
||||
(
|
||||
fieldName,
|
||||
Times[n1].name(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).typeHeaderOk<volScalarField>(false);
|
||||
fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
|
||||
? false
|
||||
: IOobject
|
||||
(
|
||||
fieldName,
|
||||
timeDirs[n1].name(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).typeHeaderOk<volScalarField>(false)
|
||||
);
|
||||
|
||||
if (!variableGood)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(variableGood, andOp<bool>());
|
||||
fieldsToUse.set(fieldName, variableGood);
|
||||
}
|
||||
|
||||
@ -1,27 +1,50 @@
|
||||
// check for "points" in any of the result directories
|
||||
|
||||
bool meshMoving = false;
|
||||
if (Times.size() > 1)
|
||||
|
||||
if (timeDirs.size() > 1 && Pstream::master())
|
||||
{
|
||||
// We already loaded a mesh (usually from constant). See if any other
|
||||
// points files
|
||||
forAll(Times, timeI)
|
||||
// We already loaded a mesh (usually from constant).
|
||||
// See if any other "polyMesh/points" files exist too.
|
||||
|
||||
const fileName& baseDir = mesh.time().path();
|
||||
|
||||
Info<< "Search for moving mesh ... " << flush;
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
if (Times[timeI].name() != mesh.pointsInstance())
|
||||
{
|
||||
IOobject io
|
||||
const word& timeName = timeDirs[timeI].name();
|
||||
|
||||
meshMoving =
|
||||
(
|
||||
timeName != mesh.pointsInstance()
|
||||
&& isDir(baseDir/timeName/polyMesh::meshSubDir)
|
||||
&& IOobject
|
||||
(
|
||||
"points",
|
||||
Times[timeI].name(),
|
||||
timeName,
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
if (io.typeHeaderOk<pointIOField>(true))
|
||||
{
|
||||
meshMoving = true;
|
||||
break;
|
||||
}
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
);
|
||||
|
||||
if (meshMoving)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (meshMoving)
|
||||
{
|
||||
Info<< "found." << nl
|
||||
<< " Writing meshes for every timestep." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "none detected." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(meshMoving, orOp<bool>());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,17 +52,17 @@ class ensightAsciiStream
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Description of data_
|
||||
//- Output file stream
|
||||
OFstream str_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
ensightAsciiStream(const ensightAsciiStream&);
|
||||
ensightAsciiStream(const ensightAsciiStream&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ensightAsciiStream&);
|
||||
void operator=(const ensightAsciiStream&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -70,14 +70,14 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
ensightAsciiStream(const fileName& f, const Time& runTime)
|
||||
ensightAsciiStream(const fileName& f)
|
||||
:
|
||||
ensightStream(f),
|
||||
str_
|
||||
(
|
||||
f,
|
||||
runTime.writeFormat(),
|
||||
runTime.writeVersion(),
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED
|
||||
)
|
||||
{
|
||||
@ -139,14 +139,6 @@ public:
|
||||
<< setw(10) << partI << nl;
|
||||
}
|
||||
|
||||
// Member Operators
|
||||
|
||||
// Friend Functions
|
||||
|
||||
// Friend Operators
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -51,17 +51,17 @@ class ensightBinaryStream
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Description of data_
|
||||
//- Output file stream
|
||||
autoPtr<std::ofstream> str_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
ensightBinaryStream(const ensightBinaryStream&);
|
||||
ensightBinaryStream(const ensightBinaryStream&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ensightBinaryStream&);
|
||||
void operator=(const ensightBinaryStream&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -69,7 +69,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
ensightBinaryStream(const fileName& f, const Time&)
|
||||
ensightBinaryStream(const fileName& f)
|
||||
:
|
||||
ensightStream(f),
|
||||
str_
|
||||
@ -90,11 +90,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual bool ascii() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void write(const char* val)
|
||||
{
|
||||
char buffer[80];
|
||||
@ -141,14 +136,6 @@ public:
|
||||
write(partI);
|
||||
}
|
||||
|
||||
// Member Operators
|
||||
|
||||
// Friend Functions
|
||||
|
||||
// Friend Operators
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
|
||||
ensightCaseFile.precision(5);
|
||||
|
||||
ensightCaseFile << nl << "TIME" << nl
|
||||
<< "time set: " << 1 << nl
|
||||
<< "number of steps: " << nTimeSteps << nl
|
||||
@ -8,20 +11,17 @@ if (Pstream::master())
|
||||
|
||||
ensightCaseFile << "time values:" << nl;
|
||||
|
||||
ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
|
||||
ensightCaseFile.precision(5);
|
||||
|
||||
label count = 0;
|
||||
scalar Tcorr = 0.0;
|
||||
if (Times[0].value() < 0)
|
||||
if (timeDirs[0].value() < 0)
|
||||
{
|
||||
Tcorr = - Times[0].value();
|
||||
Tcorr = -timeDirs[0].value();
|
||||
Info<< "Correcting time values. Adding " << Tcorr << endl;
|
||||
}
|
||||
|
||||
forAll(Times, n)
|
||||
forAll(timeDirs, n)
|
||||
{
|
||||
ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " ";
|
||||
ensightCaseFile << setw(12) << timeDirs[n].value() + Tcorr << " ";
|
||||
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
|
||||
@ -0,0 +1,180 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightCloud.H"
|
||||
#include "ensightFile.H"
|
||||
#include "fvMesh.H"
|
||||
#include "passiveParticle.H"
|
||||
#include "Cloud.H"
|
||||
#include "pointList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightParticlePositions
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fileName& dataDir,
|
||||
const label timeIndex,
|
||||
const word& cloudName,
|
||||
const bool dataExists,
|
||||
IOstream::streamFormat format
|
||||
)
|
||||
{
|
||||
if (dataExists)
|
||||
{
|
||||
Info<< " positions";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " positions{0}";
|
||||
}
|
||||
|
||||
// Total number of parcels on all processes
|
||||
label nTotParcels = 0;
|
||||
autoPtr<Cloud<passiveParticle>> cloudPtr;
|
||||
|
||||
if (dataExists)
|
||||
{
|
||||
cloudPtr.reset(new Cloud<passiveParticle>(mesh, cloudName, false));
|
||||
nTotParcels = cloudPtr().size();
|
||||
}
|
||||
reduce(nTotParcels, sumOp<label>());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const fileName postFileName =
|
||||
ensightFile::subDir(timeIndex)/cloud::prefix/cloudName/"positions";
|
||||
|
||||
// the ITER/lagrangian subdirectory must exist
|
||||
mkDir(dataDir/postFileName.path());
|
||||
|
||||
ensightFile os(dataDir, postFileName, format);
|
||||
|
||||
// tag binary format (just like geometry files)
|
||||
os.writeBinaryHeader();
|
||||
os.write(postFileName); // description
|
||||
os.newline();
|
||||
os.write("particle coordinates");
|
||||
os.newline();
|
||||
os.write(nTotParcels, 8); // unusual width
|
||||
os.newline();
|
||||
|
||||
if (!nTotParcels)
|
||||
{
|
||||
return; // DONE
|
||||
}
|
||||
|
||||
if (format == IOstream::BINARY)
|
||||
{
|
||||
// binary write is Ensight6 - first ids, then positions
|
||||
|
||||
// 1-index
|
||||
for (label parcelId = 0; parcelId < nTotParcels; ++parcelId)
|
||||
{
|
||||
os.write(parcelId+1);
|
||||
}
|
||||
|
||||
// Master
|
||||
forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
|
||||
{
|
||||
const point& p = elmnt().position();
|
||||
|
||||
os.write(p.x());
|
||||
os.write(p.y());
|
||||
os.write(p.z());
|
||||
}
|
||||
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
pointList points(fromSlave);
|
||||
|
||||
forAll(points, pti)
|
||||
{
|
||||
const point& p = points[pti];
|
||||
|
||||
os.write(p.x());
|
||||
os.write(p.y());
|
||||
os.write(p.z());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ASCII id + position together
|
||||
|
||||
label parcelId = 0;
|
||||
forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
|
||||
{
|
||||
const point& p = elmnt().position();
|
||||
|
||||
os.write(++parcelId, 8); // unusual width
|
||||
os.write(p.x());
|
||||
os.write(p.y());
|
||||
os.write(p.z());
|
||||
os.newline();
|
||||
}
|
||||
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
pointList points(fromSlave);
|
||||
|
||||
forAll(points, pti)
|
||||
{
|
||||
const point& p = points[pti];
|
||||
|
||||
os.write(++parcelId, 8); // unusual width
|
||||
os.write(p.x());
|
||||
os.write(p.y());
|
||||
os.write(p.z());
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (nTotParcels)
|
||||
{
|
||||
// SLAVE, and data exist
|
||||
pointList points(cloudPtr().size());
|
||||
|
||||
label pti = 0;
|
||||
forAllConstIter(Cloud<passiveParticle>, cloudPtr(), elmnt)
|
||||
{
|
||||
const point& p = elmnt().position();
|
||||
points[pti++] = p;
|
||||
}
|
||||
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< points;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,35 +27,62 @@ InApplication
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
ensightCloudField.C
|
||||
ensightCloud.C
|
||||
ensightCloudTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ensightCloudField_H
|
||||
#define ensightCloudField_H
|
||||
#ifndef ensightCloud_H
|
||||
#define ensightCloud_H
|
||||
|
||||
#include "ensightFile.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Cloud.H"
|
||||
#include "IOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
void ensightParticlePositions
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fileName& dataDir,
|
||||
const label timeIndex,
|
||||
const word& cloudName,
|
||||
const bool dataExists,
|
||||
const IOstream::streamFormat format
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
void ensightCloudField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const fileName& dataDir,
|
||||
const label timeIndex,
|
||||
const word& timeFile,
|
||||
const word& cloudName,
|
||||
const label cloudNo,
|
||||
Ostream& ensightCaseFile,
|
||||
const bool dataExists
|
||||
const bool dataExists,
|
||||
const IOstream::streamFormat format
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
void writeCloudField
|
||||
(
|
||||
const IOField<Type>& field,
|
||||
ensightFile& os
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "ensightCloudField.C"
|
||||
#include "ensightCloudTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -1,129 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightCloudField.H"
|
||||
#include "Time.H"
|
||||
#include "IOField.H"
|
||||
#include "OFstream.H"
|
||||
#include "IOmanip.H"
|
||||
#include "ensightPTraits.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void ensightCloudField
|
||||
(
|
||||
const IOobject& fieldObject,
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const label timeIndex,
|
||||
const word& cloudName,
|
||||
Ostream& ensightCaseFile,
|
||||
const bool dataExists
|
||||
)
|
||||
{
|
||||
if (dataExists)
|
||||
{
|
||||
Info<< "Converting cloud " << cloudName
|
||||
<< " field " << fieldObject.name() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Creating empty cloud " << cloudName
|
||||
<< " field " << fieldObject.name() << endl;
|
||||
}
|
||||
|
||||
word timeFile = prepend + itoa(timeIndex);
|
||||
|
||||
const Time& runTime = fieldObject.time();
|
||||
|
||||
if (timeIndex == 0 && Pstream::master())
|
||||
{
|
||||
ensightCaseFile
|
||||
<< pTraits<Type>::typeName << " per measured node: 1 ";
|
||||
ensightCaseFile.width(15);
|
||||
ensightCaseFile.setf(ios_base::left);
|
||||
ensightCaseFile
|
||||
<< ("c" + fieldObject.name()).c_str()
|
||||
<< (' ' + prepend + "****." + cloudName
|
||||
+ "." + fieldObject.name()).c_str()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
fileName ensightFileName
|
||||
(
|
||||
timeFile + "." + cloudName +"." + fieldObject.name()
|
||||
);
|
||||
|
||||
OFstream ensightFile
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
runTime.writeFormat(),
|
||||
runTime.writeVersion(),
|
||||
runTime.writeCompression()
|
||||
);
|
||||
|
||||
ensightFile<< pTraits<Type>::typeName << " values" << nl;
|
||||
|
||||
if (dataExists)
|
||||
{
|
||||
IOField<Type> vf(fieldObject);
|
||||
|
||||
ensightFile.setf(ios_base::scientific, ios_base::floatfield);
|
||||
ensightFile.precision(5);
|
||||
|
||||
label count = 0;
|
||||
forAll(vf, i)
|
||||
{
|
||||
Type v = vf[i];
|
||||
|
||||
if (mag(v) < 1.0e-90)
|
||||
{
|
||||
v = Zero;
|
||||
}
|
||||
|
||||
for (direction i=0; i < pTraits<Type>::nComponents; ++i)
|
||||
{
|
||||
label cmpt = ensightPTraits<Type>::componentOrder[i];
|
||||
|
||||
ensightFile << setw(12) << component(v, cmpt);
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
ensightFile << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((count % 6 != 0) || (count==0))
|
||||
{
|
||||
ensightFile << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,192 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightCloud.H"
|
||||
#include "ensightFile.H"
|
||||
#include "Time.H"
|
||||
#include "IOField.H"
|
||||
#include "OFstream.H"
|
||||
#include "IOmanip.H"
|
||||
#include "ensightPTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::writeCloudField
|
||||
(
|
||||
const Foam::IOField<Type>& field,
|
||||
Foam::ensightFile& os
|
||||
)
|
||||
{
|
||||
if (returnReduce(field.size(), sumOp<label>()) > 0)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
// 6 values per line
|
||||
label count = 0;
|
||||
|
||||
// Master
|
||||
forAll(field, i)
|
||||
{
|
||||
Type val = field[i];
|
||||
|
||||
if (mag(val) < 1e-90)
|
||||
{
|
||||
val = Zero;
|
||||
}
|
||||
|
||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||
{
|
||||
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
||||
os.write(component(val, cmpt));
|
||||
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); ++slave)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
Field<Type> slaveData(fromSlave);
|
||||
|
||||
forAll(slaveData, i)
|
||||
{
|
||||
Type val = slaveData[i];
|
||||
|
||||
if (mag(val) < 1e-90)
|
||||
{
|
||||
val = Zero;
|
||||
}
|
||||
|
||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||
{
|
||||
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
||||
os.write(component(val, cmpt));
|
||||
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add final newline if required
|
||||
if (count % 6)
|
||||
{
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< field;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::ensightCloudField
|
||||
(
|
||||
const Foam::IOobject& fieldObject,
|
||||
const Foam::fileName& dataDir,
|
||||
const Foam::label timeIndex,
|
||||
const Foam::word& cloudName,
|
||||
const Foam::label cloudNo,
|
||||
Foam::Ostream& ensightCaseFile,
|
||||
const bool dataExists,
|
||||
Foam::IOstream::streamFormat format
|
||||
)
|
||||
{
|
||||
const ensight::VarName varName(fieldObject.name());
|
||||
|
||||
if (dataExists)
|
||||
{
|
||||
Info<< ' ' << fieldObject.name();
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< ' ' << fieldObject.name() << "{0}"; // ie, empty field
|
||||
}
|
||||
|
||||
ensightFile* filePtr(nullptr);
|
||||
if (Pstream::master())
|
||||
{
|
||||
const fileName postFileName =
|
||||
ensightFile::subDir(timeIndex)/cloud::prefix/cloudName/varName;
|
||||
|
||||
// the ITER/lagrangian subdirectory must exist
|
||||
// the ITER/lagrangian subdirectory was already created
|
||||
// when writing positions
|
||||
|
||||
mkDir(dataDir/postFileName.path());
|
||||
|
||||
if (timeIndex == 0)
|
||||
{
|
||||
const fileName dirName =
|
||||
dataDir.name()/ensightFile::mask()/cloud::prefix/cloudName;
|
||||
|
||||
ensightCaseFile.setf(ios_base::left);
|
||||
|
||||
// prefix variables with 'c' (cloud)
|
||||
ensightCaseFile
|
||||
<< ensightPTraits<Type>::typeName << " per "
|
||||
<< setw(20)
|
||||
<< "measured node:"
|
||||
<< " 1 "
|
||||
<< setw(15)
|
||||
<< ("c" + Foam::name(cloudNo) + varName).c_str() << ' '
|
||||
<< (dirName/varName).c_str()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
filePtr = new ensightFile(dataDir, postFileName, format);
|
||||
// description
|
||||
filePtr->write
|
||||
(
|
||||
string(postFileName + " <" + pTraits<Type>::typeName + ">")
|
||||
);
|
||||
filePtr->newline();
|
||||
}
|
||||
|
||||
if (dataExists)
|
||||
{
|
||||
IOField<Type> field(fieldObject);
|
||||
writeCloudField(field, *filePtr);
|
||||
}
|
||||
|
||||
if (filePtr) // on master only
|
||||
{
|
||||
delete filePtr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -23,12 +23,12 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightFile.H"
|
||||
#include "ensightField.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "OFstream.H"
|
||||
#include "IOmanip.H"
|
||||
#include "itoa.H"
|
||||
#include "volPointInterpolation.H"
|
||||
#include "ensightBinaryStream.H"
|
||||
#include "ensightAsciiStream.H"
|
||||
@ -81,7 +81,9 @@ volField
|
||||
// Construct volField (with zeroGradient) from dimensioned field
|
||||
|
||||
IOobject io(df);
|
||||
io.readOpt() = IOobject::NO_READ;
|
||||
io.readOpt() = IOobject::NO_READ;
|
||||
io.writeOpt() = IOobject::NO_WRITE;
|
||||
io.registerObject() = false;
|
||||
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tvf
|
||||
(
|
||||
@ -89,16 +91,17 @@ volField
|
||||
(
|
||||
io,
|
||||
df.mesh(),
|
||||
df.dimensions(),
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
dimensioned<Type>("0", df.dimensions(), Zero),
|
||||
zeroGradientFvPatchField<Type>::typeName
|
||||
)
|
||||
);
|
||||
tvf.ref().internalField() = df;
|
||||
tvf.ref().correctBoundaryConditions();
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf = tvf();
|
||||
|
||||
if (meshSubsetter.hasSubMesh())
|
||||
{
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf = tvf();
|
||||
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tfld
|
||||
(
|
||||
meshSubsetter.interpolate(vf)
|
||||
@ -121,10 +124,8 @@ volField
|
||||
// const IOobject& io,
|
||||
// const fvMesh& mesh,
|
||||
// const ensightMesh& eMesh,
|
||||
// const fileName& postProcPath,
|
||||
// const word& prepend,
|
||||
// const fileName& dataDir,
|
||||
// const label timeIndex,
|
||||
// const bool binary,
|
||||
// const bool nodeValues,
|
||||
// Ostream& ensightCaseFile
|
||||
//)
|
||||
@ -134,10 +135,8 @@ volField
|
||||
// (
|
||||
// volField<typename Container::value_type>(meshSubsetter, fld),
|
||||
// eMesh,
|
||||
// postProcPath,
|
||||
// prepend,
|
||||
// dataDir,
|
||||
// timeIndex,
|
||||
// binary,
|
||||
// nodeValues,
|
||||
// ensightCaseFile
|
||||
// );
|
||||
@ -175,26 +174,26 @@ void writeField
|
||||
(
|
||||
const char* key,
|
||||
const Field<Type>& vf,
|
||||
ensightStream& ensightFile
|
||||
ensightStream& os
|
||||
)
|
||||
{
|
||||
if (returnReduce(vf.size(), sumOp<label>()) > 0)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.write(key);
|
||||
os.write(key);
|
||||
|
||||
for (direction i=0; i < pTraits<Type>::nComponents; ++i)
|
||||
{
|
||||
label cmpt = ensightPTraits<Type>::componentOrder[i];
|
||||
|
||||
ensightFile.write(vf.component(cmpt));
|
||||
os.write(vf.component(cmpt));
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField slaveData(fromSlave);
|
||||
ensightFile.write(slaveData);
|
||||
os.write(slaveData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,35 +219,35 @@ bool writePatchField
|
||||
const label ensightPatchI,
|
||||
const faceSets& boundaryFaceSet,
|
||||
const ensightMesh::nFacePrimitives& nfp,
|
||||
ensightStream& ensightFile
|
||||
ensightStream& os
|
||||
)
|
||||
{
|
||||
if (nfp.nTris || nfp.nQuads || nfp.nPolys)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.writePartHeader(ensightPatchI);
|
||||
os.writePartHeader(ensightPatchI);
|
||||
}
|
||||
|
||||
writeField
|
||||
(
|
||||
"tria3",
|
||||
Field<Type>(pf, boundaryFaceSet.tris),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
writeField
|
||||
(
|
||||
"quad4",
|
||||
Field<Type>(pf, boundaryFaceSet.quads),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
writeField
|
||||
(
|
||||
"nsided",
|
||||
Field<Type>(pf, boundaryFaceSet.polys),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
return true;
|
||||
@ -267,15 +266,11 @@ void writePatchField
|
||||
const Field<Type>& pf,
|
||||
const word& patchName,
|
||||
const ensightMesh& eMesh,
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const fileName& dataDir,
|
||||
const label timeIndex,
|
||||
const bool binary,
|
||||
Ostream& ensightCaseFile
|
||||
)
|
||||
{
|
||||
const Time& runTime = eMesh.mesh().time();
|
||||
|
||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const HashTable<ensightMesh::nFacePrimitives>&
|
||||
@ -295,53 +290,51 @@ void writePatchField
|
||||
ensightPatchI++;
|
||||
}
|
||||
|
||||
|
||||
word pfName = patchName + '.' + fieldName;
|
||||
|
||||
word timeFile = prepend + itoa(timeIndex);
|
||||
|
||||
ensightStream* ensightFilePtr = NULL;
|
||||
ensightStream* filePtr(nullptr);
|
||||
if (Pstream::master())
|
||||
{
|
||||
// TODO: verify that these are indeed valid ensight variable names
|
||||
const word varName = patchName + '.' + fieldName;
|
||||
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
||||
|
||||
// the data/ITER subdirectory must exist
|
||||
mkDir(dataDir/postFileName.path());
|
||||
|
||||
if (timeIndex == 0)
|
||||
{
|
||||
ensightCaseFile.setf(ios_base::left);
|
||||
const fileName dirName = dataDir.name()/ensightFile::mask();
|
||||
|
||||
ensightCaseFile.setf(ios_base::left);
|
||||
ensightCaseFile
|
||||
<< ensightPTraits<Type>::typeName
|
||||
<< " per element: 1 "
|
||||
<< setw(15) << pfName
|
||||
<< (' ' + prepend + "****." + pfName).c_str()
|
||||
<< ensightPTraits<Type>::typeName << " per "
|
||||
<< setw(20)
|
||||
<< "element:"
|
||||
<< " 1 "
|
||||
<< setw(15)
|
||||
<< varName.c_str() << ' '
|
||||
<< (dirName/varName).c_str()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
// set the filename of the ensight file
|
||||
fileName ensightFileName(timeFile + "." + pfName);
|
||||
|
||||
if (binary)
|
||||
if (eMesh.format() == IOstream::BINARY)
|
||||
{
|
||||
ensightFilePtr = new ensightBinaryStream
|
||||
filePtr = new ensightBinaryStream
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
runTime
|
||||
dataDir/postFileName
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
ensightFilePtr = new ensightAsciiStream
|
||||
filePtr = new ensightAsciiStream
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
runTime
|
||||
dataDir/postFileName
|
||||
);
|
||||
}
|
||||
|
||||
filePtr->write(ensightPTraits<Type>::typeName);
|
||||
}
|
||||
|
||||
ensightStream& ensightFile = *ensightFilePtr;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.write(ensightPTraits<Type>::typeName);
|
||||
}
|
||||
ensightStream& os = *filePtr;
|
||||
|
||||
if (patchi >= 0)
|
||||
{
|
||||
@ -352,7 +345,7 @@ void writePatchField
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -366,13 +359,13 @@ void writePatchField
|
||||
ensightPatchI,
|
||||
nullFaceSets,
|
||||
nPatchPrims.find(patchName)(),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
if (filePtr) // on master only
|
||||
{
|
||||
delete ensightFilePtr;
|
||||
delete filePtr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,19 +375,14 @@ void ensightField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||
const ensightMesh& eMesh,
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const fileName& dataDir,
|
||||
const label timeIndex,
|
||||
const bool binary,
|
||||
Ostream& ensightCaseFile
|
||||
)
|
||||
{
|
||||
Info<< "Converting field " << vf.name() << endl;
|
||||
|
||||
word timeFile = prepend + itoa(timeIndex);
|
||||
Info<< ' ' << vf.name();
|
||||
|
||||
const fvMesh& mesh = eMesh.mesh();
|
||||
const Time& runTime = mesh.time();
|
||||
|
||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||
@ -414,48 +402,48 @@ void ensightField
|
||||
const labelList& hexes = meshCellSets.hexes;
|
||||
const labelList& polys = meshCellSets.polys;
|
||||
|
||||
ensightStream* ensightFilePtr = NULL;
|
||||
ensightStream* filePtr(nullptr);
|
||||
if (Pstream::master())
|
||||
{
|
||||
// set the filename of the ensight file
|
||||
fileName ensightFileName(timeFile + "." + vf.name());
|
||||
const ensight::VarName varName(vf.name());
|
||||
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
||||
|
||||
if (binary)
|
||||
// the data/ITER subdirectory must exist
|
||||
mkDir(dataDir/postFileName.path());
|
||||
|
||||
if (timeIndex == 0)
|
||||
{
|
||||
ensightFilePtr = new ensightBinaryStream
|
||||
const fileName dirName = dataDir.name()/ensightFile::mask();
|
||||
|
||||
ensightCaseFile.setf(ios_base::left);
|
||||
ensightCaseFile
|
||||
<< ensightPTraits<Type>::typeName
|
||||
<< " per element: 1 "
|
||||
<< setw(15)
|
||||
<< varName.c_str() << ' '
|
||||
<< (dirName/varName).c_str()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
if (eMesh.format() == IOstream::BINARY)
|
||||
{
|
||||
filePtr = new ensightBinaryStream
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
runTime
|
||||
dataDir/postFileName
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
ensightFilePtr = new ensightAsciiStream
|
||||
filePtr = new ensightAsciiStream
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
runTime
|
||||
dataDir/postFileName
|
||||
);
|
||||
}
|
||||
|
||||
filePtr->write(ensightPTraits<Type>::typeName);
|
||||
}
|
||||
|
||||
ensightStream& ensightFile = *ensightFilePtr;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (timeIndex == 0)
|
||||
{
|
||||
ensightCaseFile.setf(ios_base::left);
|
||||
|
||||
ensightCaseFile
|
||||
<< ensightPTraits<Type>::typeName
|
||||
<< " per element: 1 "
|
||||
<< setw(15) << vf.name()
|
||||
<< (' ' + prepend + "****." + vf.name()).c_str()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
ensightFile.write(ensightPTraits<Type>::typeName);
|
||||
}
|
||||
ensightStream& os = *filePtr;
|
||||
|
||||
if (patchNames.empty())
|
||||
{
|
||||
@ -463,42 +451,42 @@ void ensightField
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.writePartHeader(1);
|
||||
os.writePartHeader(1);
|
||||
}
|
||||
|
||||
writeField
|
||||
(
|
||||
"hexa8",
|
||||
map(vf, hexes, wedges),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
writeField
|
||||
(
|
||||
"penta6",
|
||||
Field<Type>(vf, prisms),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
writeField
|
||||
(
|
||||
"pyramid5",
|
||||
Field<Type>(vf, pyrs),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
writeField
|
||||
(
|
||||
"tetra4",
|
||||
Field<Type>(vf, tets),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
writeField
|
||||
(
|
||||
"nfaced",
|
||||
Field<Type>(vf, polys),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
}
|
||||
|
||||
@ -521,7 +509,7 @@ void ensightField
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
ensightFile
|
||||
os
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -546,8 +534,7 @@ void ensightField
|
||||
|
||||
eMesh.barrier();
|
||||
|
||||
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
||||
|
||||
const label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
||||
const faceZone& fz = mesh.faceZones()[zoneID];
|
||||
|
||||
// Prepare data to write
|
||||
@ -595,7 +582,7 @@ void ensightField
|
||||
ensightPatchI,
|
||||
faceZoneFaceSets[zoneID],
|
||||
nFaceZonePrims.find(faceZoneName)(),
|
||||
ensightFile
|
||||
os
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -603,9 +590,10 @@ void ensightField
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Pstream::master())
|
||||
|
||||
if (filePtr) // on master only
|
||||
{
|
||||
delete ensightFilePtr;
|
||||
delete filePtr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -615,65 +603,63 @@ void ensightPointField
|
||||
(
|
||||
const GeometricField<Type, pointPatchField, pointMesh>& pf,
|
||||
const ensightMesh& eMesh,
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const fileName& dataDir,
|
||||
const label timeIndex,
|
||||
const bool binary,
|
||||
Ostream& ensightCaseFile
|
||||
)
|
||||
{
|
||||
Info<< "Converting field " << pf.name() << endl;
|
||||
|
||||
word timeFile = prepend + itoa(timeIndex);
|
||||
Info<< ' ' << pf.name();
|
||||
|
||||
const fvMesh& mesh = eMesh.mesh();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const wordHashSet& patchNames = eMesh.patchNames();
|
||||
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
|
||||
|
||||
|
||||
ensightStream* ensightFilePtr = NULL;
|
||||
ensightStream* filePtr(nullptr);
|
||||
if (Pstream::master())
|
||||
{
|
||||
// set the filename of the ensight file
|
||||
fileName ensightFileName(timeFile + "." + pf.name());
|
||||
const ensight::VarName varName(pf.name());
|
||||
const fileName postFileName = ensightFile::subDir(timeIndex)/varName;
|
||||
|
||||
if (binary)
|
||||
// the data/ITER subdirectory must exist
|
||||
mkDir(dataDir/postFileName.path());
|
||||
|
||||
if (timeIndex == 0)
|
||||
{
|
||||
ensightFilePtr = new ensightBinaryStream
|
||||
const fileName dirName = dataDir.name()/ensightFile::mask();
|
||||
|
||||
ensightCaseFile.setf(ios_base::left);
|
||||
ensightCaseFile
|
||||
<< ensightPTraits<Type>::typeName
|
||||
<< " per "
|
||||
<< setw(20)
|
||||
<< " node:"
|
||||
<< " 1 "
|
||||
<< setw(15)
|
||||
<< varName.c_str() << ' '
|
||||
<< (dirName/varName).c_str()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
if (eMesh.format() == IOstream::BINARY)
|
||||
{
|
||||
filePtr = new ensightBinaryStream
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
mesh.time()
|
||||
dataDir/postFileName
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
ensightFilePtr = new ensightAsciiStream
|
||||
filePtr = new ensightAsciiStream
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
mesh.time()
|
||||
dataDir/postFileName
|
||||
);
|
||||
}
|
||||
|
||||
filePtr->write(ensightPTraits<Type>::typeName);
|
||||
}
|
||||
|
||||
ensightStream& ensightFile = *ensightFilePtr;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (timeIndex == 0)
|
||||
{
|
||||
ensightCaseFile.setf(ios_base::left);
|
||||
|
||||
ensightCaseFile
|
||||
<< ensightPTraits<Type>::typeName
|
||||
<< " per node: 1 "
|
||||
<< setw(15) << pf.name()
|
||||
<< (' ' + prepend + "****." + pf.name()).c_str()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
ensightFile.write(ensightPTraits<Type>::typeName);
|
||||
}
|
||||
ensightStream& os = *filePtr;
|
||||
|
||||
if (eMesh.patchNames().empty())
|
||||
{
|
||||
@ -681,14 +667,14 @@ void ensightPointField
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.writePartHeader(1);
|
||||
os.writePartHeader(1);
|
||||
}
|
||||
|
||||
writeField
|
||||
(
|
||||
"coordinates",
|
||||
Field<Type>(pf.internalField(), eMesh.uniquePointMap()),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
}
|
||||
|
||||
@ -704,11 +690,8 @@ void ensightPointField
|
||||
if (patchNames.empty() || patchNames.found(patchName))
|
||||
{
|
||||
const fvPatch& p = mesh.boundary()[patchi];
|
||||
if
|
||||
(
|
||||
returnReduce(p.size(), sumOp<label>())
|
||||
> 0
|
||||
)
|
||||
|
||||
if (returnReduce(p.size(), sumOp<label>()) > 0)
|
||||
{
|
||||
// Renumber the patch points/faces into unique points
|
||||
labelList pointToGlobal;
|
||||
@ -724,14 +707,14 @@ void ensightPointField
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.writePartHeader(ensightPatchI);
|
||||
os.writePartHeader(ensightPatchI);
|
||||
}
|
||||
|
||||
writeField
|
||||
(
|
||||
"coordinates",
|
||||
Field<Type>(pf.internalField(), uniqueMeshPointLabels),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
ensightPatchI++;
|
||||
@ -748,8 +731,7 @@ void ensightPointField
|
||||
|
||||
eMesh.barrier();
|
||||
|
||||
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
||||
|
||||
const label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
||||
const faceZone& fz = mesh.faceZones()[zoneID];
|
||||
|
||||
if (returnReduce(fz().nPoints(), sumOp<label>()) > 0)
|
||||
@ -768,7 +750,7 @@ void ensightPointField
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.writePartHeader(ensightPatchI);
|
||||
os.writePartHeader(ensightPatchI);
|
||||
}
|
||||
|
||||
writeField
|
||||
@ -779,7 +761,7 @@ void ensightPointField
|
||||
pf.internalField(),
|
||||
uniqueMeshPointLabels
|
||||
),
|
||||
ensightFile
|
||||
os
|
||||
);
|
||||
|
||||
ensightPatchI++;
|
||||
@ -787,9 +769,9 @@ void ensightPointField
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
if (filePtr) // on master only
|
||||
{
|
||||
delete ensightFilePtr;
|
||||
delete filePtr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -799,10 +781,8 @@ void ensightField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||
const ensightMesh& eMesh,
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const fileName& dataDir,
|
||||
const label timeIndex,
|
||||
const bool binary,
|
||||
const bool nodeValues,
|
||||
Ostream& ensightCaseFile
|
||||
)
|
||||
@ -819,10 +799,8 @@ void ensightField
|
||||
(
|
||||
pfld,
|
||||
eMesh,
|
||||
postProcPath,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
ensightCaseFile
|
||||
);
|
||||
}
|
||||
@ -832,10 +810,8 @@ void ensightField
|
||||
(
|
||||
vf,
|
||||
eMesh,
|
||||
postProcPath,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
ensightCaseFile
|
||||
);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,10 +69,8 @@ void ensightField
|
||||
(
|
||||
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf,
|
||||
const Foam::ensightMesh& eMesh,
|
||||
const Foam::fileName& postProcPath,
|
||||
const Foam::word& prepend,
|
||||
const Foam::fileName& dataDir,
|
||||
const Foam::label timeIndex,
|
||||
const bool binary,
|
||||
const bool nodeValues,
|
||||
Foam::Ostream& ensightCaseFile
|
||||
);
|
||||
@ -85,8 +83,7 @@ void writePatchField
|
||||
const Foam::Field<Type>& pf,
|
||||
const Foam::word& patchName,
|
||||
const Foam::ensightMesh& eMesh,
|
||||
const Foam::fileName& postProcPath,
|
||||
const Foam::word& prepend,
|
||||
const Foam::fileName& dataDir,
|
||||
const Foam::label timeIndex,
|
||||
Foam::Ostream& ensightCaseFile
|
||||
);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,16 +32,21 @@ License
|
||||
#include "processorPolyPatch.H"
|
||||
#include "cellModeller.H"
|
||||
#include "IOmanip.H"
|
||||
#include "itoa.H"
|
||||
#include "globalIndex.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "stringListOps.H"
|
||||
|
||||
#include "ensightFile.H"
|
||||
#include "ensightBinaryStream.H"
|
||||
#include "ensightAsciiStream.H"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const char* Foam::ensightMesh::geometryName = "geometry";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::ensightMesh::correct()
|
||||
@ -403,7 +408,7 @@ Foam::ensightMesh::ensightMesh
|
||||
const bool faceZones,
|
||||
const wordReList& faceZonePatterns,
|
||||
|
||||
const bool binary
|
||||
const IOstream::streamFormat format
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
@ -412,7 +417,7 @@ Foam::ensightMesh::ensightMesh
|
||||
patchPatterns_(patchPatterns),
|
||||
faceZones_(faceZones),
|
||||
faceZonePatterns_(faceZonePatterns),
|
||||
binary_(binary),
|
||||
format_(format),
|
||||
meshCellSets_(mesh.nCells())
|
||||
{
|
||||
correct();
|
||||
@ -521,7 +526,7 @@ void Foam::ensightMesh::writePrims
|
||||
// Create a temp int array
|
||||
if (cellShapes.size())
|
||||
{
|
||||
if (ensightGeometryFile.ascii())
|
||||
if (format_ == IOstream::ASCII)
|
||||
{
|
||||
// Workaround for paraview issue : write one cell per line
|
||||
|
||||
@ -1018,63 +1023,55 @@ void Foam::ensightMesh::writeAllPoints
|
||||
|
||||
void Foam::ensightMesh::write
|
||||
(
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const fileName& dataDir,
|
||||
const label timeIndex,
|
||||
const bool meshMoving,
|
||||
Ostream& ensightCaseFile
|
||||
) const
|
||||
{
|
||||
const Time& runTime = mesh_.time();
|
||||
const cellShapeList& cellShapes = mesh_.cellShapes();
|
||||
|
||||
|
||||
word timeFile = prepend;
|
||||
|
||||
if (timeIndex == 0)
|
||||
{
|
||||
timeFile += "0000.";
|
||||
}
|
||||
else if (meshMoving)
|
||||
{
|
||||
timeFile += itoa(timeIndex) + '.';
|
||||
}
|
||||
|
||||
// set the filename of the ensight file
|
||||
fileName ensightGeometryFileName = timeFile + "mesh";
|
||||
|
||||
ensightStream* ensightGeometryFilePtr = NULL;
|
||||
ensightStream* filePtr(nullptr);
|
||||
if (Pstream::master())
|
||||
{
|
||||
if (binary_)
|
||||
// set the filename of the ensight file
|
||||
fileName geoFileName = dataDir.path()/ensightMesh::geometryName;
|
||||
|
||||
if (meshMoving)
|
||||
{
|
||||
ensightGeometryFilePtr = new ensightBinaryStream
|
||||
geoFileName =
|
||||
dataDir/ensightFile::subDir(timeIndex)/ensightMesh::geometryName;
|
||||
|
||||
mkDir(geoFileName.path());
|
||||
}
|
||||
|
||||
if (format_ == IOstream::BINARY)
|
||||
{
|
||||
filePtr = new ensightBinaryStream
|
||||
(
|
||||
postProcPath/ensightGeometryFileName,
|
||||
runTime
|
||||
geoFileName
|
||||
);
|
||||
ensightGeometryFilePtr->write("C binary");
|
||||
filePtr->write("C binary");
|
||||
}
|
||||
else
|
||||
{
|
||||
ensightGeometryFilePtr = new ensightAsciiStream
|
||||
filePtr = new ensightAsciiStream
|
||||
(
|
||||
postProcPath/ensightGeometryFileName,
|
||||
runTime
|
||||
geoFileName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ensightStream& ensightGeometryFile = *ensightGeometryFilePtr;
|
||||
ensightStream& os = *filePtr;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
string desc = string("written by OpenFOAM-") + Foam::FOAMversion;
|
||||
|
||||
ensightGeometryFile.write("EnSight Geometry File");
|
||||
ensightGeometryFile.write(desc.c_str());
|
||||
ensightGeometryFile.write("node id assign");
|
||||
ensightGeometryFile.write("element id assign");
|
||||
os.write("EnSight Geometry File");
|
||||
os.write(desc.c_str());
|
||||
os.write("node id assign");
|
||||
os.write("element id assign");
|
||||
}
|
||||
|
||||
if (patchNames_.empty())
|
||||
@ -1089,7 +1086,7 @@ void Foam::ensightMesh::write
|
||||
"internalMesh",
|
||||
uniquePoints,
|
||||
nPoints,
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllPrims
|
||||
@ -1103,7 +1100,7 @@ void Foam::ensightMesh::write
|
||||
meshCellSets_.wedges,
|
||||
pointToGlobal_
|
||||
),
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllPrims
|
||||
@ -1111,7 +1108,7 @@ void Foam::ensightMesh::write
|
||||
"penta6",
|
||||
meshCellSets_.nPrisms,
|
||||
map(cellShapes, meshCellSets_.prisms, pointToGlobal_),
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllPrims
|
||||
@ -1119,7 +1116,7 @@ void Foam::ensightMesh::write
|
||||
"pyramid5",
|
||||
meshCellSets_.nPyrs,
|
||||
map(cellShapes, meshCellSets_.pyrs, pointToGlobal_),
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllPrims
|
||||
@ -1127,13 +1124,13 @@ void Foam::ensightMesh::write
|
||||
"tetra4",
|
||||
meshCellSets_.nTets,
|
||||
map(cellShapes, meshCellSets_.tets, pointToGlobal_),
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllPolys
|
||||
(
|
||||
pointToGlobal_,
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
}
|
||||
|
||||
@ -1182,7 +1179,7 @@ void Foam::ensightMesh::write
|
||||
patchName,
|
||||
uniquePoints,
|
||||
globalPointsPtr().size(),
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllFacePrims
|
||||
@ -1191,7 +1188,7 @@ void Foam::ensightMesh::write
|
||||
tris,
|
||||
nfp.nTris,
|
||||
patchFaces,
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllFacePrims
|
||||
@ -1200,7 +1197,7 @@ void Foam::ensightMesh::write
|
||||
quads,
|
||||
nfp.nQuads,
|
||||
patchFaces,
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllNSided
|
||||
@ -1208,7 +1205,7 @@ void Foam::ensightMesh::write
|
||||
polys,
|
||||
nfp.nPolys,
|
||||
patchFaces,
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1287,7 +1284,7 @@ void Foam::ensightMesh::write
|
||||
faceZoneName,
|
||||
uniquePoints,
|
||||
globalPointsPtr().size(),
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllFacePrims
|
||||
@ -1296,7 +1293,7 @@ void Foam::ensightMesh::write
|
||||
tris,
|
||||
nfp.nTris,
|
||||
faceZoneMasterFaces,
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllFacePrims
|
||||
@ -1305,7 +1302,7 @@ void Foam::ensightMesh::write
|
||||
quads,
|
||||
nfp.nQuads,
|
||||
faceZoneMasterFaces,
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
|
||||
writeAllNSided
|
||||
@ -1313,14 +1310,14 @@ void Foam::ensightMesh::write
|
||||
polys,
|
||||
nfp.nPolys,
|
||||
faceZoneMasterFaces,
|
||||
ensightGeometryFile
|
||||
os
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
if (filePtr) // only on master
|
||||
{
|
||||
delete ensightGeometryFilePtr;
|
||||
delete filePtr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -63,6 +63,11 @@ class ensightStream;
|
||||
class ensightMesh
|
||||
{
|
||||
public:
|
||||
|
||||
//- The name for geometry files
|
||||
static const char* geometryName;
|
||||
|
||||
//- Helper class for managing face primitives
|
||||
class nFacePrimitives
|
||||
{
|
||||
public:
|
||||
@ -97,8 +102,8 @@ private:
|
||||
const bool faceZones_;
|
||||
const wordReList faceZonePatterns_;
|
||||
|
||||
//- Set binary file output
|
||||
const bool binary_;
|
||||
//- Ascii/Binary file output
|
||||
const IOstream::streamFormat format_;
|
||||
|
||||
//- The ensight part id for the first patch
|
||||
label patchPartOffset_;
|
||||
@ -140,10 +145,10 @@ private:
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
ensightMesh(const ensightMesh&);
|
||||
ensightMesh(const ensightMesh&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ensightMesh&);
|
||||
void operator=(const ensightMesh&) = delete;
|
||||
|
||||
void writePoints
|
||||
(
|
||||
@ -267,7 +272,7 @@ public:
|
||||
const wordReList& patchPatterns,
|
||||
const bool faceZones,
|
||||
const wordReList& faceZonePatterns,
|
||||
const bool binary
|
||||
const IOstream::streamFormat format = IOstream::BINARY
|
||||
);
|
||||
|
||||
|
||||
@ -284,6 +289,11 @@ public:
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
IOstream::streamFormat format() const
|
||||
{
|
||||
return format_;
|
||||
}
|
||||
|
||||
const cellSets& meshCellSets() const
|
||||
{
|
||||
return meshCellSets_;
|
||||
@ -352,8 +362,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Other
|
||||
|
||||
//- Update for new mesh
|
||||
@ -371,8 +379,7 @@ public:
|
||||
|
||||
void write
|
||||
(
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const fileName& ensightDir,
|
||||
const label timeIndex,
|
||||
const bool meshMoving,
|
||||
Ostream& ensightCaseFile
|
||||
|
||||
@ -1,103 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightParticlePositions.H"
|
||||
#include "fvMesh.H"
|
||||
#include "passiveParticle.H"
|
||||
#include "Cloud.H"
|
||||
#include "OFstream.H"
|
||||
#include "IOmanip.H"
|
||||
#include "itoa.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ensightParticlePositions
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fileName& postProcPath,
|
||||
const word& timeFile,
|
||||
const word& cloudName,
|
||||
const bool dataExists
|
||||
)
|
||||
{
|
||||
if (dataExists)
|
||||
{
|
||||
Info<< "Converting cloud " << cloudName << " positions" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Creating empty cloud " << cloudName << " positions" << endl;
|
||||
}
|
||||
|
||||
const Time& runTime = mesh.time();
|
||||
|
||||
fileName ensightFileName(timeFile + "." + cloudName);
|
||||
OFstream ensightFile
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
runTime.writeFormat(),
|
||||
runTime.writeVersion(),
|
||||
runTime.writeCompression()
|
||||
);
|
||||
|
||||
// Output header
|
||||
ensightFile
|
||||
<< cloudName.c_str() << nl
|
||||
<< "particle coordinates" << nl;
|
||||
|
||||
if (dataExists)
|
||||
{
|
||||
Cloud<passiveParticle> parcels(mesh, cloudName, false);
|
||||
|
||||
// Set Format
|
||||
ensightFile.setf(ios_base::scientific, ios_base::floatfield);
|
||||
ensightFile.precision(5);
|
||||
|
||||
ensightFile<< setw(8) << parcels.size() << nl;
|
||||
|
||||
label nParcels = 0;
|
||||
|
||||
// Output positions
|
||||
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
|
||||
{
|
||||
const vector& p = elmnt().position();
|
||||
|
||||
ensightFile
|
||||
<< setw(8) << ++nParcels
|
||||
<< setw(12) << p.x() << setw(12) << p.y() << setw(12) << p.z()
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label nParcels = 0;
|
||||
ensightFile<< setw(8) << nParcels << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,10 +57,10 @@ class ensightStream
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
ensightStream(const ensightStream&);
|
||||
ensightStream(const ensightStream&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ensightStream&);
|
||||
void operator=(const ensightStream&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -86,8 +86,6 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
virtual bool ascii() const = 0;
|
||||
|
||||
virtual void write(const char*) = 0;
|
||||
|
||||
virtual void write(const int) = 0;
|
||||
@ -98,8 +96,6 @@ public:
|
||||
|
||||
virtual void writePartHeader(const label) = 0;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
// check all time directories for the following:
|
||||
|
||||
// The fields for each cloud:
|
||||
HashTable<HashTable<word>> cloudFields;
|
||||
|
||||
// Identify if lagrangian data exist at any time step.
|
||||
if (timeDirs.size() && !noLagrangian)
|
||||
{
|
||||
const fileName& baseDir = mesh.time().path();
|
||||
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||
|
||||
Info<< "Searching for lagrangian ... " << flush;
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
const word& timeName = timeDirs[timeI].name();
|
||||
|
||||
// DO NOT USE -->> runTime.setTime(timeDirs[timeI], timeI); <<--
|
||||
// It incurs a large overhead when done so frequently.
|
||||
|
||||
fileNameList cloudDirs = readDir
|
||||
(
|
||||
baseDir/timeName/cloudPrefix,
|
||||
fileName::DIRECTORY
|
||||
);
|
||||
|
||||
forAll(cloudDirs, cloudI)
|
||||
{
|
||||
const word& cloudName = cloudDirs[cloudI];
|
||||
|
||||
IOobjectList cloudObjs
|
||||
(
|
||||
mesh,
|
||||
timeName,
|
||||
cloudPrefix/cloudName
|
||||
);
|
||||
|
||||
// clouds always require "positions"
|
||||
if (cloudObjs.found("positions"))
|
||||
{
|
||||
HashTable<HashTable<word>>::iterator cloudIter =
|
||||
cloudFields.find(cloudName);
|
||||
|
||||
if (cloudIter == cloudFields.end())
|
||||
{
|
||||
// A newly discovered cloud
|
||||
cloudFields.insert(cloudName, HashTable<word>());
|
||||
cloudIter = cloudFields.find(cloudName);
|
||||
}
|
||||
|
||||
forAllConstIter(IOobjectList, cloudObjs, fieldIter)
|
||||
{
|
||||
const IOobject obj = *fieldIter();
|
||||
|
||||
// Add field and field type
|
||||
cloudIter().insert
|
||||
(
|
||||
obj.name(),
|
||||
obj.headerClassName()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// prune out "positions" again since it gets treated specially
|
||||
forAllIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
{
|
||||
cloudIter().erase("positions");
|
||||
}
|
||||
|
||||
if (cloudFields.empty())
|
||||
{
|
||||
Info<< "none detected." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sorted list of cloud names
|
||||
const wordList cloudNames(cloudFields.sortedToc());
|
||||
|
||||
if (cloudNames.size())
|
||||
{
|
||||
// complete the echo information
|
||||
Info<< "(";
|
||||
forAll(cloudNames, cloudNo)
|
||||
{
|
||||
Info<< ' ' << cloudNames[cloudNo];
|
||||
}
|
||||
Info<< " ) " << endl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,24 +34,33 @@ Description
|
||||
|
||||
Usage
|
||||
- foamToEnsight [OPTION] \n
|
||||
Translates OpenFOAM data to Ensight format
|
||||
Translates OpenFOAM data to EnSight format
|
||||
|
||||
\param -ascii \n
|
||||
Write Ensight data in ASCII format instead of "C Binary"
|
||||
|
||||
\param -patches patchList \n
|
||||
Specify particular patches to write.
|
||||
Specifying an empty list suppresses writing the internalMesh.
|
||||
\param -noZero \n
|
||||
Exclude the often incomplete initial conditions.
|
||||
|
||||
\param -noLagrangian \n
|
||||
Suppress writing lagrangian positions and fields.
|
||||
|
||||
\param -noPatches \n
|
||||
Suppress writing any patches.
|
||||
|
||||
\param -patches patchList \n
|
||||
Specify particular patches to write.
|
||||
Specifying an empty list suppresses writing the internalMesh.
|
||||
|
||||
\param -faceZones zoneList \n
|
||||
Specify faceZones to write, with wildcards
|
||||
|
||||
\param -cellZone zoneName \n
|
||||
Specify single cellZone to write (not lagrangian)
|
||||
|
||||
\param -width \<n\>\n
|
||||
Width of EnSight data subdir (default: 8)
|
||||
|
||||
Note
|
||||
Parallel support for cloud data is not supported
|
||||
- writes to \a EnSight directory to avoid collisions with foamToEnsightParts
|
||||
@ -70,14 +79,12 @@ Note
|
||||
#include "scalarIOField.H"
|
||||
#include "tensorIOField.H"
|
||||
|
||||
#include "ensightFile.H"
|
||||
#include "ensightMesh.H"
|
||||
#include "ensightField.H"
|
||||
|
||||
#include "ensightParticlePositions.H"
|
||||
#include "ensightCloudField.H"
|
||||
#include "ensightCloud.H"
|
||||
|
||||
#include "fvc.H"
|
||||
|
||||
#include "cellSet.H"
|
||||
#include "fvMeshSubset.H"
|
||||
|
||||
@ -122,6 +129,11 @@ int main(int argc, char *argv[])
|
||||
"write values in nodes"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noLagrangian",
|
||||
"suppress writing lagrangian positions and fields"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noPatches",
|
||||
"suppress writing any patches"
|
||||
@ -151,32 +163,21 @@ int main(int argc, char *argv[])
|
||||
"word",
|
||||
"specify cellZone to write"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"name",
|
||||
"subdir",
|
||||
"define sub-directory name to use for ensight data "
|
||||
"(default: 'EnSight')"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"width",
|
||||
"n",
|
||||
"width of ensight data subdir"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
// Check options
|
||||
const bool binary = !args.optionFound("ascii");
|
||||
const bool nodeValues = args.optionFound("nodeValues");
|
||||
|
||||
cpuTime timer;
|
||||
memInfo mem;
|
||||
Info<< "Initial memory "
|
||||
<< mem.update().size() << " kB" << endl;
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
instantList Times = timeSelector::select0(runTime, args);
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
// Mesh instance (region0 gets filtered out)
|
||||
fileName regionPrefix = "";
|
||||
|
||||
if (regionName != polyMesh::defaultRegion)
|
||||
{
|
||||
regionPrefix = regionName;
|
||||
}
|
||||
|
||||
// the volume field types that we handle
|
||||
const label nVolFieldTypes = 10;
|
||||
const word volFieldTypes[] =
|
||||
{
|
||||
@ -193,38 +194,90 @@ int main(int argc, char *argv[])
|
||||
volTensorField::DimensionedInternalField::typeName
|
||||
};
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
// default to binary output, unless otherwise specified
|
||||
const IOstream::streamFormat format =
|
||||
(
|
||||
args.optionFound("ascii")
|
||||
? IOstream::ASCII
|
||||
: IOstream::BINARY
|
||||
);
|
||||
|
||||
const bool nodeValues = args.optionFound("nodeValues");
|
||||
|
||||
cpuTime timer;
|
||||
memInfo mem;
|
||||
Info<< "Initial memory "
|
||||
<< mem.update().size() << " kB" << endl;
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
// adjust output width
|
||||
if (args.optionFound("width"))
|
||||
{
|
||||
ensightFile::subDirWidth(args.optionRead<label>("width"));
|
||||
}
|
||||
|
||||
// define sub-directory name to use for EnSight data
|
||||
fileName ensightDir = "EnSight";
|
||||
args.optionReadIfPresent("name", ensightDir);
|
||||
|
||||
// Path to EnSight directory at case level only
|
||||
// - For parallel cases, data only written from master
|
||||
fileName ensightDir = args.rootPath()/args.globalCaseName()/"EnSight";
|
||||
if (!ensightDir.isAbsolute())
|
||||
{
|
||||
ensightDir = args.rootPath()/args.globalCaseName()/ensightDir;
|
||||
}
|
||||
|
||||
const fileName dataDir = ensightDir/"data";
|
||||
const fileName dataMask = dataDir.name()/ensightFile::mask();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// EnSight and EnSight/data directories must exist
|
||||
// - remove old data for a clean conversion of everything
|
||||
if (isDir(ensightDir))
|
||||
{
|
||||
rmDir(ensightDir);
|
||||
}
|
||||
|
||||
mkDir(ensightDir);
|
||||
mkDir(dataDir);
|
||||
}
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
// Mesh instance (region0 gets filtered out)
|
||||
fileName regionPrefix;
|
||||
if (regionName != polyMesh::defaultRegion)
|
||||
{
|
||||
regionPrefix = regionName;
|
||||
}
|
||||
|
||||
// Start of case file header output
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
const word prepend = args.globalCaseName() + '.';
|
||||
|
||||
OFstream *ensightCaseFilePtr = NULL;
|
||||
OFstream *ensightCaseFilePtr(nullptr);
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName caseFileName = prepend + "case";
|
||||
Info<< nl << "write case: " << caseFileName.c_str() << endl;
|
||||
fileName caseFileName = args.globalCaseName() + ".case";
|
||||
|
||||
// the case file is always ASCII
|
||||
Info<< "Converting " << timeDirs.size() << " time steps" << nl
|
||||
<< "Ensight case: " << caseFileName.c_str() << endl;
|
||||
|
||||
// The case file is always ASCII
|
||||
ensightCaseFilePtr = new OFstream
|
||||
(
|
||||
ensightDir/caseFileName,
|
||||
IOstream::ASCII
|
||||
);
|
||||
|
||||
ensightCaseFilePtr->setf(ios_base::left);
|
||||
ensightCaseFilePtr->setf(ios_base::scientific, ios_base::floatfield);
|
||||
ensightCaseFilePtr->precision(5);
|
||||
|
||||
*ensightCaseFilePtr
|
||||
<< "FORMAT" << nl
|
||||
<< "type: ensight gold" << nl << nl;
|
||||
@ -253,6 +306,8 @@ int main(int argc, char *argv[])
|
||||
fieldPatterns = wordReList(args.optionLookup("fields")());
|
||||
}
|
||||
|
||||
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||
|
||||
word cellZoneName;
|
||||
const bool doCellZone = args.optionReadIfPresent("cellZone", cellZoneName);
|
||||
|
||||
@ -280,133 +335,84 @@ int main(int argc, char *argv[])
|
||||
patchPatterns,
|
||||
selectedZones,
|
||||
zonePatterns,
|
||||
binary
|
||||
format
|
||||
);
|
||||
|
||||
// Set Time to the last time before looking for the lagrangian objects
|
||||
runTime.setTime(Times.last(), Times.size()-1);
|
||||
runTime.setTime(timeDirs.last(), timeDirs.size()-1);
|
||||
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
#include "checkMeshMoving.H"
|
||||
#include "findCloudFields.H"
|
||||
|
||||
if (meshMoving)
|
||||
{
|
||||
Info<< "Detected a moving mesh (multiple polyMesh/points files)."
|
||||
<< " Writing meshes for every timestep." << endl;
|
||||
}
|
||||
|
||||
|
||||
wordHashSet allCloudNames;
|
||||
if (Pstream::master())
|
||||
{
|
||||
word geomFileName = prepend + "0000";
|
||||
// test the pre-check variable if there is a moving mesh
|
||||
// time-set for geometries
|
||||
// TODO: split off into separate time-set,
|
||||
// but need to verify ensight spec
|
||||
|
||||
// test pre check variable if there is a moving mesh
|
||||
if (meshMoving)
|
||||
{
|
||||
geomFileName = prepend + "****";
|
||||
ensightCaseFile
|
||||
<< "GEOMETRY" << nl
|
||||
<< setw(16) << "model: 1"
|
||||
<< (dataMask/ensightMesh::geometryName).c_str() << nl;
|
||||
}
|
||||
|
||||
ensightCaseFile
|
||||
<< "GEOMETRY" << nl
|
||||
<< "model: 1 "
|
||||
<< (geomFileName + ".mesh").c_str() << nl;
|
||||
}
|
||||
|
||||
// Identify if lagrangian data exists at each time, and add clouds
|
||||
// to the 'allCloudNames' hash set
|
||||
forAll(Times, timeI)
|
||||
{
|
||||
runTime.setTime(Times[timeI], timeI);
|
||||
|
||||
fileNameList cloudDirs = readDir
|
||||
(
|
||||
runTime.timePath()/regionPrefix/cloud::prefix,
|
||||
fileName::DIRECTORY
|
||||
);
|
||||
|
||||
forAll(cloudDirs, cloudI)
|
||||
{
|
||||
IOobjectList cloudObjs
|
||||
(
|
||||
mesh,
|
||||
runTime.timeName(),
|
||||
cloud::prefix/cloudDirs[cloudI]
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = cloudObjs.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
{
|
||||
allCloudNames.insert(cloudDirs[cloudI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashTable<HashTable<word>> allCloudFields;
|
||||
forAllConstIter(wordHashSet, allCloudNames, cloudIter)
|
||||
{
|
||||
// Add the name of the cloud(s) to the case file header
|
||||
if (Pstream::master())
|
||||
else
|
||||
{
|
||||
ensightCaseFile
|
||||
<< (
|
||||
"measured: 1 "
|
||||
+ prepend
|
||||
+ "****."
|
||||
+ cloudIter.key()
|
||||
).c_str()
|
||||
<< nl;
|
||||
<< "GEOMETRY" << nl
|
||||
<< setw(16) << "model:"
|
||||
<< ensightMesh::geometryName << nl;
|
||||
}
|
||||
|
||||
// Create a new hash table for each cloud
|
||||
allCloudFields.insert(cloudIter.key(), HashTable<word>());
|
||||
|
||||
// Identify the new cloud in the hash table
|
||||
HashTable<HashTable<word>>::iterator newCloudIter =
|
||||
allCloudFields.find(cloudIter.key());
|
||||
|
||||
// Loop over all times to build list of fields and field types
|
||||
// for each cloud
|
||||
forAll(Times, timeI)
|
||||
// Add the name of the cloud(s) to the case file header
|
||||
forAll(cloudNames, cloudNo)
|
||||
{
|
||||
runTime.setTime(Times[timeI], timeI);
|
||||
const word& cloudName = cloudNames[cloudNo];
|
||||
|
||||
IOobjectList cloudObjs
|
||||
(
|
||||
mesh,
|
||||
runTime.timeName(),
|
||||
cloud::prefix/cloudIter.key()
|
||||
);
|
||||
|
||||
forAllConstIter(IOobjectList, cloudObjs, fieldIter)
|
||||
{
|
||||
const IOobject obj = *fieldIter();
|
||||
|
||||
if (obj.name() != "positions")
|
||||
{
|
||||
// Add field and field type
|
||||
newCloudIter().insert
|
||||
(
|
||||
obj.name(),
|
||||
obj.headerClassName()
|
||||
);
|
||||
}
|
||||
}
|
||||
ensightCaseFile
|
||||
<< setw(16) << "measured: 1"
|
||||
<< fileName
|
||||
(
|
||||
dataMask/cloud::prefix/cloudName/"positions"
|
||||
).c_str() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Startup in "
|
||||
<< timer.cpuTimeIncrement() << " s, "
|
||||
<< mem.update().size() << " kB" << nl << endl;
|
||||
|
||||
// ignore special fields (_0 fields),
|
||||
// ignore fields we don't handle,
|
||||
// ignore fields that are not available for all time-steps
|
||||
HashTable<bool> fieldsToUse;
|
||||
|
||||
label nTimeSteps = 0;
|
||||
forAll(Times, timeIndex)
|
||||
forAll(timeDirs, timeIndex)
|
||||
{
|
||||
nTimeSteps++;
|
||||
runTime.setTime(Times[timeIndex], timeIndex);
|
||||
++nTimeSteps;
|
||||
runTime.setTime(timeDirs[timeIndex], timeIndex);
|
||||
|
||||
word timeName = itoa(timeIndex);
|
||||
word timeFile = prepend + timeName;
|
||||
Info<< "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||
|
||||
Info<< "Translating time = " << runTime.timeName() << nl;
|
||||
if (Pstream::master())
|
||||
{
|
||||
// the data/ITER subdirectory must exist
|
||||
// Note that data/ITER is indeed a valid ensight::FileName
|
||||
const fileName subDir = ensightFile::subDir(timeIndex);
|
||||
mkDir(dataDir/subDir);
|
||||
|
||||
// place a timestamp in the directory for future reference
|
||||
OFstream timeStamp(dataDir/subDir/"time");
|
||||
timeStamp
|
||||
<< "# timestep time" << nl
|
||||
<< subDir.c_str() << " " << runTime.timeName() << nl;
|
||||
}
|
||||
|
||||
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
||||
if (timeIndex != 0 && meshSubsetter.hasSubMesh())
|
||||
@ -420,7 +426,6 @@ int main(int argc, char *argv[])
|
||||
meshSubsetter.setLargeCellSubset(c0, 0);
|
||||
}
|
||||
|
||||
|
||||
if (meshState != polyMesh::UNCHANGED)
|
||||
{
|
||||
eMesh.correct();
|
||||
@ -430,8 +435,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
eMesh.write
|
||||
(
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
meshMoving,
|
||||
ensightCaseFile
|
||||
@ -450,8 +454,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Cell field data output
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
Info<< "Write volume field (";
|
||||
|
||||
for (label i=0; i<nVolFieldTypes; i++)
|
||||
for (label i=0; i<nVolFieldTypes; ++i)
|
||||
{
|
||||
wordList fieldNames = objects.names(volFieldTypes[i]);
|
||||
|
||||
@ -470,7 +475,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "checkData.H"
|
||||
|
||||
if (!variableGood)
|
||||
if (!fieldsToUse[fieldName])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -491,10 +496,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -506,10 +509,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -521,10 +522,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -536,10 +535,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -551,10 +548,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField(meshSubsetter, vf),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -575,10 +570,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField<scalar>(meshSubsetter, df),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -598,10 +591,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField<vector>(meshSubsetter, df),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -621,10 +612,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField<sphericalTensor>(meshSubsetter, df),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -644,10 +633,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField<symmTensor>(meshSubsetter, df),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
@ -667,24 +654,29 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
volField<tensor>(meshSubsetter, df),
|
||||
eMesh,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
binary,
|
||||
nodeValues,
|
||||
ensightCaseFile
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do not currently handle this type - blacklist for the future.
|
||||
fieldsToUse.set(fieldName, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Info<< " )" << nl;
|
||||
|
||||
|
||||
// Cloud field data output
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
forAllConstIter(HashTable<HashTable<word>>, allCloudFields, cloudIter)
|
||||
forAll(cloudNames, cloudNo)
|
||||
{
|
||||
const word& cloudName = cloudIter.key();
|
||||
const word& cloudName = cloudNames[cloudNo];
|
||||
const HashTable<word>& theseCloudFields = cloudFields[cloudName];
|
||||
|
||||
fileNameList currentCloudDirs = readDir
|
||||
(
|
||||
@ -692,17 +684,22 @@ int main(int argc, char *argv[])
|
||||
fileName::DIRECTORY
|
||||
);
|
||||
|
||||
Info<< "Write " << cloudName << " (";
|
||||
|
||||
bool cloudExists = inFileNameList(currentCloudDirs, cloudName);
|
||||
reduce(cloudExists, orOp<bool>());
|
||||
|
||||
ensightParticlePositions
|
||||
(
|
||||
mesh,
|
||||
ensightDir,
|
||||
timeFile,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
cloudName,
|
||||
cloudExists
|
||||
cloudExists,
|
||||
format
|
||||
);
|
||||
|
||||
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
||||
forAllConstIter(HashTable<word>, theseCloudFields, fieldIter)
|
||||
{
|
||||
const word& fieldName = fieldIter.key();
|
||||
const word& fieldType = fieldIter();
|
||||
@ -720,17 +717,20 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
false
|
||||
);
|
||||
reduce(fieldExists, orOp<bool>());
|
||||
|
||||
if (fieldType == scalarIOField::typeName)
|
||||
{
|
||||
ensightCloudField<scalar>
|
||||
(
|
||||
fieldObject,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
cloudName,
|
||||
cloudNo,
|
||||
ensightCaseFile,
|
||||
fieldExists
|
||||
fieldExists,
|
||||
format
|
||||
);
|
||||
}
|
||||
else if (fieldType == vectorIOField::typeName)
|
||||
@ -738,37 +738,34 @@ int main(int argc, char *argv[])
|
||||
ensightCloudField<vector>
|
||||
(
|
||||
fieldObject,
|
||||
ensightDir,
|
||||
prepend,
|
||||
dataDir,
|
||||
timeIndex,
|
||||
cloudName,
|
||||
cloudNo,
|
||||
ensightCaseFile,
|
||||
fieldExists
|
||||
fieldExists,
|
||||
format
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Unable to convert field type " << fieldType
|
||||
<< " for field " << fieldName << endl;
|
||||
}
|
||||
}
|
||||
Info<< " )" << nl;
|
||||
}
|
||||
|
||||
Info<< "Wrote in "
|
||||
<< timer.cpuTimeIncrement() << " s, "
|
||||
<< mem.update().size() << " kB" << endl;
|
||||
<< mem.update().size() << " kB" << nl << nl;
|
||||
}
|
||||
|
||||
#include "ensightCaseTail.H"
|
||||
|
||||
if (Pstream::master())
|
||||
if (ensightCaseFilePtr) // on master only
|
||||
{
|
||||
delete ensightCaseFilePtr;
|
||||
}
|
||||
|
||||
Info<< "\nEnd: "
|
||||
Info<< "End: "
|
||||
<< timer.elapsedCpuTime() << " s, "
|
||||
<< mem.update().peak() << " kB (peak)\n" << endl;
|
||||
<< mem.update().peak() << " kB (peak)" << nl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2,18 +2,47 @@
|
||||
// - could restrict to the selected times
|
||||
|
||||
bool hasMovingMesh = false;
|
||||
if (timeDirs.size() > 1)
|
||||
|
||||
if (timeDirs.size() > 1 && Pstream::master())
|
||||
{
|
||||
hasMovingMesh = true;
|
||||
for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i)
|
||||
// We already loaded a mesh (usually from constant).
|
||||
// See if any other "polyMesh/points" files exist too.
|
||||
|
||||
const fileName& baseDir = mesh.time().path();
|
||||
|
||||
Info<< "Search for moving mesh ... " << flush;
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
hasMovingMesh = IOobject
|
||||
hasMovingMesh =
|
||||
(
|
||||
"points",
|
||||
timeDirs[i].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).typeHeaderOk<pointIOField>(true);
|
||||
isDir(baseDir/timeDirs[timeI].name()/polyMesh::meshSubDir)
|
||||
&& IOobject
|
||||
(
|
||||
"points",
|
||||
timeDirs[timeI].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // no register
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
);
|
||||
|
||||
if (hasMovingMesh)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasMovingMesh)
|
||||
{
|
||||
Info<< "found." << nl
|
||||
<< " Writing meshes for every timestep." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "none detected." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(hasMovingMesh, orOp<bool>());
|
||||
|
||||
@ -58,35 +58,36 @@ forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
||||
|
||||
if (fieldType == volScalarField::typeName)
|
||||
{
|
||||
ensightType = "scalar";
|
||||
ensightType = ensightPTraits<scalar>::typeName;
|
||||
}
|
||||
else if (fieldType == volVectorField::typeName)
|
||||
{
|
||||
ensightType = "vector";
|
||||
ensightType = ensightPTraits<vector>::typeName;
|
||||
}
|
||||
else if (fieldType == volSphericalTensorField::typeName)
|
||||
{
|
||||
ensightType = "tensor symm";
|
||||
ensightType = ensightPTraits<sphericalTensor>::typeName;
|
||||
}
|
||||
else if (fieldType == volSymmTensorField::typeName)
|
||||
{
|
||||
ensightType = "tensor symm";
|
||||
ensightType = ensightPTraits<symmTensor>::typeName;
|
||||
}
|
||||
else if (fieldType == volTensorField::typeName)
|
||||
{
|
||||
ensightType = "tensor asym";
|
||||
ensightType = ensightPTraits<tensor>::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ensightType.size())
|
||||
{
|
||||
ensightCaseEntry
|
||||
(
|
||||
caseFile,
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask
|
||||
);
|
||||
}
|
||||
ensightCaseEntry
|
||||
(
|
||||
caseFile,
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -104,30 +105,31 @@ forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
|
||||
if (fieldType == scalarIOField::typeName)
|
||||
{
|
||||
ensightType = "scalar";
|
||||
ensightType = ensightPTraits<scalar>::typeName;
|
||||
}
|
||||
else if (fieldType == vectorIOField::typeName)
|
||||
{
|
||||
ensightType = "vector";
|
||||
ensightType = ensightPTraits<vector>::typeName;
|
||||
}
|
||||
else if (fieldType == tensorIOField::typeName)
|
||||
{
|
||||
ensightType = "tensor";
|
||||
ensightType = ensightPTraits<tensor>::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ensightType.size())
|
||||
{
|
||||
ensightCaseEntry
|
||||
(
|
||||
caseFile,
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask,
|
||||
cloud::prefix/cloudName,
|
||||
cloudNo,
|
||||
2
|
||||
);
|
||||
}
|
||||
ensightCaseEntry
|
||||
(
|
||||
caseFile,
|
||||
ensightType,
|
||||
fieldName,
|
||||
dataMask,
|
||||
cloud::prefix/cloudName,
|
||||
cloudNo,
|
||||
2
|
||||
);
|
||||
}
|
||||
cloudNo++;
|
||||
}
|
||||
@ -162,7 +164,7 @@ if (fieldTimesUsed.size())
|
||||
count = 0;
|
||||
forAll(fieldTimesUsed, i)
|
||||
{
|
||||
const label& index = fieldTimesUsed[i];
|
||||
const label index = fieldTimesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
@ -203,7 +205,7 @@ if (geometryTimesUsed.size())
|
||||
count = 0;
|
||||
forAll(geometryTimesUsed, i)
|
||||
{
|
||||
const label& index = geometryTimesUsed[i];
|
||||
const label index = geometryTimesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
@ -249,7 +251,7 @@ forAllConstIter(HashTable<DynamicList<label>>, cloudTimesUsed, cloudIter)
|
||||
count = 0;
|
||||
forAll(timesUsed, i)
|
||||
{
|
||||
const label& index = timesUsed[i];
|
||||
const label index = timesUsed[i];
|
||||
caseFile
|
||||
<< " " << setw(12) << timeIndices[index] + timeCorrection;
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightOutputFunctions.H"
|
||||
#include "ensightPTraits.H"
|
||||
|
||||
#include "passiveParticle.H"
|
||||
#include "IOField.H"
|
||||
@ -171,11 +172,8 @@ void Foam::ensightLagrangianField
|
||||
// when writing positions
|
||||
|
||||
ensightFile os(dataDir, postFileName, format);
|
||||
os.write
|
||||
(
|
||||
// description
|
||||
string(postFileName + " with " + pTraits<Type>::typeName + " values")
|
||||
);
|
||||
// description
|
||||
os.write(string(postFileName + " <" + pTraits<Type>::typeName + ">"));
|
||||
os.newline();
|
||||
|
||||
IOField<Type> field(fieldObject);
|
||||
@ -187,21 +185,20 @@ void Foam::ensightLagrangianField
|
||||
{
|
||||
Type val = field[i];
|
||||
|
||||
if (mag(val) < 1.0e-90)
|
||||
if (mag(val) < 1e-90)
|
||||
{
|
||||
val = Zero;
|
||||
}
|
||||
|
||||
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||
{
|
||||
os.write( component(val, cmpt) );
|
||||
}
|
||||
label cmpt = ensightPTraits<Type>::componentOrder[d];
|
||||
os.write(component(val, cmpt));
|
||||
|
||||
count += pTraits<Type>::nComponents;
|
||||
|
||||
if (count % 6 == 0)
|
||||
{
|
||||
os.newline();
|
||||
if (++count % 6 == 0)
|
||||
{
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,10 @@ HashTable<HashTable<word>> cloudFields;
|
||||
|
||||
if (timeDirs.size())
|
||||
{
|
||||
IOobjectList objs(mesh, timeDirs.last().name());
|
||||
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||
const word& lastTimeName = timeDirs.last().name();
|
||||
|
||||
IOobjectList objs(mesh, lastTimeName);
|
||||
|
||||
forAllConstIter(IOobjectList, objs, fieldIter)
|
||||
{
|
||||
@ -31,14 +34,17 @@ if (timeDirs.size())
|
||||
//
|
||||
// now check for lagrangian/<cloudName>
|
||||
//
|
||||
fileNameList cloudDirs = readDir
|
||||
(
|
||||
runTime.path()
|
||||
/ timeDirs.last().name()
|
||||
/ regionPrefix
|
||||
/ cloud::prefix,
|
||||
fileName::DIRECTORY
|
||||
);
|
||||
fileNameList cloudDirs;
|
||||
if (!noLagrangian)
|
||||
{
|
||||
cloudDirs = readDir
|
||||
(
|
||||
runTime.path()
|
||||
/ lastTimeName
|
||||
/ cloudPrefix,
|
||||
fileName::DIRECTORY
|
||||
);
|
||||
}
|
||||
|
||||
forAll(cloudDirs, cloudI)
|
||||
{
|
||||
@ -54,8 +60,8 @@ if (timeDirs.size())
|
||||
IOobjectList objs
|
||||
(
|
||||
mesh,
|
||||
timeDirs.last().name(),
|
||||
cloud::prefix/cloudName
|
||||
lastTimeName,
|
||||
cloudPrefix/cloudName
|
||||
);
|
||||
|
||||
bool hasPositions = false;
|
||||
@ -89,17 +95,27 @@ if (timeDirs.size())
|
||||
//
|
||||
for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
|
||||
{
|
||||
IOobjectList objs(mesh, timeDirs[i].name());
|
||||
const word& timeName = timeDirs[i].name();
|
||||
|
||||
forAllIter(HashTable<word>, volumeFields, fieldIter)
|
||||
// Everything is potentially missing, unless we discover otherwise
|
||||
wordHashSet missing(volumeFields);
|
||||
|
||||
// Avoid -->> IOobjectList objs(mesh, timeName); <<--
|
||||
// Too much overhead when done so frequently.
|
||||
|
||||
fileNameList contents = readDir
|
||||
(
|
||||
runTime.path()
|
||||
/ timeName,
|
||||
fileName::FILE
|
||||
);
|
||||
|
||||
forAll(contents, fileI)
|
||||
{
|
||||
const word& fieldName = fieldIter.key();
|
||||
|
||||
if (!objs.found(fieldName))
|
||||
{
|
||||
volumeFields.erase(fieldIter);
|
||||
}
|
||||
missing.erase(contents[fileI].name());
|
||||
}
|
||||
|
||||
volumeFields.erase(missing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +44,9 @@ Usage
|
||||
\param -noZero \n
|
||||
Exclude the often incomplete initial conditions.
|
||||
|
||||
\param -noLagrangian \n
|
||||
Suppress writing lagrangian positions and fields.
|
||||
|
||||
\param -index \<start\>\n
|
||||
Ignore the time index contained in the time file and use a
|
||||
simple indexing when creating the \c Ensight/data/######## files.
|
||||
@ -101,6 +104,11 @@ int main(int argc, char *argv[])
|
||||
"and use simple indexing when creating the files"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noLagrangian",
|
||||
"suppress writing lagrangian positions and fields"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noMesh",
|
||||
"suppress writing the geometry. "
|
||||
@ -149,15 +157,17 @@ int main(int argc, char *argv[])
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
// default to binary output, unless otherwise specified
|
||||
IOstream::streamFormat format = IOstream::BINARY;
|
||||
if (args.optionFound("ascii"))
|
||||
{
|
||||
format = IOstream::ASCII;
|
||||
}
|
||||
const IOstream::streamFormat format =
|
||||
(
|
||||
args.optionFound("ascii")
|
||||
? IOstream::ASCII
|
||||
: IOstream::BINARY
|
||||
);
|
||||
|
||||
// control for renumbering iterations
|
||||
label indexingNumber = 0;
|
||||
bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
||||
const bool optIndex = args.optionReadIfPresent("index", indexingNumber);
|
||||
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||
|
||||
// always write the geometry, unless the -noMesh option is specified
|
||||
bool optNoMesh = args.optionFound("noMesh");
|
||||
@ -204,6 +214,11 @@ int main(int argc, char *argv[])
|
||||
regionPrefix = regionName;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info<< "Converting " << timeDirs.size() << " time steps" << endl;
|
||||
}
|
||||
|
||||
// Construct the list of ensight parts for the entire mesh
|
||||
ensightParts partsList(mesh);
|
||||
|
||||
@ -244,6 +259,9 @@ int main(int argc, char *argv[])
|
||||
cloudTimesUsed.insert(cloudIter.key(), DynamicList<label>());
|
||||
}
|
||||
|
||||
Info<< "Startup in "
|
||||
<< timer.cpuTimeIncrement() << " s, "
|
||||
<< mem.update().size() << " kB" << nl << endl;
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
@ -294,7 +312,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "write volume field (" << flush;
|
||||
Info<< "Write volume field (" << flush;
|
||||
|
||||
forAllConstIter(HashTable<word>, volumeFields, fieldIter)
|
||||
{
|
||||
@ -380,15 +398,9 @@ int main(int argc, char *argv[])
|
||||
forAllConstIter(HashTable<HashTable<word>>, cloudFields, cloudIter)
|
||||
{
|
||||
const word& cloudName = cloudIter.key();
|
||||
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||
|
||||
if
|
||||
(
|
||||
!isDir
|
||||
(
|
||||
runTime.timePath()/regionPrefix/
|
||||
cloud::prefix/cloudName
|
||||
)
|
||||
)
|
||||
if (!isDir(runTime.timePath()/cloudPrefix/cloudName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -397,28 +409,25 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
mesh,
|
||||
runTime.timeName(),
|
||||
cloud::prefix/cloudName
|
||||
cloudPrefix/cloudName
|
||||
);
|
||||
|
||||
// check that the positions field is present for this time
|
||||
IOobject* positionPtr = cloudObjs.lookup(word("positions"));
|
||||
if (positionPtr != NULL)
|
||||
{
|
||||
ensightParticlePositions
|
||||
(
|
||||
mesh,
|
||||
dataDir,
|
||||
subDir,
|
||||
cloudName,
|
||||
format
|
||||
);
|
||||
}
|
||||
else
|
||||
if (!cloudObjs.found("positions"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Info<< "write " << cloudName << " (" << flush;
|
||||
Info<< "Write " << cloudName << " ( positions" << flush;
|
||||
|
||||
ensightParticlePositions
|
||||
(
|
||||
mesh,
|
||||
dataDir,
|
||||
subDir,
|
||||
cloudName,
|
||||
format
|
||||
);
|
||||
|
||||
forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
|
||||
{
|
||||
@ -430,7 +439,7 @@ int main(int argc, char *argv[])
|
||||
if (!fieldObject)
|
||||
{
|
||||
Info<< "missing "
|
||||
<< runTime.timeName()/cloud::prefix/cloudName
|
||||
<< runTime.timeName()/cloudPrefix/cloudName
|
||||
/ fieldName
|
||||
<< endl;
|
||||
continue;
|
||||
|
||||
@ -39,5 +39,5 @@
|
||||
}
|
||||
|
||||
timeIndices.insert(timeIndex, timeDirs[timeI].value());
|
||||
Info<< "\nTime [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||
Info<< nl << "Time [" << timeIndex << "] = " << runTime.timeName() << nl;
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ Foam::tmp<Field<Type>> Foam::tecplotWriter::getFaceField
|
||||
const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh();
|
||||
|
||||
tmp<Field<Type>> tfld(new Field<Type>(faceLabels.size()));
|
||||
Field<Type>& fld = tfld();
|
||||
Field<Type>& fld = tfld.ref();
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
// check all time directories for the following:
|
||||
|
||||
// Any cloud names:
|
||||
HashSet<fileName> allCloudDirs;
|
||||
|
||||
if (timeDirs.size() && !noLagrangian)
|
||||
{
|
||||
const fileName& baseDir = mesh.time().path();
|
||||
const fileName& cloudPrefix = regionPrefix/cloud::prefix;
|
||||
|
||||
Info<< "Searching for lagrangian ... " << flush;
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
const word& timeName = timeDirs[timeI].name();
|
||||
|
||||
// DO NOT USE -->> runTime.setTime(timeDirs[timeI], timeI); <<--
|
||||
// It incurs a large overhead when done so frequently.
|
||||
|
||||
fileNameList cloudDirs = readDir
|
||||
(
|
||||
baseDir/timeName/cloudPrefix,
|
||||
fileName::DIRECTORY
|
||||
);
|
||||
|
||||
forAll(cloudDirs, cloudI)
|
||||
{
|
||||
const word& cloudName = cloudDirs[cloudI];
|
||||
|
||||
IOobjectList cloudObjs
|
||||
(
|
||||
mesh,
|
||||
timeName,
|
||||
cloudPrefix/cloudName
|
||||
);
|
||||
|
||||
// clouds always require "positions"
|
||||
if (cloudObjs.found("positions"))
|
||||
{
|
||||
if (allCloudDirs.insert(cloudName))
|
||||
{
|
||||
Info<< "At time: " << timeName
|
||||
<< " detected cloud directory : " << cloudName
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allCloudDirs.empty())
|
||||
{
|
||||
Info<< "none detected." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// sorted list of cloud names
|
||||
const fileNameList cloudNames(allCloudDirs.sortedToc());
|
||||
|
||||
if (cloudNames.size())
|
||||
{
|
||||
// complete the echo information
|
||||
Info<< "(";
|
||||
forAll(cloudNames, cloudNo)
|
||||
{
|
||||
Info<< ' ' << cloudNames[cloudNo];
|
||||
}
|
||||
Info<< " ) " << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,6 +71,9 @@ Usage
|
||||
\param -noInternal \n
|
||||
Do not generate file for mesh, only for patches
|
||||
|
||||
\param -noLagrangian \n
|
||||
Suppress writing lagrangian positions and fields.
|
||||
|
||||
\param -noPointValues \n
|
||||
No pointFields
|
||||
|
||||
@ -290,6 +293,12 @@ int main(int argc, char *argv[])
|
||||
"noInternal",
|
||||
"do not generate file for mesh, only for patches"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noLagrangian",
|
||||
"suppress writing lagrangian positions and fields"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noPointValues",
|
||||
@ -336,6 +345,7 @@ int main(int argc, char *argv[])
|
||||
const bool doLinks = !args.optionFound("noLinks");
|
||||
bool binary = !args.optionFound("ascii");
|
||||
const bool useTimeName = args.optionFound("useTimeName");
|
||||
const bool noLagrangian = args.optionFound("noLagrangian");
|
||||
|
||||
// Decomposition of polyhedral cells into tets/pyramids cells
|
||||
vtkTopo::decomposePoly = !args.optionFound("poly");
|
||||
@ -406,9 +416,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
// VTK/ directory in the case
|
||||
fileName fvPath(runTime.path()/"VTK");
|
||||
// Directory of mesh (region0 gets filtered out)
|
||||
fileName regionPrefix = "";
|
||||
|
||||
// Directory of mesh (region0 gets filtered out)
|
||||
fileName regionPrefix;
|
||||
if (regionName != polyMesh::defaultRegion)
|
||||
{
|
||||
fvPath = fvPath/regionName;
|
||||
@ -446,43 +456,7 @@ int main(int argc, char *argv[])
|
||||
<< timer.cpuTimeIncrement() << " s, "
|
||||
<< mem.update().size() << " kB" << endl;
|
||||
|
||||
|
||||
// Scan for all possible lagrangian clouds
|
||||
HashSet<fileName> allCloudDirs;
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
fileNameList cloudDirs
|
||||
(
|
||||
readDir
|
||||
(
|
||||
runTime.timePath()/regionPrefix/cloud::prefix,
|
||||
fileName::DIRECTORY
|
||||
)
|
||||
);
|
||||
forAll(cloudDirs, i)
|
||||
{
|
||||
IOobjectList sprayObjs
|
||||
(
|
||||
mesh,
|
||||
runTime.timeName(),
|
||||
cloud::prefix/cloudDirs[i]
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
{
|
||||
if (allCloudDirs.insert(cloudDirs[i]))
|
||||
{
|
||||
Info<< "At time: " << runTime.timeName()
|
||||
<< " detected cloud directory : " << cloudDirs[i]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "findClouds.H"
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
@ -490,7 +464,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time: " << runTime.timeName() << endl;
|
||||
|
||||
word timeDesc =
|
||||
const word timeDesc =
|
||||
useTimeName ? runTime.timeName() : Foam::name(runTime.timeIndex());
|
||||
|
||||
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell
|
||||
@ -662,7 +636,7 @@ int main(int argc, char *argv[])
|
||||
+ dtf.size();
|
||||
|
||||
|
||||
// Construct pointMesh only if nessecary since constructs edge
|
||||
// Construct pointMesh only if necessary since constructs edge
|
||||
// addressing (expensive on polyhedral meshes)
|
||||
if (noPointValues)
|
||||
{
|
||||
@ -1149,9 +1123,9 @@ int main(int argc, char *argv[])
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
forAllConstIter(HashSet<fileName>, allCloudDirs, iter)
|
||||
forAll(cloudNames, cloudNo)
|
||||
{
|
||||
const fileName& cloudName = iter.key();
|
||||
const fileName& cloudName = cloudNames[cloudNo];
|
||||
|
||||
// Always create the cloud directory.
|
||||
mkDir(fvPath/cloud::prefix/cloudName);
|
||||
@ -1172,9 +1146,7 @@ int main(int argc, char *argv[])
|
||||
cloud::prefix/cloudName
|
||||
);
|
||||
|
||||
IOobject* positionsPtr = sprayObjs.lookup(word("positions"));
|
||||
|
||||
if (positionsPtr)
|
||||
if (sprayObjs.found("positions"))
|
||||
{
|
||||
wordList labelNames(sprayObjs.names(labelIOField::typeName));
|
||||
Info<< " labels :";
|
||||
@ -1309,7 +1281,7 @@ int main(int argc, char *argv[])
|
||||
+ "_"
|
||||
+ procFile.name()
|
||||
);
|
||||
if (system(cmd.c_str()) == -1)
|
||||
if (Foam::system(cmd.c_str()) == -1)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Could not execute command " << cmd << endl;
|
||||
|
||||
@ -47,7 +47,8 @@ case "$ParaView_VERSION" in
|
||||
if canBuildPlugin
|
||||
then
|
||||
(
|
||||
# C++ compiler for CMake
|
||||
# ensure CMake gets the correct C/C++ compilers
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
wmake $targetType vtkPV3Readers
|
||||
|
||||
@ -47,7 +47,8 @@ case "$ParaView_VERSION" in
|
||||
if canBuildPlugin
|
||||
then
|
||||
(
|
||||
# C++ compiler for CMake
|
||||
# ensure CMake gets the correct C/C++ compilers
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
wmake $targetType vtkPVReaders
|
||||
|
||||
@ -8,7 +8,8 @@ targetType=libso
|
||||
# Source the wmake functions
|
||||
. $WM_DIR/scripts/wmakeFunctions
|
||||
|
||||
# C++ compiler for CMake
|
||||
# ensure CMake gets the correct C/C++ compilers
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
set -x
|
||||
|
||||
@ -47,11 +47,14 @@ QT4_WRAP_CPP(MOC_SRCS pqPVFoamReaderPanel.h)
|
||||
|
||||
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
|
||||
CLASS_NAME pqPVFoamReaderPanel
|
||||
XML_NAME PVFoamReader # name of SourceProxy in *SM.xml
|
||||
XML_NAME PVFoamReader # name of SourceProxy in *SM.xml
|
||||
XML_GROUP sources
|
||||
)
|
||||
|
||||
IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
|
||||
# so check if version < 4.4
|
||||
|
||||
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
|
||||
ADD_PARAVIEW_PLUGIN(
|
||||
PVFoamReader_SM "1.0"
|
||||
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
||||
@ -61,7 +64,7 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
||||
GUI_RESOURCE_FILES PVFoamReader.xml
|
||||
)
|
||||
ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
ELSE()
|
||||
ADD_PARAVIEW_PLUGIN(
|
||||
PVFoamReader_SM "1.0"
|
||||
SERVER_MANAGER_XML PVFoamReader_SM.xml
|
||||
@ -70,7 +73,7 @@ ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
GUI_SOURCES pqPVFoamReaderPanel.cxx
|
||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
||||
)
|
||||
ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
ENDIF()
|
||||
|
||||
TARGET_LINK_LIBRARIES(
|
||||
PVFoamReader_SM
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<ParaViewReaders>
|
||||
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
|
||||
<Reader name="PVFoamReader"
|
||||
extensions="OpenFOAM"
|
||||
file_description="OpenFOAM Reader">
|
||||
|
||||
@ -1,18 +1,12 @@
|
||||
/* Note: enable vtkPolyhedron when available */
|
||||
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I../../vtkPVReaders/lnInclude \
|
||||
-I../PVFoamReader \
|
||||
-I$(ParaView_INCLUDE_DIR) \
|
||||
-I$(ParaView_INCLUDE_DIR)/vtkkwiml \
|
||||
$(shell \
|
||||
test -f $(ParaView_INCLUDE_DIR)/vtkPolyhedron.h && \
|
||||
echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
|
||||
)
|
||||
-I../../vtkPVReaders/lnInclude \
|
||||
-I../PVFoamReader
|
||||
|
||||
LIB_LIBS = \
|
||||
-lmeshTools \
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -275,7 +275,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
||||
// Polyhedral cell - use VTK_POLYHEDRON
|
||||
const labelList& cFaces = mesh.cells()[cellI];
|
||||
|
||||
#ifdef HAS_VTK_POLYHEDRON
|
||||
vtkIdType nFaces = cFaces.size();
|
||||
vtkIdType nLabels = nFaces;
|
||||
|
||||
@ -320,33 +319,6 @@ vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
|
||||
}
|
||||
|
||||
vtkmesh->InsertNextCell(VTK_POLYHEDRON, nFaces, faceStream.data());
|
||||
#else
|
||||
// this is a horrible substitute
|
||||
// but avoids crashes when there is no vtkPolyhedron support
|
||||
|
||||
// establish unique node ids used
|
||||
HashSet<vtkIdType, Hash<label>> hashUniqId(2*256);
|
||||
|
||||
forAll(cFaces, cFaceI)
|
||||
{
|
||||
const face& f = mesh.faces()[cFaces[cFaceI]];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
hashUniqId.insert(f[fp]);
|
||||
}
|
||||
}
|
||||
|
||||
// use face stream to store unique node ids:
|
||||
faceStream = hashUniqId.sortedToc();
|
||||
|
||||
vtkmesh->InsertNextCell
|
||||
(
|
||||
VTK_CONVEX_POINT_SET,
|
||||
vtkIdType(faceStream.size()),
|
||||
faceStream.data()
|
||||
);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -8,7 +8,8 @@ targetType=libso
|
||||
# Source the wmake functions
|
||||
. $WM_DIR/scripts/wmakeFunctions
|
||||
|
||||
# C++ compiler for CMake
|
||||
# ensure CMake gets the correct C/C++ compilers
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
set -x
|
||||
|
||||
@ -46,13 +46,16 @@ QT4_WRAP_CPP(MOC_SRCS pqPVblockMeshReaderPanel.h)
|
||||
|
||||
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
|
||||
CLASS_NAME pqPVblockMeshReaderPanel
|
||||
XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
|
||||
XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
|
||||
XML_GROUP sources
|
||||
)
|
||||
|
||||
IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
ADD_PARAVIEW_PLUGIN(
|
||||
PVblockMeshReader_SM "1.0"
|
||||
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
|
||||
# so check if version < 4.4
|
||||
|
||||
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
|
||||
ADD_PARAVIEW_PLUGIN(
|
||||
PVblockMeshReader_SM "1.0"
|
||||
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
||||
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
|
||||
GUI_INTERFACES ${IFACES}
|
||||
@ -60,16 +63,16 @@ IF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
||||
GUI_RESOURCE_FILES PVblockMeshReader.xml
|
||||
)
|
||||
ELSE("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
ADD_PARAVIEW_PLUGIN(
|
||||
PVblockMeshReader_SM "1.0"
|
||||
ELSE()
|
||||
ADD_PARAVIEW_PLUGIN(
|
||||
PVblockMeshReader_SM "1.0"
|
||||
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
||||
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
|
||||
GUI_INTERFACES ${IFACES}
|
||||
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
|
||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
||||
)
|
||||
ENDIF("${PARAVIEW_VERSION_MINOR}" EQUAL 0)
|
||||
ENDIF()
|
||||
|
||||
# Build the client-side plugin
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<ParaViewReaders>
|
||||
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
|
||||
<Reader name="PVblockMeshReader"
|
||||
extensions="blockMesh"
|
||||
file_description="OpenFOAM blockMesh reader">
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,6 +29,8 @@ Group
|
||||
|
||||
Description
|
||||
List times using timeSelector.
|
||||
To simplify parsing of the output, the normal banner information
|
||||
is suppressed.
|
||||
|
||||
Usage
|
||||
|
||||
|
||||
@ -51,13 +51,11 @@ int readNumProcs
|
||||
const Time& runTime
|
||||
)
|
||||
{
|
||||
const word dictName = "decomposeParDict";
|
||||
fileName dictFile;
|
||||
if (args.optionReadIfPresent(optionName, dictFile))
|
||||
if (args.optionReadIfPresent(optionName, dictFile) && isDir(dictFile))
|
||||
{
|
||||
if (isDir(dictFile))
|
||||
{
|
||||
dictFile = dictFile/"decomposeParDict";
|
||||
}
|
||||
dictFile = dictFile / dictName;
|
||||
}
|
||||
|
||||
return readInt
|
||||
@ -68,7 +66,7 @@ int readNumProcs
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"decomposeParDict",
|
||||
dictName,
|
||||
runTime.system(),
|
||||
runTime,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
@ -376,7 +374,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (parallelSource && !parallelTarget)
|
||||
{
|
||||
int nProcs = readNumProcs
|
||||
const int nProcs = readNumProcs
|
||||
(
|
||||
args,
|
||||
"sourceDecomposeParDict",
|
||||
@ -448,7 +446,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (!parallelSource && parallelTarget)
|
||||
{
|
||||
int nProcs = readNumProcs
|
||||
const int nProcs = readNumProcs
|
||||
(
|
||||
args,
|
||||
"targetDecomposeParDict",
|
||||
@ -521,13 +519,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (parallelSource && parallelTarget)
|
||||
{
|
||||
int nProcsSource = readNumProcs
|
||||
const int nProcsSource = readNumProcs
|
||||
(
|
||||
args,
|
||||
"sourceDecomposeParDict",
|
||||
runTimeSource
|
||||
);
|
||||
int nProcsTarget = readNumProcs
|
||||
const int nProcsTarget = readNumProcs
|
||||
(
|
||||
args,
|
||||
"targetDecomposeParDict",
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -191,9 +191,15 @@ void writeRays
|
||||
str << "l " << vertI-1 << ' ' << vertI << nl;
|
||||
}
|
||||
}
|
||||
string cmd("objToVTK " + fName + " " + fName.lessExt() + ".vtk");
|
||||
Pout<< "cmd:" << cmd << endl;
|
||||
system(cmd);
|
||||
str.flush();
|
||||
|
||||
DynamicList<string> cmd(3);
|
||||
cmd.append("objToVTK");
|
||||
cmd.append(fName);
|
||||
cmd.append(fName.lessExt() + ".vtk");
|
||||
|
||||
Pout<< "cmd: objToVTK " << fName.c_str() << endl;
|
||||
Foam::system(cmd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,26 @@ Group
|
||||
Description
|
||||
Checks geometric and topological quality of a surface.
|
||||
|
||||
Usage
|
||||
- surfaceCheck surfaceFile [OPTION]
|
||||
|
||||
\param -checkSelfIntersection \n
|
||||
Check for self-intersection.
|
||||
|
||||
\param -splitNonManifold \n
|
||||
Split surface along non-manifold edges.
|
||||
|
||||
\param -verbose \n
|
||||
Extra verbosity.
|
||||
|
||||
\param -blockMesh \n
|
||||
Write vertices/blocks for tight-fitting 1 cell blockMeshDict.
|
||||
|
||||
\param -outputThreshold \<num files\> \n
|
||||
Specifies upper limit for the number of files written. This is useful to
|
||||
prevent surfaces with lots of disconnected parts to write lots of files.
|
||||
Default is 10. A special case is 0 which prevents writing any files.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "triangle.H"
|
||||
@ -265,6 +285,63 @@ void writeParts
|
||||
}
|
||||
|
||||
|
||||
void syncEdges(const triSurface& p, labelHashSet& markedEdges)
|
||||
{
|
||||
// See comment below about having duplicate edges
|
||||
|
||||
const edgeList& edges = p.edges();
|
||||
HashSet<edge, Hash<edge>> edgeSet(2*markedEdges.size());
|
||||
|
||||
forAllConstIter(labelHashSet, markedEdges, iter)
|
||||
{
|
||||
edgeSet.insert(edges[iter.key()]);
|
||||
}
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
if (edgeSet.found(edges[edgeI]))
|
||||
{
|
||||
markedEdges.insert(edgeI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void syncEdges(const triSurface& p, boolList& isMarkedEdge)
|
||||
{
|
||||
// See comment below about having duplicate edges
|
||||
|
||||
const edgeList& edges = p.edges();
|
||||
|
||||
label n = 0;
|
||||
forAll(isMarkedEdge, edgeI)
|
||||
{
|
||||
if (isMarkedEdge[edgeI])
|
||||
{
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<edge, Hash<edge>> edgeSet(2*n);
|
||||
|
||||
forAll(isMarkedEdge, edgeI)
|
||||
{
|
||||
if (isMarkedEdge[edgeI])
|
||||
{
|
||||
edgeSet.insert(edges[edgeI]);
|
||||
}
|
||||
}
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
if (edgeSet.found(edges[edgeI]))
|
||||
{
|
||||
isMarkedEdge[edgeI] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -299,6 +376,8 @@ int main(int argc, char *argv[])
|
||||
const bool checkSelfIntersect = args.optionFound("checkSelfIntersection");
|
||||
const bool verbose = args.optionFound("verbose");
|
||||
const bool splitNonManifold = args.optionFound("splitNonManifold");
|
||||
label outputThreshold = 10;
|
||||
args.optionReadIfPresent("outputThreshold", outputThreshold);
|
||||
|
||||
Info<< "Reading surface from " << surfFileName << " ..." << nl << endl;
|
||||
|
||||
@ -408,10 +487,14 @@ int main(int argc, char *argv[])
|
||||
Info<< "Surface has " << illegalFaces.size()
|
||||
<< " illegal triangles." << endl;
|
||||
|
||||
OFstream str("illegalFaces");
|
||||
Info<< "Dumping conflicting face labels to " << str.name() << endl
|
||||
<< "Paste this into the input for surfaceSubset" << endl;
|
||||
str << illegalFaces;
|
||||
if (outputThreshold > 0)
|
||||
{
|
||||
OFstream str("illegalFaces");
|
||||
Info<< "Dumping conflicting face labels to " << str.name()
|
||||
<< endl
|
||||
<< "Paste this into the input for surfaceSubset" << endl;
|
||||
str << illegalFaces;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -486,6 +569,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Dump for subsetting
|
||||
if (outputThreshold > 0)
|
||||
{
|
||||
DynamicList<label> problemFaces(surf.size()/100+1);
|
||||
|
||||
@ -666,12 +750,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Conflicting face labels:" << problemFaces.size() << endl;
|
||||
|
||||
OFstream str("problemFaces");
|
||||
if (outputThreshold > 0)
|
||||
{
|
||||
OFstream str("problemFaces");
|
||||
|
||||
Info<< "Dumping conflicting face labels to " << str.name() << endl
|
||||
<< "Paste this into the input for surfaceSubset" << endl;
|
||||
Info<< "Dumping conflicting face labels to " << str.name() << endl
|
||||
<< "Paste this into the input for surfaceSubset" << endl;
|
||||
|
||||
str << problemFaces;
|
||||
str << problemFaces;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -695,6 +782,7 @@ int main(int argc, char *argv[])
|
||||
borderEdge[edgeI] = true;
|
||||
}
|
||||
}
|
||||
syncEdges(surf, borderEdge);
|
||||
}
|
||||
|
||||
labelList faceZone;
|
||||
@ -702,7 +790,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Number of unconnected parts : " << numZones << endl;
|
||||
|
||||
if (numZones > 1)
|
||||
if (numZones > 1 && outputThreshold > 0)
|
||||
{
|
||||
Info<< "Splitting surface into parts ..." << endl << endl;
|
||||
|
||||
@ -710,7 +798,7 @@ int main(int argc, char *argv[])
|
||||
writeParts
|
||||
(
|
||||
surf,
|
||||
numZones,
|
||||
min(outputThreshold, numZones),
|
||||
faceZone,
|
||||
surfFilePath,
|
||||
surfFileNameBase
|
||||
@ -726,6 +814,17 @@ int main(int argc, char *argv[])
|
||||
labelHashSet borderEdge(surf.size()/1000);
|
||||
PatchTools::checkOrientation(surf, false, &borderEdge);
|
||||
|
||||
// Bit strange: if a triangle has two same vertices (illegal!) it will
|
||||
// still have three distinct edges (two of which have the same vertices).
|
||||
// In this case the faceEdges addressing is not symmetric, i.e. a
|
||||
// neighbouring, valid, triangle will have correct addressing so 3 distinct
|
||||
// edges so it will miss one of those two identical edges.
|
||||
// - we don't want to fix this in PrimitivePatch since it is too specific
|
||||
// - instead just make sure we mark all identical edges consistently
|
||||
// when we use them for marking.
|
||||
|
||||
syncEdges(surf, borderEdge);
|
||||
|
||||
//
|
||||
// Colour all faces into zones using borderEdge
|
||||
//
|
||||
@ -739,15 +838,26 @@ int main(int argc, char *argv[])
|
||||
if (numNormalZones > 1)
|
||||
{
|
||||
Info<< "More than one normal orientation." << endl;
|
||||
writeZoning(surf, normalZone, "normal", surfFilePath, surfFileNameBase);
|
||||
writeParts
|
||||
(
|
||||
surf,
|
||||
numNormalZones,
|
||||
normalZone,
|
||||
surfFilePath,
|
||||
surfFileNameBase + "_normal"
|
||||
);
|
||||
|
||||
if (outputThreshold > 0)
|
||||
{
|
||||
writeZoning
|
||||
(
|
||||
surf,
|
||||
normalZone,
|
||||
"normal",
|
||||
surfFilePath,
|
||||
surfFileNameBase
|
||||
);
|
||||
writeParts
|
||||
(
|
||||
surf,
|
||||
min(outputThreshold, numNormalZones),
|
||||
normalZone,
|
||||
surfFilePath,
|
||||
surfFileNameBase + "_normal"
|
||||
);
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
@ -764,7 +874,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
const indexedOctree<treeDataTriSurface>& tree = querySurf.tree();
|
||||
|
||||
OBJstream intStream("selfInterPoints.obj");
|
||||
autoPtr<OBJstream> intStreamPtr;
|
||||
if (outputThreshold > 0)
|
||||
{
|
||||
intStreamPtr.reset(new OBJstream("selfInterPoints.obj"));
|
||||
}
|
||||
|
||||
label nInt = 0;
|
||||
|
||||
@ -786,9 +900,9 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
if (hitInfo.hit())
|
||||
if (hitInfo.hit() && intStreamPtr.valid())
|
||||
{
|
||||
intStream.write(hitInfo.hitPoint());
|
||||
intStreamPtr().write(hitInfo.hitPoint());
|
||||
nInt++;
|
||||
}
|
||||
}
|
||||
@ -801,36 +915,13 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< "Surface is self-intersecting at " << nInt
|
||||
<< " locations." << endl;
|
||||
Info<< "Writing intersection points to " << intStream.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
//surfaceIntersection inter(querySurf);
|
||||
//
|
||||
//if (inter.cutEdges().empty() && inter.cutPoints().empty())
|
||||
//{
|
||||
// Info<< "Surface is not self-intersecting" << endl;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Info<< "Surface is self-intersecting" << endl;
|
||||
// Info<< "Writing edges of intersection to selfInter.obj" << endl;
|
||||
//
|
||||
// OFstream intStream("selfInter.obj");
|
||||
// forAll(inter.cutPoints(), cutPointI)
|
||||
// {
|
||||
// const point& pt = inter.cutPoints()[cutPointI];
|
||||
//
|
||||
// intStream << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z()
|
||||
// << endl;
|
||||
// }
|
||||
// forAll(inter.cutEdges(), cutEdgeI)
|
||||
// {
|
||||
// const edge& e = inter.cutEdges()[cutEdgeI];
|
||||
//
|
||||
// intStream << "l " << e.start()+1 << ' ' << e.end()+1 << endl;
|
||||
// }
|
||||
//}
|
||||
if (intStreamPtr.valid())
|
||||
{
|
||||
Info<< "Writing intersection points to "
|
||||
<< intStreamPtr().name() << endl;
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -156,14 +156,10 @@ int main(int argc, char *argv[])
|
||||
// Note: cannot use setSystemRunTimeDictionaryIO.H since dictionary
|
||||
// is in constant
|
||||
|
||||
fileName dictPath = "";
|
||||
if (args.optionFound("dict"))
|
||||
fileName dictPath;
|
||||
if (args.optionReadIfPresent("dict", dictPath) && isDir(dictPath))
|
||||
{
|
||||
dictPath = args["dict"];
|
||||
if (isDir(dictPath))
|
||||
{
|
||||
dictPath = dictPath / dictName;
|
||||
}
|
||||
dictPath = dictPath / dictName;
|
||||
}
|
||||
|
||||
if (dictPath.size())
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -66,6 +66,9 @@ Note
|
||||
#include "MeshedSurfaces.H"
|
||||
#include "UnsortedMeshedSurfaces.H"
|
||||
|
||||
#include "IStringStream.H"
|
||||
#include "OStringStream.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -84,11 +87,37 @@ int main(int argc, char *argv[])
|
||||
argList::validArgs.append("outputFile");
|
||||
|
||||
argList::addBoolOption("clean");
|
||||
argList::addBoolOption("orient");
|
||||
argList::addBoolOption("surfMesh");
|
||||
argList::addBoolOption("triSurface");
|
||||
argList::addBoolOption("unsorted");
|
||||
argList::addBoolOption("triFace");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"orient",
|
||||
"check surface orientation"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"surfMesh",
|
||||
"test surfMesh output"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"triSurface",
|
||||
"use triSurface for read/write"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"unsorted",
|
||||
"use UnsortedMeshedSurface instead of MeshedSurface, "
|
||||
"or unsorted output (with -triSurface option)"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"triFace",
|
||||
"use triFace instead of face"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"stdout",
|
||||
"ignore output filename and write to stdout"
|
||||
);
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
@ -99,10 +128,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool optStdout = args.optionFound("stdout");
|
||||
const scalar scaleFactor = args.optionLookupOrDefault("scale", 0.0);
|
||||
|
||||
const fileName importName = args[1];
|
||||
const fileName exportName = args[2];
|
||||
const fileName exportName = optStdout ? "-stdout" : args[2];
|
||||
|
||||
if (importName == exportName)
|
||||
{
|
||||
@ -114,7 +144,11 @@ int main(int argc, char *argv[])
|
||||
if
|
||||
(
|
||||
!MeshedSurface<face>::canRead(importName, true)
|
||||
|| !MeshedSurface<face>::canWriteType(exportName.ext(), true)
|
||||
||
|
||||
(
|
||||
!optStdout
|
||||
&& !MeshedSurface<face>::canWriteType(exportName.ext(), true)
|
||||
)
|
||||
)
|
||||
{
|
||||
return 1;
|
||||
@ -128,6 +162,23 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
|
||||
// check: output to ostream, construct from istream
|
||||
{
|
||||
OStringStream os;
|
||||
os << surf;
|
||||
IStringStream is(os.str());
|
||||
|
||||
// both work:
|
||||
triSurface surf2(is);
|
||||
|
||||
// OR
|
||||
// is.rewind();
|
||||
// triSurface surf2;
|
||||
// is >> surf2;
|
||||
|
||||
// surf2.read(is); // FAIL: private method
|
||||
}
|
||||
|
||||
if (args.optionFound("orient"))
|
||||
{
|
||||
Info<< "Checking surface orientation" << endl;
|
||||
@ -156,8 +207,15 @@ int main(int argc, char *argv[])
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
// write sorted by region
|
||||
surf.write(exportName, true);
|
||||
if (optStdout)
|
||||
{
|
||||
Info<< surf;
|
||||
}
|
||||
else
|
||||
{
|
||||
// normally write sorted (looks nicer)
|
||||
surf.write(exportName, !args.optionFound("unsorted"));
|
||||
}
|
||||
}
|
||||
else if (args.optionFound("unsorted"))
|
||||
{
|
||||
@ -167,6 +225,23 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
|
||||
// check: output to ostream, construct from istream
|
||||
{
|
||||
OStringStream os;
|
||||
os << surf;
|
||||
IStringStream is(os.str());
|
||||
|
||||
// both work:
|
||||
UnsortedMeshedSurface<face> surf2(is);
|
||||
|
||||
// OR
|
||||
// is.rewind();
|
||||
// UnsortedMeshedSurface<face> surf2;
|
||||
// is >> surf2;
|
||||
|
||||
// surf2.read(is); // FAIL: private method
|
||||
}
|
||||
|
||||
if (args.optionFound("orient"))
|
||||
{
|
||||
Info<< "Checking surface orientation" << endl;
|
||||
@ -194,9 +269,16 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
}
|
||||
surf.write(exportName);
|
||||
|
||||
if (optStdout)
|
||||
{
|
||||
Info<< surf;
|
||||
}
|
||||
else
|
||||
{
|
||||
surf.write(exportName);
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
else if (args.optionFound("triFace"))
|
||||
{
|
||||
MeshedSurface<triFace> surf(importName);
|
||||
@ -205,6 +287,23 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
|
||||
// check: output to ostream, construct from istream
|
||||
{
|
||||
OStringStream os;
|
||||
os << surf;
|
||||
IStringStream is(os.str());
|
||||
|
||||
// both work:
|
||||
MeshedSurface<face> surf2(is);
|
||||
|
||||
// OR
|
||||
// is.rewind();
|
||||
// MeshedSurface<face> surf2;
|
||||
// is >> surf2;
|
||||
|
||||
// surf2.read(is); // FAIL: private method
|
||||
}
|
||||
|
||||
if (args.optionFound("orient"))
|
||||
{
|
||||
Info<< "Checking surface orientation" << endl;
|
||||
@ -232,9 +331,16 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
}
|
||||
surf.write(exportName);
|
||||
|
||||
if (optStdout)
|
||||
{
|
||||
Info<< surf;
|
||||
}
|
||||
else
|
||||
{
|
||||
surf.write(exportName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
MeshedSurface<face> surf(importName);
|
||||
@ -243,6 +349,23 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
|
||||
// check: output to ostream, construct from istream
|
||||
{
|
||||
OStringStream os;
|
||||
os << surf;
|
||||
IStringStream is(os.str());
|
||||
|
||||
// both work:
|
||||
MeshedSurface<face> surf2(is);
|
||||
|
||||
// OR
|
||||
// is.rewind();
|
||||
// MeshedSurface<face> surf2;
|
||||
// is >> surf2;
|
||||
|
||||
// surf2.read(is); // FAIL: private method
|
||||
}
|
||||
|
||||
if (args.optionFound("orient"))
|
||||
{
|
||||
Info<< "Checking surface orientation" << endl;
|
||||
@ -258,7 +381,6 @@ int main(int argc, char *argv[])
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
Info<< "writing " << exportName;
|
||||
if (scaleFactor <= 0)
|
||||
{
|
||||
@ -271,7 +393,15 @@ int main(int argc, char *argv[])
|
||||
surf.writeStats(Info);
|
||||
Info<< endl;
|
||||
}
|
||||
surf.write(exportName);
|
||||
|
||||
if (optStdout)
|
||||
{
|
||||
Info<< surf;
|
||||
}
|
||||
else
|
||||
{
|
||||
surf.write(exportName);
|
||||
}
|
||||
|
||||
if (args.optionFound("surfMesh"))
|
||||
{
|
||||
@ -287,7 +417,6 @@ int main(int argc, char *argv[])
|
||||
Info<< "runTime.instance() = " << runTime.instance() << endl;
|
||||
Info<< "runTime.timeName() = " << runTime.timeName() << endl;
|
||||
|
||||
|
||||
Info<< "write MeshedSurface 'yetAnother' via proxy as surfMesh"
|
||||
<< endl;
|
||||
surf.write
|
||||
@ -312,14 +441,11 @@ int main(int argc, char *argv[])
|
||||
MeshedSurface<face> surfIn2(runTime, "foobar");
|
||||
|
||||
Info<<"surfIn2 = " << surfIn2.size() << endl;
|
||||
|
||||
Info<< "surfIn = " << surfIn.size() << endl;
|
||||
|
||||
|
||||
Info<< "writing surfMesh as obj = oldSurfIn.obj" << endl;
|
||||
surfIn.write("oldSurfIn.obj");
|
||||
|
||||
|
||||
Info<< "runTime.instance() = " << runTime.instance() << endl;
|
||||
|
||||
surfMesh surfOut
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,6 +29,8 @@ Group
|
||||
|
||||
Description
|
||||
Miscellaneous information about surface meshes.
|
||||
To simplify parsing of the output, the normal banner information
|
||||
is suppressed.
|
||||
|
||||
Usage
|
||||
- surfaceMeshInfo surfaceFile [OPTION]
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
|
||||
-I$(LIB_SRC)/parallel/distributed/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-ldistributed \
|
||||
-lmeshTools \
|
||||
-ltriSurface
|
||||
-ltriSurface \
|
||||
-ldecompose
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,6 +46,7 @@ Note
|
||||
#include "distributedTriSurfaceMesh.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "localIOdictionary.H"
|
||||
#include "decompositionModel.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -103,7 +104,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"redistribute a triSurface"
|
||||
"Redistribute a triSurface. "
|
||||
"The specified surface must be located in the constant/triSurface directory"
|
||||
);
|
||||
|
||||
argList::validArgs.append("triSurfaceMesh");
|
||||
@ -127,7 +129,7 @@ int main(int argc, char *argv[])
|
||||
<< "Using distribution method "
|
||||
<< distTypeName << nl << endl;
|
||||
|
||||
const bool keepNonMapped = args.options().found("keepNonMapped");
|
||||
const bool keepNonMapped = args.optionFound("keepNonMapped");
|
||||
|
||||
if (keepNonMapped)
|
||||
{
|
||||
@ -151,6 +153,37 @@ int main(int argc, char *argv[])
|
||||
|
||||
Random rndGen(653213);
|
||||
|
||||
// For independent decomposition, ensure that distributedTriSurfaceMesh
|
||||
// can find the alternative decomposeParDict specified via the
|
||||
// -decomposeParDict option.
|
||||
if (distType == distributedTriSurfaceMesh::INDEPENDENT)
|
||||
{
|
||||
fileName decompDictFile;
|
||||
args.optionReadIfPresent("decomposeParDict", decompDictFile);
|
||||
|
||||
IOdictionary* dict = new IOdictionary
|
||||
(
|
||||
decompositionModel::selectIO
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"decomposeParDict",
|
||||
runTime.system(),
|
||||
runTime,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
decompDictFile
|
||||
)
|
||||
);
|
||||
|
||||
// The object must have the expected "decomposeParDict" name.
|
||||
// This also implies that it cannot be changed during the run.
|
||||
dict->rename("decomposeParDict");
|
||||
|
||||
runTime.store(dict);
|
||||
}
|
||||
|
||||
// Determine mesh bounding boxes:
|
||||
List<List<treeBoundBox>> meshBb(Pstream::nProcs());
|
||||
if (distType == distributedTriSurfaceMesh::FOLLOW)
|
||||
|
||||
@ -1,61 +0,0 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Script
|
||||
# engridFoam
|
||||
#
|
||||
# Description
|
||||
# start engrid using the paraview libraries from OpenFOAM
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
usage() {
|
||||
exec 1>&2
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
|
||||
Usage: ${0##*/} [OPTION]
|
||||
options:
|
||||
-help
|
||||
|
||||
* start engrid using the paraview-$ParaView_MAJOR libraries
|
||||
passes through engrid options unmodified
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
# report usage
|
||||
[ "$1" = "-h" -o "$1" = "-help" ] && usage
|
||||
|
||||
bindir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/engrid
|
||||
libdir="$ParaView_DIR/lib/paraview-${ParaView_MAJOR:-unknown}"
|
||||
|
||||
[ -x $bindir/engrid ] || usage "engrid executable not found in $bindir"
|
||||
[ -d $libdir ] || usage "paraview libraries not found"
|
||||
|
||||
export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
|
||||
echo "starting $bindir/engrid $@"
|
||||
eval "exec $bindir/engrid $@ &"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -99,7 +99,7 @@ IFS=': '
|
||||
# or may contain ':' separators
|
||||
set -- $*
|
||||
|
||||
# strip out wildcards via sed
|
||||
# Strip out wildcards via sed. Path and wildcard cannot contain '?'.
|
||||
while [ "$#" -ge 1 ]
|
||||
do
|
||||
wildcard=$1
|
||||
@ -107,7 +107,7 @@ do
|
||||
##DEBUG echo "remove>$wildcard<" 1>&2
|
||||
if [ -n "$wildcard" ]
|
||||
then
|
||||
dirList=$(echo "$dirList:" | sed -e "s@${wildcard}[^:]*:@@g")
|
||||
dirList=$(echo "$dirList:" | sed -e "s?${wildcard}[^:]*:??g")
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
75
bin/paraFoam
75
bin/paraFoam
@ -4,7 +4,7 @@
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -40,17 +40,18 @@ usage() {
|
||||
Usage: ${0##*/} [OPTION] [PARAVIEW_OPTION]
|
||||
options:
|
||||
-block use blockMesh reader (uses .blockMesh extension)
|
||||
-builtin use VTK builtin OpenFOAM reader (uses .foam extension)
|
||||
-case <dir> specify alternative case directory, default is the cwd
|
||||
-region <name> specify alternative mesh region
|
||||
-touch only create the file (eg, .blockMesh, .OpenFOAM, etc)
|
||||
-touchAll create .blockMesh, .OpenFOAM files (and for all regions)
|
||||
-vtk | -builtin use VTK builtin OpenFOAM reader (uses .foam extension)
|
||||
-help print the usage
|
||||
|
||||
Paraview options start with a double dashes.
|
||||
|
||||
paraview options start with a double dashes
|
||||
* start paraview with the OpenFOAM libraries
|
||||
|
||||
* start paraview $ParaView_VERSION with the OpenFOAM libraries
|
||||
paraview=$(command -v paraview)
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
@ -67,10 +68,9 @@ unset regionName optTouch
|
||||
# already 2010-07)
|
||||
export LC_ALL=C
|
||||
|
||||
# Reader extension
|
||||
# Reader extension and plugin
|
||||
extension=OpenFOAM
|
||||
|
||||
requirePV=1
|
||||
plugin=PVFoamReader
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
@ -81,11 +81,12 @@ do
|
||||
;;
|
||||
-block | -blockMesh)
|
||||
extension=blockMesh
|
||||
plugin=PVblockMeshReader
|
||||
shift
|
||||
;;
|
||||
-builtin)
|
||||
-builtin | -vtk)
|
||||
extension=foam
|
||||
requirePV=0
|
||||
unset plugin
|
||||
shift
|
||||
;;
|
||||
-case)
|
||||
@ -100,12 +101,12 @@ do
|
||||
;;
|
||||
-touch)
|
||||
optTouch=true
|
||||
requirePV=0
|
||||
unset plugin
|
||||
shift
|
||||
;;
|
||||
-touchAll)
|
||||
optTouch=all
|
||||
requirePV=0
|
||||
unset plugin
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
@ -116,26 +117,34 @@ do
|
||||
break # Stop here, treat this and balance as paraview options
|
||||
;;
|
||||
*)
|
||||
usage "unknown option/argument: '$*'"
|
||||
usage "unknown option/argument: '$1'"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check that reader module has been built
|
||||
if [ $requirePV -eq 1 -a ! -f $PV_PLUGIN_PATH/libPVFoamReader_SM.so ]
|
||||
then
|
||||
cat<< BUILDREADER
|
||||
|
||||
FATAL ERROR: ParaView reader module libraries do not exist
|
||||
# If a reader module is needed, check that it exists
|
||||
[ -z "$plugin" -o -f $PV_PLUGIN_PATH/lib${plugin}_SM.so ] || {
|
||||
cat<< BUILDREADER 1>&2
|
||||
|
||||
ERROR: ParaView reader module library ($plugin) does not exist
|
||||
Please build the reader module before continuing:
|
||||
cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
|
||||
./Allwclean
|
||||
./Allwmake
|
||||
|
||||
cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
|
||||
./Allwclean
|
||||
./Allwmake
|
||||
|
||||
BUILDREADER
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fallback to native reader, if possible
|
||||
if [ "$extension" = OpenFOAM ]
|
||||
then
|
||||
extension=foam
|
||||
echo "Using the native VTK/OpenFOAM reader instead" 1>&2
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Check for --data=... argument
|
||||
hasDataArg()
|
||||
@ -165,7 +174,7 @@ if [ -n "$regionName" ]
|
||||
then
|
||||
if [ ! -d constant/$regionName ]
|
||||
then
|
||||
echo "FATAL ERROR: Region $regionName does not exist"
|
||||
echo "FATAL ERROR: Region $regionName does not exist" 1>&2
|
||||
exit 1
|
||||
else
|
||||
caseFile="$caseName{$regionName}.$extension"
|
||||
@ -179,10 +188,10 @@ all)
|
||||
if [ -f system/blockMeshDict -o -f constant/polyMesh/blockMeshDict ]
|
||||
then
|
||||
touch "$caseName.blockMesh"
|
||||
echo "Created '$caseName.blockMesh'"
|
||||
echo "Created '$caseName.blockMesh'" 1>&2
|
||||
fi
|
||||
touch "$caseName.$extension"
|
||||
echo "Created '$caseName.$extension'"
|
||||
echo "Created '$caseName.$extension'" 1>&2
|
||||
# Discover probable regions
|
||||
for region in constant/*
|
||||
do
|
||||
@ -190,14 +199,14 @@ all)
|
||||
then
|
||||
regionName=${region##*/}
|
||||
touch "$caseName{$regionName}.$extension"
|
||||
echo "Created '$caseName{$regionName}.$extension'"
|
||||
echo "Created '$caseName{$regionName}.$extension'" 1>&2
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
true)
|
||||
touch "$caseFile"
|
||||
echo "Created '$caseFile'"
|
||||
echo "Created '$caseFile'" 1>&2
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
@ -222,14 +231,14 @@ else
|
||||
warn="WARN file does not exist:"
|
||||
case $extension in
|
||||
blockMesh)
|
||||
blockMeshDictDir=system/blockMeshDict
|
||||
blockMeshDict=system/blockMeshDict
|
||||
if [ -f constant/polyMesh/blockMeshDict ]
|
||||
then
|
||||
blockMeshDictDir=constant/polyMesh/blockMeshDict
|
||||
blockMeshDict=constant/polyMesh/blockMeshDict
|
||||
fi
|
||||
for check in \
|
||||
system/controlDict \
|
||||
$blockMeshDictDir \
|
||||
$blockMeshDict \
|
||||
;
|
||||
do
|
||||
[ -s "$parentDir/$check" ] || {
|
||||
@ -240,7 +249,7 @@ else
|
||||
done
|
||||
;;
|
||||
|
||||
builtin | OpenFOAM)
|
||||
OpenFOAM)
|
||||
for check in \
|
||||
system/controlDict \
|
||||
$fvControls/fvSchemes \
|
||||
@ -268,7 +277,7 @@ else
|
||||
[ -e $caseFile ] || {
|
||||
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
|
||||
touch "$caseFile"
|
||||
echo "Created temporary '$caseFile'"
|
||||
echo "Created temporary '$caseFile'" 1>&2
|
||||
}
|
||||
|
||||
# For now filter out any ld.so errors. Caused by non-system compiler?
|
||||
|
||||
@ -54,7 +54,6 @@ getApplication()
|
||||
|
||||
runApplication()
|
||||
{
|
||||
LOG_NAME=
|
||||
APP_RUN=
|
||||
LOG_IGNORE=false
|
||||
LOG_APPEND=false
|
||||
@ -100,18 +99,18 @@ runApplication()
|
||||
|
||||
runParallel()
|
||||
{
|
||||
LOG_NAME=
|
||||
APP_RUN=
|
||||
# Store any parsed additional arguments e.g. decomposeParDict
|
||||
APP_PARARGS=
|
||||
LOG_IGNORE=false
|
||||
LOG_APPEND=false
|
||||
LOG_SUFFIX=
|
||||
|
||||
# Store any parsed additional arguments e.g. decomposeParDict
|
||||
APP_PARARGS=
|
||||
# Check the default decomposeParDict if available
|
||||
nProcs=$(getNumberOfProcessors "system/decomposeParDict")
|
||||
nProcs=$(getNumberOfProcessors system/decomposeParDict)
|
||||
|
||||
# Parse options and executable
|
||||
while [ $# -gt 0 ] && [ -z "$APP_RUN" ] ; do
|
||||
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
|
||||
key="$1"
|
||||
case "$key" in
|
||||
-append|-a)
|
||||
@ -144,7 +143,7 @@ runParallel()
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -f log.$SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
|
||||
if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
|
||||
then
|
||||
echo "$APP_NAME already run on $PWD:" \
|
||||
"remove log file 'log.$LOG_SUFFIX' to re-run"
|
||||
|
||||
@ -39,15 +39,15 @@
|
||||
if [ "$#" -gt 0 ]
|
||||
then
|
||||
|
||||
realFilePath=$(echo $1 | sed -e s@^$WM_PROJECT_DIR@../../..@ )
|
||||
realFilePath=$(echo "$1" | sed -e "s?^$WM_PROJECT_DIR?../../..?" )
|
||||
if [ -n "$FOAM_ONLINE_REPO" ]
|
||||
then
|
||||
filePath=$(echo $1 | sed -e s@^$WM_PROJECT_DIR@$FOAM_ONLINE_REPO@ )
|
||||
filePath=$(echo "$1" | sed -e "s?^$WM_PROJECT_DIR?$FOAM_ONLINE_REPO?" )
|
||||
else
|
||||
filePath=$realFilePath
|
||||
fi
|
||||
|
||||
# dirName=$(echo "$filePath" | sed -e 's@/[^/]*$@@' )
|
||||
# dirName=$(echo "$filePath" | sed -e 's?/[^/]*$??' )
|
||||
dirName=${filePath%/[^/]*}
|
||||
fileName=${filePath##*/}
|
||||
|
||||
@ -62,7 +62,7 @@ then
|
||||
# ;;
|
||||
esac
|
||||
|
||||
awk -f $WM_PROJECT_DIR/bin/tools/doxyFilter-table.awk $1 | \
|
||||
awk -f $WM_PROJECT_DIR/bin/tools/doxyFilter-table.awk "$1" | \
|
||||
awk -f $awkScript | \
|
||||
sed -f $WM_PROJECT_DIR/bin/tools/doxyFilter.sed \
|
||||
-e s@%realFilePath%@$realFilePath@g \
|
||||
|
||||
@ -118,6 +118,8 @@ tr.memlist
|
||||
.OFPlainTable tr td {
|
||||
height: 20px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
div.line,
|
||||
span.comment,
|
||||
span.keyword,
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
set boost_version=boost-system
|
||||
set boost_version=boost_1_61_0
|
||||
set cgal_version=CGAL-4.8
|
||||
|
||||
setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
set fftw_version=fftw-system
|
||||
set fftw_version=fftw-3.3.4
|
||||
|
||||
setenv FFTW_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$fftw_version
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
|
||||
# Location of compiler installation
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ( ! $?WM_COMPILER_TYPE ) then
|
||||
set WM_COMPILER_TYPE=system
|
||||
setenv WM_COMPILER_TYPE system
|
||||
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
|
||||
echo " WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE'"
|
||||
endif
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
# - the LD_LIBRARY_PATH is not adjusted.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
boost_version=boost-system
|
||||
boost_version=boost_1_61_0
|
||||
cgal_version=CGAL-4.8
|
||||
|
||||
export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
# - the LD_LIBRARY_PATH is not adjusted.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
fftw_version=fftw-system
|
||||
fftw_version=fftw-3.3.4
|
||||
|
||||
export FFTW_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$fftw_version
|
||||
|
||||
@ -64,7 +64,7 @@ then
|
||||
# it is either located within ThirdParty, or a central installation
|
||||
# outside of ThirdParty and must be added to the lib-path.
|
||||
|
||||
ending="${FFTW_ARCH_PATH_PATH##*-}"
|
||||
ending="${FFTW_ARCH_PATH##*-}"
|
||||
if [ "$ending" != none -a "$ending" != system ]
|
||||
then
|
||||
_foamAddLib $FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/libccmio
|
||||
# etc/config.sh/ccmio
|
||||
#
|
||||
# Description
|
||||
# Setup file for libccmio include/libraries.
|
||||
@ -116,7 +116,7 @@ else
|
||||
# Cleanup environment:
|
||||
# ~~~~~~~~~~~~~~~~~~~~
|
||||
unset WM_BASH_FUNCTIONS
|
||||
unset _foamAddPath _foamAddLib _foamAddMan
|
||||
unset _foamSource _foamEval
|
||||
unset -f _foamAddPath _foamAddLib _foamAddMan
|
||||
unset -f _foamSource _foamEval
|
||||
|
||||
fi
|
||||
|
||||
@ -48,7 +48,7 @@ wmake $targetType lagrangian/basic
|
||||
wmake $targetType lagrangian/distributionModels
|
||||
wmake $targetType genericPatchFields
|
||||
|
||||
wmake $targetType conversion
|
||||
conversion/Allwmake $targetType $*
|
||||
wmake $targetType mesh/extrudeModel
|
||||
wmake $targetType dynamicMesh
|
||||
wmake $targetType dynamicFvMesh
|
||||
@ -58,10 +58,9 @@ wmake $targetType sampling
|
||||
|
||||
# Compile scotchDecomp, metisDecomp etc.
|
||||
parallel/Allwmake $targetType $*
|
||||
randomProcesses/Allwmake $targetType $*
|
||||
|
||||
wmake $targetType ODE
|
||||
wmake $targetType randomProcesses
|
||||
|
||||
wmake $targetType fvMotionSolver
|
||||
|
||||
transportModels/Allwmake $targetType $*
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,6 +38,8 @@ Description
|
||||
#include "timer.H"
|
||||
#include "IFstream.H"
|
||||
#include "DynamicList.H"
|
||||
#include "CStringList.H"
|
||||
#include "SubList.H"
|
||||
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
@ -49,6 +51,7 @@ Description
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
@ -593,9 +596,9 @@ bool Foam::chMod(const fileName& name, const mode_t m)
|
||||
}
|
||||
|
||||
|
||||
mode_t Foam::mode(const fileName& name)
|
||||
mode_t Foam::mode(const fileName& name, const bool followLink)
|
||||
{
|
||||
fileStat fileStatus(name);
|
||||
fileStat fileStatus(name, followLink);
|
||||
if (fileStatus.isValid())
|
||||
{
|
||||
return fileStatus.status().st_mode;
|
||||
@ -607,14 +610,18 @@ mode_t Foam::mode(const fileName& name)
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName::Type Foam::type(const fileName& name)
|
||||
Foam::fileName::Type Foam::type(const fileName& name, const bool followLink)
|
||||
{
|
||||
mode_t m = mode(name);
|
||||
mode_t m = mode(name, followLink);
|
||||
|
||||
if (S_ISREG(m))
|
||||
{
|
||||
return fileName::FILE;
|
||||
}
|
||||
else if (S_ISLNK(m))
|
||||
{
|
||||
return fileName::LINK;
|
||||
}
|
||||
else if (S_ISDIR(m))
|
||||
{
|
||||
return fileName::DIRECTORY;
|
||||
@ -626,27 +633,39 @@ Foam::fileName::Type Foam::type(const fileName& name)
|
||||
}
|
||||
|
||||
|
||||
bool Foam::exists(const fileName& name, const bool checkGzip)
|
||||
bool Foam::exists
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkGzip,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
return mode(name) || isFile(name, checkGzip);
|
||||
return mode(name, followLink) || isFile(name, checkGzip, followLink);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::isDir(const fileName& name)
|
||||
bool Foam::isDir(const fileName& name, const bool followLink)
|
||||
{
|
||||
return S_ISDIR(mode(name));
|
||||
return S_ISDIR(mode(name, followLink));
|
||||
}
|
||||
|
||||
|
||||
bool Foam::isFile(const fileName& name, const bool checkGzip)
|
||||
bool Foam::isFile
|
||||
(
|
||||
const fileName& name,
|
||||
const bool checkGzip,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz")));
|
||||
return
|
||||
S_ISREG(mode(name, followLink))
|
||||
|| (checkGzip && S_ISREG(mode(name + ".gz", followLink)));
|
||||
}
|
||||
|
||||
|
||||
off_t Foam::fileSize(const fileName& name)
|
||||
off_t Foam::fileSize(const fileName& name, const bool followLink)
|
||||
{
|
||||
fileStat fileStatus(name);
|
||||
fileStat fileStatus(name, followLink);
|
||||
if (fileStatus.isValid())
|
||||
{
|
||||
return fileStatus.status().st_size;
|
||||
@ -658,9 +677,9 @@ off_t Foam::fileSize(const fileName& name)
|
||||
}
|
||||
|
||||
|
||||
time_t Foam::lastModified(const fileName& name)
|
||||
time_t Foam::lastModified(const fileName& name, const bool followLink)
|
||||
{
|
||||
fileStat fileStatus(name);
|
||||
fileStat fileStatus(name, followLink);
|
||||
if (fileStatus.isValid())
|
||||
{
|
||||
return fileStatus.status().st_mtime;
|
||||
@ -676,7 +695,8 @@ Foam::fileNameList Foam::readDir
|
||||
(
|
||||
const fileName& directory,
|
||||
const fileName::Type type,
|
||||
const bool filtergz
|
||||
const bool filtergz,
|
||||
const bool followLink
|
||||
)
|
||||
{
|
||||
// Initial filename list size
|
||||
@ -717,10 +737,10 @@ Foam::fileNameList Foam::readDir
|
||||
{
|
||||
fileName fName(list->d_name);
|
||||
|
||||
// ignore files begining with ., i.e. '.', '..' and '.*'
|
||||
// ignore files beginning with ., i.e. '.', '..' and '.*'
|
||||
if (fName.size() && fName[0] != '.')
|
||||
{
|
||||
word fExt = fName.ext();
|
||||
const word fExt = fName.ext();
|
||||
|
||||
if
|
||||
(
|
||||
@ -736,7 +756,7 @@ Foam::fileNameList Foam::readDir
|
||||
)
|
||||
)
|
||||
{
|
||||
if ((directory/fName).type() == type)
|
||||
if ((directory/fName).type(followLink) == type)
|
||||
{
|
||||
if (nEntries >= dirEntries.size())
|
||||
{
|
||||
@ -766,7 +786,7 @@ Foam::fileNameList Foam::readDir
|
||||
}
|
||||
|
||||
|
||||
bool Foam::cp(const fileName& src, const fileName& dest)
|
||||
bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
|
||||
{
|
||||
// Make sure source exists.
|
||||
if (!exists(src))
|
||||
@ -777,7 +797,8 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
||||
fileName destFile(dest);
|
||||
|
||||
// Check type of source file.
|
||||
if (src.type() == fileName::FILE)
|
||||
const fileName::Type srcType = src.type(followLink);
|
||||
if (srcType == fileName::FILE)
|
||||
{
|
||||
// If dest is a directory, create the destination file name.
|
||||
if (destFile.type() == fileName::DIRECTORY)
|
||||
@ -817,7 +838,23 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (src.type() == fileName::DIRECTORY)
|
||||
else if (srcType == fileName::LINK)
|
||||
{
|
||||
// If dest is a directory, create the destination file name.
|
||||
if (destFile.type() == fileName::DIRECTORY)
|
||||
{
|
||||
destFile = destFile/src.name();
|
||||
}
|
||||
|
||||
// Make sure the destination directory exists.
|
||||
if (!isDir(destFile.path()) && !mkDir(destFile.path()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ln(src, destFile);
|
||||
}
|
||||
else if (srcType == fileName::DIRECTORY)
|
||||
{
|
||||
// If dest is a directory, create the destination file name.
|
||||
if (destFile.type() == fileName::DIRECTORY)
|
||||
@ -832,7 +869,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
||||
}
|
||||
|
||||
// Copy files
|
||||
fileNameList contents = readDir(src, fileName::FILE, false);
|
||||
fileNameList contents = readDir(src, fileName::FILE, false, followLink);
|
||||
forAll(contents, i)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
@ -843,11 +880,17 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
||||
}
|
||||
|
||||
// File to file.
|
||||
cp(src/contents[i], destFile/contents[i]);
|
||||
cp(src/contents[i], destFile/contents[i], followLink);
|
||||
}
|
||||
|
||||
// Copy sub directories.
|
||||
fileNameList subdirs = readDir(src, fileName::DIRECTORY);
|
||||
fileNameList subdirs = readDir
|
||||
(
|
||||
src,
|
||||
fileName::DIRECTORY,
|
||||
false,
|
||||
followLink
|
||||
);
|
||||
forAll(subdirs, i)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
@ -858,9 +901,13 @@ bool Foam::cp(const fileName& src, const fileName& dest)
|
||||
}
|
||||
|
||||
// Dir to Dir.
|
||||
cp(src/subdirs[i], destFile);
|
||||
cp(src/subdirs[i], destFile, followLink);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -903,7 +950,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
|
||||
}
|
||||
|
||||
|
||||
bool Foam::mv(const fileName& src, const fileName& dst)
|
||||
bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
@ -914,7 +961,7 @@ bool Foam::mv(const fileName& src, const fileName& dst)
|
||||
if
|
||||
(
|
||||
dst.type() == fileName::DIRECTORY
|
||||
&& src.type() != fileName::DIRECTORY
|
||||
&& src.type(followLink) != fileName::DIRECTORY
|
||||
)
|
||||
{
|
||||
const fileName dstName(dst/src.name());
|
||||
@ -1016,7 +1063,7 @@ bool Foam::rmDir(const fileName& directory)
|
||||
{
|
||||
fileName path = directory/fName;
|
||||
|
||||
if (path.type() == fileName::DIRECTORY)
|
||||
if (path.type(false) == fileName::DIRECTORY)
|
||||
{
|
||||
if (!rmDir(path))
|
||||
{
|
||||
@ -1166,9 +1213,153 @@ bool Foam::ping(const string& hostname, const label timeOut)
|
||||
}
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
//! \cond fileScope
|
||||
static int waitpid(const pid_t pid)
|
||||
{
|
||||
// child status, return code from the exec etc.
|
||||
int status = 0;
|
||||
|
||||
// in parent - blocking wait
|
||||
// modest treatment of signals (in child)
|
||||
// treat 'stopped' like exit (suspend/continue)
|
||||
while (true)
|
||||
{
|
||||
pid_t wpid = ::waitpid(pid, &status, WUNTRACED);
|
||||
|
||||
if (wpid == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "some error occurred in child"
|
||||
<< exit(FatalError);
|
||||
break;
|
||||
}
|
||||
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
// child exited, get its return status
|
||||
return WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
if (WIFSIGNALED(status))
|
||||
{
|
||||
// child terminated by some signal
|
||||
return WTERMSIG(status);
|
||||
}
|
||||
|
||||
if (WIFSTOPPED(status))
|
||||
{
|
||||
// child stopped by some signal
|
||||
return WSTOPSIG(status);
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "programming error, status from waitpid() not handled: "
|
||||
<< status
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return -1; // should not happen
|
||||
}
|
||||
//! \endcond
|
||||
}
|
||||
|
||||
|
||||
int Foam::system(const std::string& command)
|
||||
{
|
||||
return ::system(command.c_str());
|
||||
if (command.empty())
|
||||
{
|
||||
// Treat an empty command as a successful no-op.
|
||||
// From 'man sh' POSIX (man sh):
|
||||
// "If the command_string operand is an empty string,
|
||||
// sh shall exit with a zero exit status."
|
||||
return 0;
|
||||
}
|
||||
|
||||
pid_t child_pid = ::vfork(); // NB: vfork, not fork!
|
||||
if (child_pid == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "vfork() failed for system command " << command
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (child_pid == 0)
|
||||
{
|
||||
// in child
|
||||
|
||||
// execl uses the current environ
|
||||
(void) ::execl
|
||||
(
|
||||
"/bin/sh", // Path of the shell
|
||||
"sh", // Command-name (name for the shell)
|
||||
"-c", // Read commands from the command_string operand.
|
||||
command.c_str(), // Command string
|
||||
reinterpret_cast<char *>(0)
|
||||
);
|
||||
|
||||
// obviously failed, since exec should not return at all
|
||||
FatalErrorInFunction
|
||||
<< "exec failed: " << command
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// in parent - blocking wait
|
||||
return waitpid(child_pid);
|
||||
}
|
||||
|
||||
|
||||
int Foam::system(const Foam::UList<Foam::string>& command)
|
||||
{
|
||||
const int argc = command.size();
|
||||
|
||||
if (!argc)
|
||||
{
|
||||
// Treat an empty command as a successful no-op.
|
||||
// For consistency with POSIX (man sh) behaviour for (sh -c command),
|
||||
// which is what is mostly being replicated here.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// NB: use vfork, not fork!
|
||||
// vfork behaves more like a thread and avoids copy-on-write problems
|
||||
// triggered by fork.
|
||||
// The normal system() command has a fork buried in it that causes
|
||||
// issues with infiniband and openmpi etc.
|
||||
pid_t child_pid = ::vfork();
|
||||
if (child_pid == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "vfork() failed for system command " << command[0]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (child_pid == 0)
|
||||
{
|
||||
// in child:
|
||||
// Need command and arguments separately.
|
||||
// args is a NULL-terminated list of c-strings
|
||||
|
||||
CStringList args(SubList<string>(command, 0));
|
||||
if (argc > 1)
|
||||
{
|
||||
args.reset(SubList<string>(command, argc-1, 1));
|
||||
}
|
||||
|
||||
// execvp uses the current environ
|
||||
(void) ::execvp(command[0].c_str(), args.strings());
|
||||
|
||||
// obviously failed, since exec should not return at all
|
||||
FatalErrorInFunction
|
||||
<< "exec(" << command[0] << ", ...) failed"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// in parent - blocking wait
|
||||
return waitpid(child_pid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user