Compare commits

...

70 Commits

Author SHA1 Message Date
5bb5b3adfa BACKPORT: spack configuration patches (as per OpenFOAM-v1706)
etc/bashrc
  - improved robustness when sourcing
  - source top-level prefs.sh first (for sysadmin changes)

etc/config.*/settings
  - write job control information to the user directory
  - site/ directory under the OpenFOAM project dir, not its parent dir

etc/config.*/mpi
  - added USERMPI as place for spack mpi information

mgridgen, zoltan:
  - make location configurable

metis, scotch:
  - also check lib path (not just lib64)
2019-10-09 13:07:03 +02:00
ead4b73064 CONFIG: backport of META-INFO information (#1367) 2019-07-10 20:19:01 +02:00
696ff79107 CONFIG: cannot pass additional arguments to foamEtcFile (closes #880)
- add support by using updated foamEtcFile from 1806, which also add
  the '-config' short-cut option.
2018-06-18 08:42:55 +02:00
b833ffec08 BUG: dictionary lookup of embedded coordinateSystem fails (fixes #879)
- also fix incorrect documentation in forces functionObject and
  interRegionExplicitPorositySource fvOption.
2018-06-16 00:29:41 +02:00
553e3f84ab BUG: timeControlFunctionObject swallows dictionary modifications (closes #716)
- runTimeModifiable change to the dictionary not being propagated to
  the underlying functionObjects
2018-01-24 20:45:59 +01:00
701a3cc7b4 ENH: use main constant/triSurface directory for sampling surfaces (closes #704)
- these were previously taken from region-local directories
  (eg, constant/region/triSurface), but this becomes difficult to
  manage when there are many files and regions.
2018-01-17 14:47:38 +01:00
2ff022d3a4 BUG: multiLevelCoeffs entry not mandatory (closes #620) 2017-10-10 19:32:53 +02:00
41ebef8209 BUG: label overflow in multiLevel decomposition (closes #619)
- previously when more than two levels were used.
  Now calculate the required final target domain segment directly.
2017-10-10 18:06:52 +02:00
0d86dc1eb8 BUG: parse issues for nastran long format (closes #589) 2017-09-15 10:43:11 +02:00
9330e4f194 STYLE: Updated warning message output 2017-06-16 10:37:52 +01:00
217085d030 BUG: incorrect fall-through in directionalPressureGradientExplicitSource (fixes #486) 2017-05-29 15:33:38 +02:00
1f9462e7c9 BUG: foamToEnsight fails with missing field at time 0 (fixes #473) 2017-05-16 17:28:09 +02:00
1318ecdc60 COMP: skip compilation of plugins if include files are missing (fixes #464) 2017-05-05 10:14:48 +02:00
b069e42deb BUG: writeFile - corrected write of output file at start time 2017-04-25 12:30:35 +01:00
9d3a9268b0 BUG: runTimePostProcessing - corrected clipBox behaviour (see #456) 2017-04-24 14:33:37 +01:00
6aa9955d34 BUG: Corrected compilation errors 2017-04-19 13:44:54 +01:00
a8b7ca8151 BUG: adding case path to support parallel execution (Fixes #449) 2017-04-11 17:47:35 +05:30
b42424cb88 BUG: indexing in extendedEdgeMesh::add fails (fixes #448)
- 1st problem arises when there are edges, but edgeNormals is empty.
  The UIndirectList fails (zero elements, non-zero addressing)

- further problem occurs if there is a mismatch in the number of edges
  and edges normals (incorrect indexing on loop).
2017-04-11 00:53:03 +02:00
bee685c4bc TUT: Updated gamma value in sonicFoam tutorial - see #455 2017-04-18 11:37:34 +01:00
a647063f33 BUG: typo in addProfiling0 macro (fixes #446) 2017-04-07 07:46:17 +02:00
bd23037adb BUG: Gitlab issue 442. Resetting allLambda for phases in the alphaEqns.H for interMixingFoam 2017-04-05 13:58:45 -07:00
29bc0fadd9 BUG: bad shell construct for building optional component 2017-04-04 14:13:55 +02:00
d939fc873d BUG: waveModels - corrected reference water levels - thanks to Gabi Barajas 2017-03-30 14:57:36 +01:00
3415674f26 STYLE: Corrected typo 2017-03-22 09:11:47 +00:00
9f4ef6c1bf BUG: Missed change during fix for #437 2017-03-21 13:57:55 +00:00
5f119e4234 STYLE: Minor documentation update 2017-03-21 13:35:22 +00:00
8d0320fe5d BUG: nacaAirfoil tutorial - updated patches used by forceCoeffs function object. Fixes #438 2017-03-21 13:34:57 +00:00
be4776ea65 BUG: Function objects - updated to enable user time emtries, e.g. if using engineTime. Fixes #437 2017-03-21 13:32:55 +00:00
80064f42ac BUG: forceCoeffs - corrected handling of pDyn for compressible cases. Fixes #436 2017-03-21 13:27:47 +00:00
c74632f022 BUG: wallHeatFlux FO - corrected output of header info tofile. Fixes #435 2017-03-21 13:23:52 +00:00
4cb89e67f5 BUG: incorrect patch lookup in ensight conversion (fixes #430) 2017-03-17 09:09:31 +01:00
09086dd289 BUG: in wordRe::operator=(const keyType&)
- the regex was not being unset on assignment.
- drop unused recompile() method as being dubious
2017-03-10 13:05:35 +01:00
4cb459f30d Fixes #416 2017-03-02 10:22:24 +05:30
ff785f60cb ENH: Minor modification to the description 2017-02-28 10:37:43 -08:00
38bf08fca0 ENH: Correcting coefficient description in solarCalculator.H header 2017-02-28 10:35:55 -08:00
ef60db6d72 ENH: Adding skyCloudCoverFraction to SunLoadFairWeatherConditions mode in the solarCalculator.
This scalar allows to introduce a factor for cloudy sky between 0 (clear) and 1 (fully cloudy)
2017-02-27 16:46:12 -08:00
b7c50cc0e1 Use subDict for changeDictionary, Fixes #409 2017-02-23 11:33:29 +05:30
99014cc6af CONFIG: provide foamConfigurePaths -mpi option
- makes it easier to switch between mpi implementations (eg, openmpi, intelmpi etc)

- add comment about compiler setting for KNL
2017-02-16 09:14:17 +01:00
25fb05fe45 ENH:Delete 'not Implemented' function updateCoeffs() in slicedFvPatchField. ACMI patch is used with mesh.C() in isoSurface
which uses slicedFvPatch.
2017-02-20 10:34:01 -08:00
7b4d3fbe42 ENH: adding runTime selectable wallDist calculation to inverseDistanceDiffusivity 2017-02-14 08:30:53 -08:00
1e7244bd17 BUG: noise - updated creation of control dictionary to allow -case option and env variables. Fixes #402 2017-02-10 13:57:36 +00:00
68ce03377a ENH: setSystem*Dictionary - expand file names to enable the use of 2017-02-10 13:56:42 +00:00
1abcb4cdb8 temperatureCoupledBase: alphaAni set to none by default
boundaryRadiationProperties: updating to new format
dynamicMeshDict and snappyHexMeshDict in utorials/multiphase/interDyMFoam/RAS/motorBike to follow Mattijs Git lab id 381
2017-02-10 11:40:15 -08:00
033a867f6f BUG: Correcting calculation of azimuth angle in the solar direction 2017-02-09 13:13:45 -08:00
eca9fefa42 ENH: Modification of the start point for ray shooting to avoid self-hit in distorted meshes 2017-01-31 16:06:44 -08:00
64c91f2a52 BUG: missing specializations in foamVtkPTraits header 2017-01-17 08:54:07 +01:00
b061346ad2 BUG: extra newline in foamVtkAppendBase64Formatter flush()
Enhancements

- introduce intermediate layer for base64 foamVtk formatting
- add encodedLength() method, which is useful for xml appended output
2017-01-17 08:42:05 +01:00
f72413ac29 BUG: incorrect super-cells for foamVtkCells decomposition (fixes #385) 2017-01-16 18:25:03 +01:00
ed12c73af4 BUG: not incrementing when reading via singly-linked list 2017-01-24 12:59:13 +01:00
3a1e884bbd ENH: freshen code in labelRange classes
- misc improvements in functionality.
2017-01-23 17:09:26 +01:00
fcf6fd8257 STYLE: use pre-increment and cbegin/cend form for forAll* macros
- no reason to use post-increment in forAll() macro.

- use C++11 cbegin()/cend() method names for forAll*Iter() macros.
  These method names have been in OpenFOAM since 2009 and are also
  used by C++11 containers.

STYLE: nullptr instead of 0 in UList
2017-01-20 21:13:38 +01:00
10afef2025 STYLE: adjust documentation for scalarTransport FO 2017-01-18 11:31:15 +01:00
9035f13710 BUG: RunFunctions - updated retrieval of nProcs to suppress warning when no system/deomposeParDict 2017-02-03 12:27:50 +00:00
c1e06e145a BUG: waveModels - corrected wavelength calculation for StokesV model; code clean-up 2017-02-03 12:17:42 +00:00
c244279087 STYLE: Minor code tidying 2017-02-03 12:20:58 +00:00
f2c6964a48 BUG: boundaryDataTemplates - make dir before writing to stream. Fixes #390 2017-01-23 08:41:43 +00:00
a236d1dc2e BUG: wave models - corrected setting of U for shallowWaterAbsorption. Fixes #388 2017-01-19 13:30:59 +00:00
5566d5d487 adding viewFactorWall to inGroups fixes #384 2017-01-17 11:27:42 +00:00
ea1bd3301d ENH: command-line query for the OPENFOAM_PLUS wmake value (issue #378)
Examples,

    wmakePrintBuild -plus

Check if value is known
(ie, everything configured and also OpenFOAM+):

    if wmakePrintBuild -plus >/dev/null 2>&1
    then
        echo YES
    else
        echo NO
    fi

Check if version is new enough

    if ofver=$(wmakePrintBuild -plus 2>/dev/null) && [ "$ofver" -ge 1612 ]
    then
        echo YES
    else
        echo NO
    fi

Conditionals

    ofver=$(wmakePrintBuild -plus 2>/dev/null)
    case "${ofver:=0}" in
    1612)
        echo "something for 1612
        ;;
    1706)
        echo "something for 1706
        ;;
    esac
2017-01-12 11:25:37 +01:00
884850bcbb ENH: GAMGSolver: use raw pointers in critical loops. Fixes #379. 2017-01-11 17:23:10 +00:00
005502fb0e BUG: meshToMesh - corrected indexing of cutting patches. Fixes #376 2017-01-10 17:02:58 +00:00
93b51a524c ENH: optionally eliminate duplicates on hashedWordList construction (issue #375)
- makes it easier to use as a wordHashSet replacement for situations
  where we want to avoid duplicates but retain the input order.

- support construction from HashTable, which means it works like the
  HashTable::sortedToc but with its own hashing for these keys.

- expose rehash() method for the user. There is normally no need for
  using it directly, but also no reason to lock it away as private.
2017-01-10 12:42:40 +01:00
401241bbc1 BUG: turbulentDFSEMInlet BC - corrected singleProc usage for parallel runs. Fixes #374 2017-01-06 10:55:46 +00:00
1582128a9d STYLE: Updated README text 2017-01-04 16:09:00 +00:00
845682e4bc STYLE: Documentation updates - fixes #371 2017-01-04 16:05:47 +00:00
7c73ca1b12 BUG: ISLList - did not close #ifdef with #endif 2017-01-04 16:00:37 +00:00
9ab4318dd9 BUG: test-mesh updated to test polyMesh constructor. Fixes #372 2017-01-04 15:59:49 +00:00
e68219a148 ENH: polyMeshGeometry: normalise cellDeterminant calculation. Fixes #380. 2017-01-11 10:46:06 +00:00
cb79d79f2b BUG: Incomplete cleanup of paraview environment (fixes #369)
- LD_LIBRARY_PATH was not being cleaned at all when switching between
  paraview versions.

- PATH was cleaned against the third-party paraview-*, although 3rd
  party paraview is installed as ParaView-*.
  The additional cleanup for ParaView_DIR may not catch this (if it
  was unset elsewhere).
2017-01-03 17:12:02 +01:00
64df20d94a BUG: timeControl: add tolerance to timeStart, timeEnd. Fixes #367. 2017-01-04 11:17:12 +00:00
169 changed files with 2490 additions and 1513 deletions

9
META-INFO/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
# Do not track build information
build-info
# Do not track time-stamp
time-stamp
# Do not track any manifest files
Manifest.txt
manifest.txt

5
META-INFO/README.md Normal file
View File

@ -0,0 +1,5 @@
# META-INFO
Meta-information is for OpenFOAM internal use only.
(Backport from 1812)

2
META-INFO/api-info Normal file
View File

@ -0,0 +1,2 @@
api=1612
patch=180618

View File

@ -1,5 +1,5 @@
# About OpenFOAM # About OpenFOAM
OpenFOAM is a free, open source CFD software [released and developed primarily by OpenCFD Ltd](http://www.openfoam.com) since 2004released and developed primarily by. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to acoustics, solid mechanics and electromagnetics. [More...](http://www.openfoam.com/documentation) OpenFOAM is a free, open source CFD software [released and developed primarily by OpenCFD Ltd](http://www.openfoam.com) since 2004. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to acoustics, solid mechanics and electromagnetics. [More...](http://www.openfoam.com/documentation)
OpenFOAM+ is professionally released every six months to include customer sponsored developments and contributions from the community, including the OpenFOAM Foundation. Releases designated OpenFOAM+ contain several man years of client-sponsored developments of which much has been transferred to, but not released in the OpenFOAM Foundation branch. OpenFOAM+ is professionally released every six months to include customer sponsored developments and contributions from the community, including the OpenFOAM Foundation. Releases designated OpenFOAM+ contain several man years of client-sponsored developments of which much has been transferred to, but not released in the OpenFOAM Foundation branch.
@ -9,7 +9,7 @@ OpenFOAM is free software: you can redistribute it and/or modify it under the te
# OpenFOAM Trademark # OpenFOAM Trademark
OpenCFD Ltd grants use of the OpenFOAM trademark by Third Parties on a licence basis. ESI Group and the OpenFOAM Foundation Ltd are currently permitted to use the trademark. For information on trademark use, please refer to the [trademark policy guidelines](http://www.openfoam.com/legal/trademark-policy.php). OpenCFD Ltd grants use of the OpenFOAM trademark by Third Parties on a licence basis. ESI Group and the OpenFOAM Foundation Ltd are currently permitted to use the Name and agreed Domain Name. For information on trademark use, please refer to the [trademark policy guidelines](http://www.openfoam.com/legal/trademark-policy.php).
Please [contact OpenCFD](http://www.openfoam.com/contact) if you have any questions on the use of the OpenFOAM trademark. Please [contact OpenCFD](http://www.openfoam.com/contact) if you have any questions on the use of the OpenFOAM trademark.
@ -23,4 +23,4 @@ Violations of the Trademark are continuously monitored, and will be duly prosecu
- [OpenFOAM Community](http://www.openfoam.com/community/) - [OpenFOAM Community](http://www.openfoam.com/community/)
- [Contacting OpenCFD](http://www.openfoam.com/contact/) - [Contacting OpenCFD](http://www.openfoam.com/contact/)
Copyright 2016 OpenCFD Ltd Copyright 2016-2017 OpenCFD Ltd

View File

@ -108,6 +108,11 @@
); );
} }
alphaPhi1 = alphaPhi1BD + lambda*alphaPhi1;
// Reset allLambda to 1.0
allLambda = 1.0;
// Create the complete flux for alpha2 // Create the complete flux for alpha2
surfaceScalarField alphaPhi2 surfaceScalarField alphaPhi2
( (
@ -172,7 +177,6 @@
} }
// Construct the limited fluxes // Construct the limited fluxes
alphaPhi1 = alphaPhi1BD + lambda*alphaPhi1;
alphaPhi2 = alphaPhi2BD + lambda*alphaPhi2; alphaPhi2 = alphaPhi2BD + lambda*alphaPhi2;
// Solve for alpha1 // Solve for alpha1

View File

@ -42,7 +42,7 @@ int main(int argc, char *argv[])
"def", "def",
"ghi" "ghi"
}; };
words = { "def", "ghi", "xy", "all", "begin", "all" }; words = { "def", "ghi", "xy", "all", "end", "all" };
wordHashSet setA wordHashSet setA
{ {
@ -84,6 +84,26 @@ int main(int argc, char *argv[])
Info<< "hashedWordList: " << words << nl Info<< "hashedWordList: " << words << nl
<< "with lookup: " << words.lookup() << endl; << "with lookup: " << words.lookup() << endl;
{
List<word> input = { "def", "ghi", "xy", "all", "end", "all", "def" };
hashedWordList words1(input, true);
Info<< "input word list: " << input << nl
<< "without dup: " << words1 << endl;
Info<< "from wordHashSet: " << hashedWordList(setA) << endl;
Info<< "from HashTable: " << hashedWordList(tableA) << endl;
Info<< "from HashTable: " << hashedWordList(tableB) << endl;
// even this works
Info<< "from hashSet: "
<< hashedWordList
(
wordHashSet(setA)
| wordHashSet(tableA) | wordHashSet(tableB)
) << endl;
}
Info<< "wordHashSet: " << setA << endl; Info<< "wordHashSet: " << setA << endl;
Info<< "Table-HashSet: " << tableA << endl; Info<< "Table-HashSet: " << tableA << endl;
Info<< "Map<label>: " << mapA << endl; Info<< "Map<label>: " << mapA << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -42,7 +42,11 @@ See also
#include "vector.H" #include "vector.H"
#include "ListOps.H" #include "ListOps.H"
#include<list> #include "labelRange.H"
#include "ListOps.H"
#include "SubList.H"
#include <list>
using namespace Foam; using namespace Foam;
@ -61,6 +65,19 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
if (false)
{
labelList intlist(IStringStream("(0 1 2)")());
Info<<"construct from Istream: " << intlist << endl;
IStringStream("(3 4 5)")() >> static_cast<labelUList&>(intlist);
Info<<"is >>: " << intlist << endl;
IStringStream("(6 7 8)")() >> intlist;
Info<<"is >>: " << intlist << endl;
}
List<vector> list1(IStringStream("1 ((0 1 2))")()); List<vector> list1(IStringStream("1 ((0 1 2))")());
Info<< "list1: " << list1 << endl; Info<< "list1: " << list1 << endl;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,6 +58,7 @@ int main(int argc, char *argv[])
} }
labelRange range;
labelRanges ranges; labelRanges ranges;
bool removeMode = false; bool removeMode = false;
@ -74,14 +75,16 @@ int main(int argc, char *argv[])
continue; continue;
} }
label start = 0; {
label size = 0; label start = 0;
label size = 0;
IStringStream(args[argI])() >> start; IStringStream(args[argI])() >> start;
++argI; ++argI;
IStringStream(args[argI])() >> size; IStringStream(args[argI])() >> size;
labelRange range(start, size); range.reset(start, size);
}
Info<< "---------------" << nl; Info<< "---------------" << nl;
if (removeMode) if (removeMode)
@ -107,10 +110,11 @@ int main(int argc, char *argv[])
ranges.add(range); ranges.add(range);
} }
Info<< "<list>" << ranges << "</list>" << nl; Info<< "<list>" << ranges << "</list>" << nl
forAllConstIter(labelRanges, ranges, iter) << "content:";
for (auto i : ranges)
{ {
Info<< " " << iter(); Info<< " " << i;
} }
Info<< nl; Info<< nl;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,7 +40,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
Info<< "Create mesh, no clear-out\n" << endl; Info<< "Create mesh, no clear-out\n" << endl;
fvMesh mesh polyMesh mesh
( (
IOobject IOobject
( (
@ -51,12 +51,11 @@ int main(int argc, char *argv[])
) )
); );
Info<< mesh.C() << endl;
Info<< mesh.V() << endl;
surfaceVectorField Cf = mesh.Cf(); Info<< "Cell centres" << nl << mesh.cellCentres() << endl;
Info<< "Cell volumes" << nl << mesh.cellVolumes() << endl;
Info<< Cf << endl; Info<< "Cell shapes" << nl << mesh.cellShapes() << endl;
Info<< "Cell face centres" << nl << mesh.faceCentres() << endl;
// Test construct from cellShapes // Test construct from cellShapes
{ {
@ -83,7 +82,7 @@ int main(int argc, char *argv[])
word defaultBoundaryPatchName = "defaultFaces"; word defaultBoundaryPatchName = "defaultFaces";
word defaultBoundaryPatchType = emptyPolyPatch::typeName; word defaultBoundaryPatchType = emptyPolyPatch::typeName;
fvMesh newMesh polyMesh newMesh
( (
IOobject IOobject
( (
@ -101,12 +100,10 @@ int main(int argc, char *argv[])
defaultBoundaryPatchType defaultBoundaryPatchType
); );
Info<< newMesh.C() << endl; Info<< "New cell centres" << nl << newMesh.cellCentres() << endl;
Info<< newMesh.V() << endl; Info<< "New cell volumes" << nl << newMesh.cellVolumes() << endl;
Info<< "New cell shapes" << nl << newMesh.cellShapes() << endl;
surfaceVectorField Cf = newMesh.Cf(); Info<< "New cell face centres" << nl << newMesh.faceCentres() << endl;
Info<< Cf << endl;
} }

View File

@ -75,8 +75,8 @@ int main(int argc, char *argv[])
wre.info(Info) << " after DETECT" << endl; wre.info(Info) << " after DETECT" << endl;
wre.uncompile(); wre.uncompile();
wre.info(Info) << " uncompiled" << endl; wre.info(Info) << " uncompiled" << endl;
wre.recompile(); wre.compile();
wre.info(Info) << " recompiled" << endl; wre.info(Info) << " re-compiled" << endl;
wre.set("something .* value", wordRe::LITERAL); wre.set("something .* value", wordRe::LITERAL);
wre.info(Info) << " set as LITERAL" << endl; wre.info(Info) << " set as LITERAL" << endl;

View File

@ -11,12 +11,11 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/etc/config.sh/functions . $WM_PROJECT_DIR/etc/config.sh/functions
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio) _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
# Build libccmio (.a|.so) # Build libccmio (.a|.so)
$WM_THIRD_PARTY_DIR/makeCCMIO lib # libso $WM_THIRD_PARTY_DIR/makeCCMIO lib # libso
if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \ if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \
-a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o $FOAM_EXT_LIBBIN/libccmio.so \) ] -a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o -e $FOAM_EXT_LIBBIN/libccmio.so \) ]
then then
wmake $targetType ccm26ToFoam wmake $targetType ccm26ToFoam
fi fi

View File

@ -62,7 +62,7 @@ Foam::tmp<Foam::Field<Type>> filterFarPoints
) )
{ {
tmp<Field<Type>> tNewField(new Field<Type>(field.size())); tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
Field<Type>& newField = tNewField(); Field<Type>& newField = tNewField.ref();
label added = 0; label added = 0;
label count = 0; label count = 0;
@ -160,7 +160,7 @@ Foam::tmp<Foam::triadField> buildAlignmentField(const T& mesh)
( (
new triadField(mesh.vertexCount(), triad::unset) new triadField(mesh.vertexCount(), triad::unset)
); );
triadField& alignments = tAlignments(); triadField& alignments = tAlignments.ref();
for for
( (
@ -188,7 +188,7 @@ Foam::tmp<Foam::pointField> buildPointField(const T& mesh)
( (
new pointField(mesh.vertexCount(), point(GREAT, GREAT, GREAT)) new pointField(mesh.vertexCount(), point(GREAT, GREAT, GREAT))
); );
pointField& points = tPoints(); pointField& points = tPoints.ref();
for for
( (

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "DelaunayMesh.H" #include "DelaunayMesh.H"
#include "polyMesh.H"
#include "labelPair.H" #include "labelPair.H"
#include "PrintTable.H" #include "PrintTable.H"
#include "pointIOField.H" #include "pointIOField.H"

View File

@ -35,7 +35,7 @@ Foam::tmp<Foam::Field<Type>> Foam::smoothAlignmentSolver::filterFarPoints
) )
{ {
tmp<Field<Type>> tNewField(new Field<Type>(field.size())); tmp<Field<Type>> tNewField(new Field<Type>(field.size()));
Field<Type>& newField = tNewField(); Field<Type>& newField = tNewField.ref();
label added = 0; label added = 0;
label count = 0; label count = 0;

View File

@ -4,20 +4,35 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for compilation (at least for error catching) # Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
export COMPILE_FLAGS='' unset COMP_FLAGS LINK_FLAGS
export LINK_FLAGS=''
if [ -f "${FOAM_LIBBIN}/libSloanRenumber.so" ] if [ -f "${FOAM_LIBBIN}/libSloanRenumber.so" ]
then then
echo "Found libSloanRenumber.so -- enabling Sloan renumbering support." echo " found libSloanRenumber -- enabling sloan renumbering support."
export LINK_FLAGS="${LINK_FLAGS} -lSloanRenumber" export LINK_FLAGS="${LINK_FLAGS} -lSloanRenumber"
fi fi
if [ -f "${ZOLTAN_ARCH_PATH}/lib/libzoltan.a" -a -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ] if [ -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ]
then then
echo "Found libzoltanRenumber.so -- enabling zoltan renumbering support." if [ -z "$ZOLTAN_ARCH_PATH" ]
export COMPILE_FLAGS="-DFOAM_USE_ZOLTAN" then
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan" # Optional: get ZOLTAN_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan)
then
. $settings
fi
fi
for libdir in lib "lib${WM_COMPILER_LIB_ARCH}"
do
if [ -f "$ZOLTAN_ARCH_PATH/$libdir/libzoltan.a" ]
then
echo " found libzoltanRenumber -- enabling zoltan renumbering support."
export COMP_FLAGS="-DFOAM_USE_ZOLTAN"
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L$ZOLTAN_ARCH_PATH/$libdir -lzoltan"
break
fi
done
fi fi
wmake $targetType wmake $targetType

View File

@ -23,7 +23,7 @@ if (!fieldsToUse.found(fieldName))
).typeHeaderOk<volScalarField>(false, false) ).typeHeaderOk<volScalarField>(false, false)
); );
if (variableGood) if (!variableGood)
{ {
break; break;
} }

View File

@ -25,6 +25,14 @@ canBuildPlugin()
return 1 return 1
} }
[ -d "$ParaView_INCLUDE_DIR" ] && \
[ -f "$ParaView_INCLUDE_DIR/pqServerManagerModel.h" ] || {
echo "==> cannot build ParaView plugins without an include directory"
echo " ... or without GUI support"
echo " ParaView_INCLUDE_DIR=$ParaView_INCLUDE_DIR"
return 1
}
type cmake > /dev/null 2>&1 || { type cmake > /dev/null 2>&1 || {
echo "==> cannot build ParaView plugins without cmake" echo "==> cannot build ParaView plugins without cmake"
return 1 return 1

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -106,21 +106,12 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
fileName dictName(runTime.system()/"noiseDict"); const word dictName("noiseDict");
if (args.optionFound("dict")) #include "setSystemRunTimeDictionaryIO.H"
{
dictName = args["dict"];
}
IOdictionary dict Info<< "Reading " << dictName << "\n" << endl;
(
IOobject IOdictionary dict(dictIO);
(
dictName.expand(),
runTime,
IOobject::MUST_READ
)
);
autoPtr<noiseModel> model(noiseModel::New(dict)); autoPtr<noiseModel> model(noiseModel::New(dict));
model->calculate(); model->calculate();

View File

@ -3,165 +3,314 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2008-2011, 2017-2018 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# | Copyright (C) 2011-2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM, licensed under GNU General Public License
# # <http://www.gnu.org/licenses/>.
# 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 # Script
# foamEtcFile # foamEtcFile
# #
# Description # Description
# Locate user/group/shipped file with semantics similar to the # Locate user/group/other file as per '#includeEtc'.
# ~OpenFOAM/fileName expansion.
# #
# The -mode option can be used to allow chaining from # The -mode option can be used to allow chaining from personal settings
# personal settings to site-wide settings. # to site-wide settings.
# #
# For example, within the user ~/.OpenFOAM/<VER>/prefs.sh: # For example, within the user ~/.OpenFOAM/<VER>/config.sh/compiler:
# \code # \code
# foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh` \ # eval $(foamEtcFile -sh -mode=go config.sh/compiler)
# && _foamSource $foamPrefs
# \endcode # \endcode
# #
# The -mode option is similarly used within etc/{bashrc,cshrc} to ensure
# that system prefs are respected:
# \code
# eval $(foamEtcFile -sh -mode=o prefs.sh)
# eval $(foamEtcFile -sh -mode=ug prefs.sh)
# \endcode
#
# Environment
# - WM_PROJECT: (unset defaults to OpenFOAM)
# - WM_PROJECT_SITE: (unset defaults to PREFIX/site)
# - WM_PROJECT_VERSION: (unset defaults to detect from path)
#
# Note # Note
# This script must exist in $FOAM_INST_DIR/OpenFOAM-<VERSION>/bin/ # This script must exist in one of these locations:
# or $FOAM_INST_DIR/openfoam<VERSION>/bin/ (for the debian version) # - $WM_PROJECT_INST_DIR/OpenFOAM-<VERSION>/bin
# - $WM_PROJECT_INST_DIR/openfoam-<VERSION>/bin
# - $WM_PROJECT_INST_DIR/openfoam<VERSION>/bin (debian version)
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
usage() { printHelp() {
[ "${optQuiet:-$optSilent}" = true ] && exit 1
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
Usage: ${0##*/} [OPTION] fileName Usage: foamEtcFile [OPTION] fileName [-- args]
${0##*/} [OPTION] -list foamEtcFile [OPTION] [-list|-list-test] [fileName]
options: options:
-all return all files (otherwise stop after the first match) -all (-a) Return all files (otherwise stop after the first match)
-list list the directories to be searched -list (-l) List directories or files to be checked
-mode <mode> any combination of u(user), g(group), o(other) -list-test List (existing) directories or files to be checked
-prefix <dir> specify an alternative installation prefix -mode=MODE Any combination of u(user), g(group), o(other)
-quiet suppress all normal output -prefix=DIR Specify an alternative installation prefix
-silent suppress all stderr output -version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...)
-version <ver> specify an alternative OpenFOAM version -csh Produce 'source FILE' output for a csh eval
in the form Maj.Min.Rev (eg, 1.7.0) -sh Produce '. FILE' output for a sh eval
-help print the usage -csh-verbose As per -csh, with additional verbosity
-sh-verbose As per -sh, with additional verbosity
-config Add config directory prefix for shell type:
with -csh* for a config.csh/ prefix
with -sh* for a config.sh/ prefix
-show-api Print api value from wmake/rules, or meta-info and exit
-show-patch Print patch value from meta-info and exit
-quiet (-q) Suppress all normal output
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
-help Print the usage
Locate user/group/shipped file with semantics similar to the Locate user/group/other file as per '#includeEtc'
~OpenFOAM/fileName expansion.
The options can also be specified as a single character Do not group single character options.
(eg, '-q' instead of '-quiet'), but must not be grouped. Equivalent options:
| -mode=MODE | -mode MODE | -m MODE
| -prefix=DIR | -prefix DIR | -p DIR
| -version=VER | -version VER | -v VER
Exit status Exit status
0 when the file is found. Print resolved path to stdout. 0 when the file is found. Print resolved path to stdout.
1 for miscellaneous errors. 1 for miscellaneous errors.
2 when the file is not found. 2 when the file is not found.
USAGE USAGE
exit 0 # A clean exit
}
unset optQuiet optSilent
# Report error and exit
die()
{
[ "${optQuiet:-$optSilent}" = true ] && exit 1
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See 'foamEtcFile -help' for usage"
echo
exit 1 exit 1
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
binDir="${0%/*}" # The bin dir
projectDir="${binDir%/bin}" # The project dir
prefixDir="${projectDir%/*}" # The prefix dir (same as $WM_PROJECT_INST_DIR)
# the bin dir: # Could not resolve projectDir, prefixDir? (eg, called as ./bin/foamEtcFile)
binDir="${0%/*}" if [ "$prefixDir" = "$projectDir" ]
then
binDir="$(cd $binDir && pwd -L)"
projectDir="${binDir%/bin}"
prefixDir="${projectDir%/*}"
fi
projectDirName="${projectDir##*/}" # The project directory name
# the project dir: projectVersion="$WM_PROJECT_VERSION" # Empty? - will be treated later
projectDir="${binDir%/bin}" userDir="$HOME/.OpenFOAM" # Hard-coded as per foamVersion.H
# the prefix dir (same as $FOAM_INST_DIR): #-------------------------------------------------------------------------------
prefixDir="${projectDir%/*}"
# the name used for the project directory
projectDirName="${projectDir##*/}"
# version number used for debian packaging
unset versionNum
# Guess project version or simply get the stem part of the projectDirName.
# Handle standard and debian naming conventions.
# #
# handle standard and debian naming convention # - projectVersion: update unless already set
# #
case "$projectDirName" in # Helper variables:
OpenFOAM-*) # standard naming convention OpenFOAM-<VERSION> # - dirBase (for reassembling name) == projectDirName without the version
version="${projectDirName##OpenFOAM-}" # - versionNum (debian packaging)
;; unset dirBase versionNum
guessVersion()
{
local version
openfoam[0-9]* | openfoam-dev) # debian naming convention 'openfoam<VERSION>' case "$projectDirName" in
versionNum="${projectDirName##openfoam}" (OpenFOAM-* | openfoam-*)
case "$versionNum" in # Standard naming: OpenFOAM-<VERSION> or openfoam-<VERSION>
??) # convert 2 digit version number to decimal delineated dirBase="${projectDirName%%-*}-"
version=$(echo "$versionNum" | sed -e 's@\(.\)\(.\)@\1.\2@') version="${projectDirName#*-}"
version="${version%%*-}" # Extra safety, eg openfoam-version-packager
;; ;;
???) # convert 3 digit version number to decimal delineated
version=$(echo "$versionNum" | sed -e 's@\(.\)\(.\)\(.\)@\1.\2.\3@') (openfoam[0-9]*)
# Debian naming: openfoam<VERSION>
dirBase="openfoam"
version="${projectDirName#openfoam}"
versionNum="$version"
# Convert digits version number to decimal delineated
case "${#versionNum}" in (2|3|4)
version=$(echo "$versionNum" | sed -e 's@\([0-9]\)@\1.@g')
version="${version%.}"
;;
esac
# Ignore special treatment if no decimals were inserted.
[ "${#version}" -gt "${#versionNum}" ] || unset versionNum
;; ;;
????) # convert 4 digit version number to decimal delineated
version=$(echo "$versionNum" | sed -e 's@\(.\)\(.\)\(.\)\(.\)@\1.\2.\3.\4@') (*)
;; die "unknown/unsupported naming convention for '$projectDirName'"
*) # failback - use current environment setting
version="$WM_PROJECT_VERSION"
;; ;;
esac esac
;;
*) # Set projectVersion if required
echo "Error : unknown/unsupported naming convention" : ${projectVersion:=$version}
exit 1 }
;;
esac
# default mode is 'ugo' # Set projectVersion and update versionNum, projectDirName accordingly
mode=ugo setVersion()
unset optAll optList optQuiet optSilent {
projectVersion="$1"
# parse options # Need dirBase when reassembling projectDirName
[ -n "$dirBase" ] || guessVersion
# Debian: update x.y.z -> xyz version
if [ -n "$versionNum" ]
then
versionNum=$(echo "$projectVersion" | sed -e 's@\.@@g')
fi
projectDirName="$dirBase${versionNum:-$projectVersion}"
}
#-------------------------------------------------------------------------------
# The API locations. See wmake/wmakeBuildInfo
rulesFile="$projectDir/wmake/rules/General/general"
metaInfoDir="$projectDir/META-INFO"
# Get api from rules/General/general
#
# Failure modes:
# - No api information (can't find file etc).
# -> Fatal for building, but could be OK for a stripped down version
#
# Fallback. Get from api-info
#
getApi()
{
local value
value="$(sed -ne '/^ *#/!{ /WM_VERSION.*OPENFOAM=/{ s@^.*OPENFOAM= *\([0-9][0-9]*\).*@\1@p; q }}' $rulesFile 2>/dev/null)"
if [ -z "$value" ] && [ -f "$metaInfoDir/api-info" ]
then
# Fallback. Get from api-info
value="$(sed -ne 's@^ *api *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
fi
if [ -n "$value" ]
then
echo "$value"
else
return 1
fi
}
# Get patch from meta-info / api-info
#
# Failure modes:
# - No patch information (can't find file etc).
#
getPatchLevel()
{
local value
# Fallback. Get from api-info
value="$(sed -ne 's@^ *patch *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
if [ -n "$value" ]
then
echo "$value"
else
return 1
fi
}
#-------------------------------------------------------------------------------
optMode=ugo # Default mode is always 'ugo'
unset shellOutput verboseOutput
unset optAll optConfig optList optVersion
# Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
-h | -help) -h | -help*)
usage printHelp
;;
-show-api)
# Show API and exit
getApi
exit $?
;;
-show-patch)
# Show patch level and exit
getPatchLevel
exit $?
;; ;;
-a | -all) -a | -all)
optAll=true optAll=true
unset shellOutput verboseOutput
;; ;;
-l | -list) -l | -list)
optList=true optList=true
;; ;;
-list-test)
optList='test'
;;
-csh | -sh)
shellOutput="${1#-}"
unset verboseOutput
;;
-csh-verbose | -sh-verbose)
shellOutput="${1#-}"
verboseOutput="source " # Report: "source FILE"
;;
-config)
optConfig=true
;;
-mode=[ugo]*)
optMode="${1#*=}"
;;
-prefix=/*)
prefixDir="${1#*=}"
prefixDir="${prefixDir%/}"
;;
-version=*)
optVersion="${1#*=}"
;;
-m | -mode) -m | -mode)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument" optMode="$2"
mode="$2"
# sanity check:
case "$mode" in
*u* | *g* | *o* )
;;
*)
usage "'$1' option with invalid mode '$mode'"
;;
esac
shift shift
# Sanity check. Handles missing argument too.
case "$optMode" in
([ugo]*)
;;
(*)
die "invalid mode '$optMode'"
;;
esac
;; ;;
-p | -prefix) -p | -prefix)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
prefixDir="$2" prefixDir="${2%/}"
shift shift
;; ;;
-q | -quiet) -q | -quiet)
@ -171,13 +320,8 @@ do
optSilent=true optSilent=true
;; ;;
-v | -version) -v | -version)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
version="$2" optVersion="$2"
# convert x.y.z -> xyz version (if installation looked like debian)
if [ -n "$versionNum" ]
then
versionNum=$(echo "$version" | sed -e 's@\.@@g')
fi
shift shift
;; ;;
--) --)
@ -185,7 +329,7 @@ do
break break
;; ;;
-*) -*)
usage "unknown option: '$*'" die "unknown option: '$1'"
;; ;;
*) *)
break break
@ -194,100 +338,204 @@ do
shift shift
done done
#-------------------------------------------------------------------------------
# debugging: # Split arguments into filename (for searching) and trailing bits for shell eval
# echo "Installed locations:" # Silently remove leading ~OpenFOAM/ (as per Foam::findEtcFile)
# for i in projectDir prefixDir projectDirName version versionNum
# do
# eval echo "$i=\$$i"
# done
# Save the essential bits of information
# silently remove leading ~OpenFOAM/ (used in Foam::findEtcFile)
nArgs=$# nArgs=$#
fileName="${1#~OpenFOAM/}" fileName="${1#~OpenFOAM/}"
unset evalArgs
if [ "$nArgs" -eq 1 ]
then
if [ "$1" = "--" ]
then
nArgs=0
unset fileName
fi
elif [ "$nArgs" -ge 2 ]
then
if [ "$2" = "--" ]
then
nArgs=1
shift 2
evalArgs="$@"
fi
fi
# Get version information
if [ -n "$optVersion" ]
then
setVersion $optVersion
elif [ -z "$projectVersion" ]
then
guessVersion
fi
# Updates:
# - projectDir for changes via -prefix or -version
# - groupDir for changes via -prefix
projectDir="$prefixDir/$projectDirName"
groupDir="${WM_PROJECT_SITE:-$prefixDir/site}"
# Debugging:
# echo "Installed locations:" 1>&2
# for i in projectDir prefixDir projectDirName projectVersion
# do
# eval echo "$i=\$$i" 1>&2
# done
# Define the various places to be searched: # Define the various places to be searched:
unset dirList unset dirList
case "$mode" in case "$optMode" in (*u*) # (U)ser
*u*) # user dirList="$dirList $userDir/$projectVersion $userDir"
userDir="$HOME/.${WM_PROJECT:-OpenFOAM}"
dirList="$dirList $userDir/$version $userDir"
;; ;;
esac esac
case "$mode" in case "$optMode" in (*g*) # (G)roup == site
*g*) # group (site) dirList="$dirList $groupDir/$projectVersion $groupDir"
siteDir="${WM_PROJECT_SITE:-$prefixDir/site}"
dirList="$dirList $siteDir/$version $siteDir"
;; ;;
esac esac
case "$mode" in case "$optMode" in (*o*) # (O)ther == shipped
*o*) # other (shipped) dirList="$dirList $projectDir/etc"
if [ -n "$versionNum" ]
then
# debian packaging
dirList="$dirList $prefixDir/openfoam$versionNum/etc"
else
# standard packaging
dirList="$dirList $prefixDir/${WM_PROJECT:-OpenFOAM}-$version/etc"
fi
;; ;;
esac esac
set -- $dirList set -- $dirList
[ "$#" -ge 1 ] || die "No directories to scan. Programming error?"
exitCode=2 # Fallback is a FileNotFound error
#
# Preliminaries
#
# Special handling of config.sh/ , config.csh/ directories
if [ -n "$optConfig" -a -n "$shellOutput" -a -n "$fileName" ]
then
case "$shellOutput" in
csh*)
optConfig="config.csh/"
;;
sh*)
optConfig="config.sh/"
;;
*)
unset optConfig
;;
esac
if [ -n "$optConfig" ]
then
case "$fileName" in
/* | config.csh* | config.sh*)
# Does not need or cannot add a prefix
unset optConfig
;;
*)
fileName="$optConfig$fileName"
;;
esac
fi
fi
# #
# The main routine # The main routine
# #
exitCode=0 if [ -n "$optList" ]
if [ "$optList" = true ]
then then
# list directories, or potential file locations # List directories, or potential file locations
[ "$nArgs" -le 1 ] || usage [ "$nArgs" -le 1 ] || \
die "-list options expect 0 or 1 filename, but $nArgs provided"
# a silly combination, but -quiet does have precedence # A silly combination, but -quiet has absolute precedence
[ "$optQuiet" = true ] && exit 0 [ -n "$optQuiet" ] && exit 0
for dir # Test for directory or file too?
do if [ "$optList" = "test" ]
then
if [ "$nArgs" -eq 1 ] if [ "$nArgs" -eq 1 ]
then then
echo "$dir/$fileName" for dir
do
resolved="$dir/$fileName"
if [ -f "$resolved" ]
then
echo "$resolved"
exitCode=0 # OK
fi
done
else else
echo "$dir" for dir
do
if [ -d "$dir" ]
then
echo "$dir"
exitCode=0 # OK
fi
done
fi fi
done else
exitCode=0 # OK, already verified that $# != 0
for dir
do
echo "$dir${fileName:+/}$fileName"
done
fi
else else
[ "$nArgs" -eq 1 ] || usage [ "$nArgs" -eq 1 ] || die "One filename expected - $nArgs provided"
# general error, eg file not found # Output for sourcing files ("source" for csh, "." for POSIX shell)
exitCode=2 # Only allow sourcing a single file (disallow combination with -all)
case "$shellOutput" in
csh*)
shellOutput="source " # eg, "source FILE"
;;
sh*)
shellOutput=". " # eg, ". FILE"
;;
esac
# Anti-pattern: -all disables shell commands
if [ -n "$optAll" ]
then
unset shellOutput verboseOutput
fi
for dir for dir
do do
if [ -f "$dir/$fileName" ] resolved="$dir/$fileName"
if [ -f "$resolved" ]
then then
exitCode=0 exitCode=0 # OK
if [ "$optQuiet" = true ] if [ -n "$optQuiet" ]
then then
break break
else elif [ -n "$verboseOutput" ]
echo "$dir/$fileName" then
[ "$optAll" = true ] || break echo "$verboseOutput$resolved" 1>&2
fi fi
if [ -n "$shellOutput" ]
then
echo "$shellOutput$resolved $evalArgs"
else
echo "$resolved"
fi
[ -n "$optAll" ] || break
fi fi
done done
fi fi
exit $exitCode exit $exitCode
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -148,8 +148,9 @@ runParallel()
# Store any parsed additional arguments e.g. decomposeParDict # Store any parsed additional arguments e.g. decomposeParDict
APP_PARARGS= APP_PARARGS=
# Check the default decomposeParDict if available
nProcs=$(getNumberOfProcessors system/decomposeParDict) # Initialise number of procs to unset value
nProcs=-1
# Parse options and executable # Parse options and executable
while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do while [ $# -gt 0 ] && [ -z "$APP_RUN" ]; do
@ -185,6 +186,8 @@ runParallel()
shift shift
done done
[ "$nProcs" -eq -1 ] && nProcs=$(getNumberOfProcessors system/decomposeParDict)
if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ] if [ -f log.$LOG_SUFFIX ] && [ "$LOG_IGNORE" = "false" ]
then then
echo "$APP_NAME already run on $PWD:" \ echo "$APP_NAME already run on $PWD:" \
@ -213,7 +216,7 @@ cloneCase()
else else
echo "Cloning $2 case from $1" echo "Cloning $2 case from $1"
mkdir $2 mkdir $2
cpfiles="0 system constant" cpfiles="0.orig 0 system constant"
for f in $cpfiles for f in $cpfiles
do do
\cp -r $1/$f $2 \cp -r $1/$f $2

View File

@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -55,6 +55,7 @@ usage: ${0##*/}
-metis-path dir specify 'METIS_ARCH_PATH' -metis-path dir specify 'METIS_ARCH_PATH'
-paraview ver specify 'ParaView_VERSION' (eg, 5.0.1) -paraview ver specify 'ParaView_VERSION' (eg, 5.0.1)
-paraview-path dir specify 'ParaView_DIR' (eg, /opt/paraviewopenfoam3120) -paraview-path dir specify 'ParaView_DIR' (eg, /opt/paraviewopenfoam3120)
-mpi name specify type for 'WM_MPLIB' (eg, FJMPI, INTELMPI, etc)
-openmpi ver specify ThirdParty openmpi version for 'FOAM_MPI' -openmpi ver specify ThirdParty openmpi version for 'FOAM_MPI'
-openmpi-system activate system openmpi -openmpi-system activate system openmpi
-openmpi-third activate ThirdParty openmpi (using default version) -openmpi-third activate ThirdParty openmpi (using default version)
@ -338,6 +339,15 @@ do
shift shift
;; ;;
-mpi)
# Explicitly set WM_MPLIB=...
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
replace etc/bashrc WM_MPLIB "$2"
optMpi=system
adjusted=true
shift
;;
-openmpi) -openmpi)
# Replace FOAM_MPI=openmpi-<digits>.. and set to use third-party # Replace FOAM_MPI=openmpi-<digits>.. and set to use third-party
# The edit is slightly fragile, but works # The edit is slightly fragile, but works

View File

@ -42,7 +42,8 @@ export WM_PROJECT_VERSION=plus
# #
# Please set to the appropriate path if the default is not correct. # Please set to the appropriate path if the default is not correct.
# #
[ $BASH_SOURCE ] && FOAM_INST_DIR=$(\cd ${BASH_SOURCE%/*/*/*} && \pwd -P) || \ rc="${BASH_SOURCE:-${ZSH_NAME:+$0}}"
[ -n "$rc" ] && FOAM_INST_DIR=$(\cd $(dirname $rc)/../.. && \pwd -L) || \
FOAM_INST_DIR=$HOME/$WM_PROJECT FOAM_INST_DIR=$HOME/$WM_PROJECT
# FOAM_INST_DIR=~$WM_PROJECT # FOAM_INST_DIR=~$WM_PROJECT
# FOAM_INST_DIR=/opt/$WM_PROJECT # FOAM_INST_DIR=/opt/$WM_PROJECT
@ -61,7 +62,7 @@ export FOAM_INST_DIR
export WM_COMPILER_TYPE=system export WM_COMPILER_TYPE=system
#- Compiler: #- Compiler:
# WM_COMPILER = Gcc | Gcc4[8-9] | Gcc5[1-4] | Gcc6[1-2] | Clang | Icc # WM_COMPILER = Gcc | Gcc4[8-9] | Gcc5[1-4] | Gcc6[1-2] | Clang | Icc | IccKNL
export WM_COMPILER=Gcc export WM_COMPILER=Gcc
unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH
@ -135,8 +136,10 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. $WM_PROJECT_DIR/etc/config.sh/functions . $WM_PROJECT_DIR/etc/config.sh/functions
# Add in preset user or site preferences: # Override definitions via prefs, with 'other' first so the sys-admin
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` # can provide base values independent of WM_PROJECT_SITE
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -mode o prefs.sh`
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -mode ug prefs.sh`
# Evaluate command-line parameters and record settings for later # Evaluate command-line parameters and record settings for later
# these can be used to set/unset values, or specify alternative pref files # these can be used to set/unset values, or specify alternative pref files

View File

@ -71,8 +71,15 @@ case OPENMPI:
_foamAddMan $MPI_ARCH_PATH/share/man _foamAddMan $MPI_ARCH_PATH/share/man
breaksw breaksw
case USERMPI:
# Use an arbitrary, user-specified mpi implementation
setenv FOAM_MPI mpi-user
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/mpi-user`
breaksw
case SYSTEMMPI: case SYSTEMMPI:
setenv FOAM_MPI mpi-system setenv FOAM_MPI mpi-system
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/mpi-system`
if ( ! ($?MPI_ROOT) ) then if ( ! ($?MPI_ROOT) ) then
echo echo

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -60,11 +60,15 @@ set cmake_version=cmake-system
if ( ! $?ParaView_DIR ) setenv ParaView_DIR if ( ! $?ParaView_DIR ) setenv ParaView_DIR
# Clean the PATH # Clean PATH and LD_LIBRARY_PATH
if ( ! $?ParaView_DIR ) setenv ParaView_DIR set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-"`
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
if ( $status == 0 ) setenv PATH $cleaned if ( $status == 0 ) setenv PATH $cleaned
if ( $?LD_LIBRARY_PATH ) then
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$LD_LIBRARY_PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
endif
# ThirdParty cmake # ThirdParty cmake
set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake_version set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake_version
if ( -r $cmake/bin/cmake ) then if ( -r $cmake/bin/cmake ) then

View File

@ -137,7 +137,7 @@ endsw
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Location of the jobControl directory # Location of the jobControl directory
setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl setenv FOAM_JOB_DIR "$HOME/.OpenFOAM/jobControl"
# wmake configuration # wmake configuration
setenv WM_DIR $WM_PROJECT_DIR/wmake setenv WM_DIR $WM_PROJECT_DIR/wmake
@ -196,8 +196,11 @@ endif
unset siteDir unset siteDir
_foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN} _foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
# Make sure to pick up dummy versions of external libraries last _foamAddLib $FOAM_LIBBIN/dummy # Dummy versions of external libraries last
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_EXT_LIBBIN}:${FOAM_LIBBIN}/dummy if ( $?FOAM_EXT_LIBBIN ) then # External libraries (allowed to be unset)
_foamAddLib $FOAM_EXT_LIBBIN
endif
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}
# Compiler settings # Compiler settings
# ~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~

View File

@ -75,8 +75,15 @@ OPENMPI)
_foamAddMan $MPI_ARCH_PATH/share/man _foamAddMan $MPI_ARCH_PATH/share/man
;; ;;
USERMPI)
# Use an arbitrary, user-specified mpi implementation
export FOAM_MPI=mpi-user
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/mpi-user`
;;
SYSTEMMPI) SYSTEMMPI)
export FOAM_MPI=mpi-system export FOAM_MPI=mpi-system
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/mpi-system`
if [ -z "$MPI_ROOT" ] if [ -z "$MPI_ROOT" ]
then then

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -61,13 +61,20 @@ cmake_version=cmake-system
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Clean the PATH # Clean PATH and LD_LIBRARY_PATH
cleaned=$($WM_PROJECT_DIR/bin/foamCleanPath "$PATH" \ cleaned=$($WM_PROJECT_DIR/bin/foamCleanPath "$PATH" \
"$ParaView_DIR \
$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- \
$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-" \
) && PATH="$cleaned"
if [ -n "$LD_LIBRARY_PATH" ]
then
cleaned=$($WM_PROJECT_DIR/bin/foamCleanPath "$LD_LIBRARY_PATH" \
"$ParaView_DIR \ "$ParaView_DIR \
$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- \ $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-" \
$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-" \ ) && LD_LIBRARY_PATH="$cleaned"
) \ fi
&& PATH="$cleaned"
# ThirdParty cmake # ThirdParty cmake
cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake_version cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake_version

View File

@ -141,7 +141,7 @@ esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Location of the jobControl directory # Location of the jobControl directory
export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl export FOAM_JOB_DIR="$HOME/.OpenFOAM/jobControl"
# wmake configuration # wmake configuration
export WM_DIR=$WM_PROJECT_DIR/wmake export WM_DIR=$WM_PROJECT_DIR/wmake
@ -198,8 +198,12 @@ fi
unset siteDir unset siteDir
_foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN _foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
# Make sure to pick up dummy versions of external libraries last _foamAddLib $FOAM_LIBBIN/dummy # Dummy versions of external libraries last
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy if [ -n "$FOAM_EXT_LIBBIN" ] # External libraries (allowed to be unset)
then
_foamAddLib $FOAM_EXT_LIBBIN
fi
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN
# Compiler settings # Compiler settings
# ~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~

View File

@ -60,7 +60,7 @@ setenv FOAM_INST_DIR `lsof +p $$ |& grep -oE '/.*'$WM_PROJECT'[^/]*/etc/cshrc' |
setenv WM_COMPILER_TYPE system setenv WM_COMPILER_TYPE system
#- Compiler: #- Compiler:
# WM_COMPILER = Gcc | Gcc4[8-9] | Gcc5[1-4] | Gcc6[1-2] | Clang | Icc # WM_COMPILER = Gcc | Gcc4[8-9] | Gcc5[1-4] | Gcc6[1-2] | Clang | Icc | IccKNL
setenv WM_COMPILER Gcc setenv WM_COMPILER Gcc
setenv WM_COMPILER_ARCH # defined but empty setenv WM_COMPILER_ARCH # defined but empty
unsetenv WM_COMPILER_LIB_ARCH unsetenv WM_COMPILER_LIB_ARCH
@ -148,8 +148,10 @@ setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
# Source files, possibly with some verbosity # Source files, possibly with some verbosity
alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* != "") source \!*' alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* != "") source \!*'
# Add in preset user or site preferences: # Override definitions via prefs, with 'other' first so the sys-admin
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh` # can provide base values independent of WM_PROJECT_SITE
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -mode o prefs.csh`
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -mode ug prefs.csh`
# Evaluate command-line parameters and record settings for later # Evaluate command-line parameters and record settings for later
# these can be used to set/unset values, or specify alternative pref files # these can be used to set/unset values, or specify alternative pref files

View File

@ -43,4 +43,8 @@ namespace Foam
using ISLList = ILList<SLListBase, T>; using ISLList = ILList<SLListBase, T>;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -64,7 +64,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
} }
else if (firstToken.isLabel()) else if (firstToken.isLabel())
{ {
label s = firstToken.labelToken(); const label s = firstToken.labelToken();
// Set list length to that read // Set list length to that read
L.setSize(s); L.setSize(s);

View File

@ -183,7 +183,7 @@ bool Foam::UList<T>::operator<(const UList<T>& a) const
( (
const_iterator vi = begin(), ai = a.begin(); const_iterator vi = begin(), ai = a.begin();
vi < end() && ai < a.end(); vi < end() && ai < a.end();
vi++, ai++ ++vi, ++ai
) )
{ {
if (*vi < *ai) if (*vi < *ai)

View File

@ -427,7 +427,7 @@ inline void reverse(UList<T>&);
// \endcode // \endcode
// \sa forAllReverse // \sa forAllReverse
#define forAll(list, i) \ #define forAll(list, i) \
for (Foam::label i=0; i<(list).size(); i++) for (Foam::label i=0; i<(list).size(); ++i)
//- Reverse loop across all elements in \a list //- Reverse loop across all elements in \a list
// \par Usage // \par Usage
@ -439,7 +439,7 @@ inline void reverse(UList<T>&);
// \endcode // \endcode
// \sa forAll // \sa forAll
#define forAllReverse(list, i) \ #define forAllReverse(list, i) \
for (Foam::label i=(list).size()-1; i>=0; i--) for (Foam::label i=(list).size()-1; i>=0; --i)
//- Iterate across all elements in the \a container object of type //- Iterate across all elements in the \a container object of type
// \a Container. // \a Container.
@ -472,8 +472,8 @@ inline void reverse(UList<T>&);
#define forAllConstIter(Container,container,iter) \ #define forAllConstIter(Container,container,iter) \
for \ for \
( \ ( \
Container::const_iterator iter = (container).begin(); \ Container::const_iterator iter = (container).cbegin(); \
iter != (container).end(); \ iter != (container).cend(); \
++iter \ ++iter \
) )

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,7 +33,7 @@ template<class T>
inline Foam::UList<T>::UList() inline Foam::UList<T>::UList()
: :
size_(0), size_(0),
v_(0) v_(nullptr)
{} {}
@ -321,7 +321,7 @@ inline bool Foam::UList<T>::empty() const
template<class T> template<class T>
inline void Foam::reverse(UList<T>& ul, const label n) inline void Foam::reverse(UList<T>& ul, const label n)
{ {
for (int i=0; i<n/2; i++) for (int i=0; i<n/2; ++i)
{ {
Swap(ul[i], ul[n-1-i]); Swap(ul[i], ul[n-1-i]);
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -165,7 +165,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
) )
); );
// Check list length // Check list length
label s = elems.size(); const label s = elems.size();
if (s != L.size()) if (s != L.size())
{ {
@ -174,14 +174,14 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
<< " expected " << L.size() << " expected " << L.size()
<< exit(FatalIOError); << exit(FatalIOError);
} }
for (label i=0; i<s; i++) for (label i=0; i<s; ++i)
{ {
L[i] = elems[i]; L[i] = elems[i];
} }
} }
else if (firstToken.isLabel()) else if (firstToken.isLabel())
{ {
label s = firstToken.labelToken(); const label s = firstToken.labelToken();
// Set list length to that read // Set list length to that read
if (s != L.size()) if (s != L.size())
@ -203,7 +203,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
{ {
if (delimiter == token::BEGIN_LIST) if (delimiter == token::BEGIN_LIST)
{ {
for (label i=0; i<s; i++) for (label i=0; i<s; ++i)
{ {
is >> L[i]; is >> L[i];
@ -226,7 +226,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
"reading the single entry" "reading the single entry"
); );
for (label i=0; i<s; i++) for (label i=0; i<s; ++i)
{ {
L[i] = element; L[i] = element;
} }
@ -281,7 +281,7 @@ Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
( (
typename SLList<T>::const_iterator iter = sll.begin(); typename SLList<T>::const_iterator iter = sll.begin();
iter != sll.end(); iter != sll.end();
++iter ++iter, ++i
) )
{ {
L[i] = iter(); L[i] = iter();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,27 +43,35 @@ static const unsigned char base64Chars[64] =
//! \endcond //! \endcond
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
std::size_t Foam::base64Layer::encodedLength(std::size_t n)
{
return 4 * ((n / 3) + (n % 3 ? 1 : 0));
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
inline unsigned char Foam::base64Layer::encode0() inline unsigned char Foam::base64Layer::encode0() const
{ {
// Top 6 bits of char0 // Top 6 bits of char0
return base64Chars[((group_[0] & 0xFC) >> 2)]; return base64Chars[((group_[0] & 0xFC) >> 2)];
} }
inline unsigned char Foam::base64Layer::encode1() inline unsigned char Foam::base64Layer::encode1() const
{ {
// Bottom 2 bits of char0, Top 4 bits of char1 // Bottom 2 bits of char0, Top 4 bits of char1
return base64Chars[((group_[0] & 0x03) << 4) | ((group_[1] & 0xF0) >> 4)]; return base64Chars[((group_[0] & 0x03) << 4) | ((group_[1] & 0xF0) >> 4)];
} }
inline unsigned char Foam::base64Layer::encode2() inline unsigned char Foam::base64Layer::encode2() const
{ {
// Bottom 4 bits of char1, Top 2 bits of char2 // Bottom 4 bits of char1, Top 2 bits of char2
return base64Chars[((group_[1] & 0x0F) << 2) | ((group_[2] & 0xC0) >> 6)]; return base64Chars[((group_[1] & 0x0F) << 2) | ((group_[2] & 0xC0) >> 6)];
} }
inline unsigned char Foam::base64Layer::encode3() inline unsigned char Foam::base64Layer::encode3() const
{ {
// Bottom 6 bits of char2 // Bottom 6 bits of char2
return base64Chars[(group_[2] & 0x3F)]; return base64Chars[(group_[2] & 0x3F)];

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,7 +30,7 @@ Description
Base64 encoding accoding to RFC 4648 specification Base64 encoding accoding to RFC 4648 specification
(https://tools.ietf.org/html/rfc4648#page-5). (https://tools.ietf.org/html/rfc4648#page-5).
It is the obligation of the caller to avoid using normal output It is the obligation of the caller to avoid using normal output
while the base-64 encoding layer is actively being used. while the base-64 encoding layer is actively used.
SourceFiles SourceFiles
base64Layer.C base64Layer.C
@ -70,10 +70,10 @@ class base64Layer
// Private Member Functions // Private Member Functions
inline unsigned char encode0(); inline unsigned char encode0() const;
inline unsigned char encode1(); inline unsigned char encode1() const;
inline unsigned char encode2(); inline unsigned char encode2() const;
inline unsigned char encode3(); inline unsigned char encode3() const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
base64Layer(const base64Layer&) = delete; base64Layer(const base64Layer&) = delete;
@ -95,7 +95,7 @@ public:
// Constructors // Constructors
//- Construct and attach to an output stream //- Construct and attach to an output stream
base64Layer(std::ostream&); base64Layer(std::ostream& os);
//- Destructor //- Destructor
@ -104,6 +104,10 @@ public:
// Member Functions // Member Functions
//- The encoded length has 4 bytes out for every 3 bytes in.
static std::size_t encodedLength(std::size_t n);
//- Encode the character sequence, writing when possible. //- Encode the character sequence, writing when possible.
void write(const char* s, std::streamsize n); void write(const char* s, std::streamsize n);
@ -111,7 +115,7 @@ public:
void reset(); void reset();
//- End the encoding sequence, padding the final characters with '='. //- End the encoding sequence, padding the final characters with '='.
// Return false if no encoding layer was actually used. // Return false if no encoding was actually performed.
bool close(); bool close();
}; };

View File

@ -32,7 +32,7 @@ Description
Note: cannot access the state dictionary until after construction of the Note: cannot access the state dictionary until after construction of the
function objects, since the owner container functionObjectList is owned function objects, since the owner container functionObjectList is owned
by time, and time owns the state dictionary. I.e. need to wait for time by time, and time owns the state dictionary. I.e. need to wait for time
to be fully consttucted. to be fully constructed.
See also See also
Foam::functionObject Foam::functionObject

View File

@ -126,7 +126,8 @@ void Foam::timeControl::read(const dictionary& dict)
case ocCpuTime: case ocCpuTime:
case ocAdjustableRunTime: case ocAdjustableRunTime:
{ {
interval_ = readScalar(dict.lookup(intervalName)); const scalar userTime = readScalar(dict.lookup(intervalName));
interval_ = time_.userTimeToTime(userTime);
break; break;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -43,8 +43,15 @@ namespace functionObjects
void Foam::functionObjects::timeControl::readControls() void Foam::functionObjects::timeControl::readControls()
{ {
dict_.readIfPresent("timeStart", timeStart_); if (dict_.readIfPresent("timeStart", timeStart_))
dict_.readIfPresent("timeEnd", timeEnd_); {
timeStart_ = time_.userTimeToTime(timeStart_);
}
if (dict_.readIfPresent("timeEnd", timeEnd_))
{
timeEnd_ = time_.userTimeToTime(timeEnd_);
}
dict_.readIfPresent("nStepsToStartTimeChange", nStepsToStartTimeChange_); dict_.readIfPresent("nStepsToStartTimeChange", nStepsToStartTimeChange_);
} }
@ -52,8 +59,8 @@ void Foam::functionObjects::timeControl::readControls()
bool Foam::functionObjects::timeControl::active() const bool Foam::functionObjects::timeControl::active() const
{ {
return return
time_.value() >= timeStart_ time_.value() >= (timeStart_ - 0.5*time_.deltaTValue())
&& time_.value() <= timeEnd_; && time_.value() <= (timeEnd_ + 0.5*time_.deltaTValue());
} }
@ -186,7 +193,8 @@ bool Foam::functionObjects::timeControl::read
executeControl_.read(dict); executeControl_.read(dict);
readControls(); readControls();
return true; // Forward to underlying function object
return foPtr_->read(dict);
} }
else else
{ {

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,8 +92,9 @@ Foam::autoPtr<Foam::OFstream> Foam::functionObjects::writeFile::createFile
if (Pstream::master() && writeToFile_) if (Pstream::master() && writeToFile_)
{ {
const word startTimeName = const scalar startTime = fileObr_.time().startTime().value();
fileObr_.time().timeName(fileObr_.time().startTime().value()); const scalar userStartTime = fileObr_.time().timeToUserTime(startTime);
const word startTimeName = Time::timeName(userStartTime);
fileName outputDir(baseFileDir()/prefix_/startTimeName); fileName outputDir(baseFileDir()/prefix_/startTimeName);
@ -105,7 +106,7 @@ Foam::autoPtr<Foam::OFstream> Foam::functionObjects::writeFile::createFile
IFstream is(outputDir/(fName + ".dat")); IFstream is(outputDir/(fName + ".dat"));
if (is.good()) if (is.good())
{ {
fName = fName + "_" + fileObr_.time().timeName(); fName = fName + "_" + startTimeName;
} }
osPtr.set(new OFstream(outputDir/(fName + ".dat"))); osPtr.set(new OFstream(outputDir/(fName + ".dat")));
@ -258,7 +259,8 @@ void Foam::functionObjects::writeFile::writeHeader
void Foam::functionObjects::writeFile::writeTime(Ostream& os) const void Foam::functionObjects::writeFile::writeTime(Ostream& os) const
{ {
os << setw(charWidth()) << fileObr_.time().timeName(); const scalar timeNow = fileObr_.time().timeOutputValue();
os << setw(charWidth()) << Time::timeName(timeNow);
} }

View File

@ -51,7 +51,7 @@ namespace functionObjects
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class functionObjectFile Declaration Class writeFile Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class writeFile class writeFile

View File

@ -468,7 +468,7 @@ public:
// \sa addProfiling // \sa addProfiling
// \sa endProfiling // \sa endProfiling
#define addProfiling0(name) \ #define addProfiling0(name) \
::Foam::Profiling::Trigger profilingTriggerFor##name(#name) ::Foam::profiling::Trigger profilingTriggerFor##name(#name)
//- Define profiling with specified name and description correspond to the //- Define profiling with specified name and description correspond to the
// compiler-defined function name string: // compiler-defined function name string:

View File

@ -20,7 +20,7 @@ if (dictPath.size())
{ {
dictIO = IOobject dictIO = IOobject
( (
dictPath, dictPath.expand(),
mesh, mesh,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -20,7 +20,7 @@ if (dictPath.size())
{ {
dictIO = IOobject dictIO = IOobject
( (
dictPath, dictPath.expand(),
runTime, runTime,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -107,25 +107,30 @@ void Foam::GAMGSolver::interpolate
const label nCells = m.diag().size(); const label nCells = m.diag().size();
scalar* __restrict__ psiPtr = psi.begin(); scalar* __restrict__ psiPtr = psi.begin();
const scalar* const __restrict__ diagPtr = m.diag().begin(); const scalar* const __restrict__ diagPtr = m.diag().begin();
const scalar* const __restrict__ psiCPtr = psiC.begin();
const label nCCells = psiC.size(); const label nCCells = psiC.size();
scalarField corrC(nCCells, 0); scalarField corrC(nCCells, 0);
scalar* __restrict__ corrCPtr = corrC.begin();
scalarField diagC(nCCells, 0); scalarField diagC(nCCells, 0);
scalar* __restrict__ diagCPtr = diagC.begin();
for (label celli=0; celli<nCells; celli++) for (label celli=0; celli<nCells; celli++)
{ {
corrC[restrictAddressing[celli]] += diagPtr[celli]*psiPtr[celli]; corrCPtr[restrictAddressing[celli]] += diagPtr[celli]*psiPtr[celli];
diagC[restrictAddressing[celli]] += diagPtr[celli]; diagCPtr[restrictAddressing[celli]] += diagPtr[celli];
} }
for (label ccelli=0; ccelli<nCCells; ccelli++) for (label ccelli=0; ccelli<nCCells; ccelli++)
{ {
corrC[ccelli] = psiC[ccelli] - corrC[ccelli]/diagC[ccelli]; corrCPtr[ccelli] = psiCPtr[ccelli] - corrCPtr[ccelli]/diagCPtr[ccelli];
} }
for (label celli=0; celli<nCells; celli++) for (label celli=0; celli<nCells; celli++)
{ {
psiPtr[celli] += corrC[restrictAddressing[celli]]; psiPtr[celli] += corrCPtr[restrictAddressing[celli]];
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,13 +48,20 @@ void Foam::GAMGSolver::scale
cmpt cmpt
); );
const label nCells = field.size();
scalar* __restrict__ fieldPtr = field.begin();
const scalar* const __restrict__ sourcePtr = source.begin();
const scalar* const __restrict__ AcfPtr = Acf.begin();
scalar scalingFactorNum = 0.0; scalar scalingFactorNum = 0.0;
scalar scalingFactorDenom = 0.0; scalar scalingFactorDenom = 0.0;
forAll(field, i) for (label i=0; i<nCells; i++)
{ {
scalingFactorNum += source[i]*field[i]; scalingFactorNum += sourcePtr[i]*fieldPtr[i];
scalingFactorDenom += Acf[i]*field[i]; scalingFactorDenom += AcfPtr[i]*fieldPtr[i];
} }
vector2D scalingVector(scalingFactorNum, scalingFactorDenom); vector2D scalingVector(scalingFactorNum, scalingFactorDenom);
@ -68,10 +75,11 @@ void Foam::GAMGSolver::scale
} }
const scalarField& D = A.diag(); const scalarField& D = A.diag();
const scalar* const __restrict__ DPtr = D.begin();
forAll(field, i) for (label i=0; i<nCells; i++)
{ {
field[i] = sf*field[i] + (source[i] - sf*Acf[i])/D[i]; fieldPtr[i] = sf*fieldPtr[i] + (sourcePtr[i] - sf*AcfPtr[i])/DPtr[i];
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -539,7 +539,15 @@ Foam::tmp<Foam::scalarField> Foam::primitiveMeshTools::cellDeterminant
} }
} }
cellDeterminant[celli] = mag(det(areaTensor)); // Note:
// - normalise to be 0..1 (since cube has eigenvalues 2 2 2)
// - we use the determinant (i.e. 3rd invariant) and not e.g.
// condition number (= max ev / min ev) since we are
// interested in the minimum connectivity and not the
// uniformity. Using the condition number on corner cells
// leads to uniformity 1 i.e. equally bad in all three
// directions which is not what we want.
cellDeterminant[celli] = mag(det(areaTensor))/8.0;
} }
} }
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -119,7 +119,7 @@ public:
const pointField& p const pointField& p
); );
//- Generate cell determinant field //- Generate cell determinant field. Normalised to 1 for an internal cube.
static tmp<scalarField> cellDeterminant static tmp<scalarField> cellDeterminant
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,8 +29,6 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::labelRange::const_iterator Foam::labelRange::endIter_;
int Foam::labelRange::debug(::Foam::debug::debugSwitch("labelRange", 0)); int Foam::labelRange::debug(::Foam::debug::debugSwitch("labelRange", 0));
@ -47,13 +45,24 @@ Foam::labelRange::labelRange(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::labelRange::intersects void Foam::labelRange::adjust()
(
const labelRange& range,
const bool touches
) const
{ {
label final = touches ? 1 : 0; if (start_ < 0)
{
size_ += start_;
start_ = 0;
}
if (size_ < 0)
{
size_ = 0;
}
}
bool Foam::labelRange::overlaps(const labelRange& range, bool touches) const
{
const label final = touches ? 1 : 0;
return return
( (
@ -97,7 +106,7 @@ Foam::labelRange Foam::labelRange::join(const labelRange& range) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
Foam::labelRange& Foam::labelRange::operator+=(const labelRange& rhs) void Foam::labelRange::operator+=(const labelRange& rhs)
{ {
if (!size_) if (!size_)
{ {
@ -112,8 +121,6 @@ Foam::labelRange& Foam::labelRange::operator+=(const labelRange& rhs)
start_ = lower; start_ = lower;
size_ = upper - lower + 1; size_ = upper - lower + 1;
} }
return *this;
} }
@ -127,10 +134,10 @@ Foam::Istream& Foam::operator>>(Istream& is, labelRange& range)
is.check("operator>>(Istream&, labelRange&)"); is.check("operator>>(Istream&, labelRange&)");
// disallow invalid sizes // Disallow invalid sizes
if (range.size_ <= 0) if (range.size_ < 0)
{ {
range.clear(); range.size_ = 0;
} }
return is; return is;
@ -139,15 +146,11 @@ Foam::Istream& Foam::operator>>(Istream& is, labelRange& range)
Foam::Ostream& Foam::operator<<(Ostream& os, const labelRange& range) Foam::Ostream& Foam::operator<<(Ostream& os, const labelRange& range)
{ {
// write ASCII only for now // Write ASCII only for now
os << token::BEGIN_LIST os << token::BEGIN_LIST
<< range.start_ << token::SPACE << range.size_ << range.start_ << token::SPACE << range.size_
<< token::END_LIST; << token::END_LIST;
// os << token::BEGIN_BLOCK
// << range.start_ << "-" << range.last()
// << token::END_BLOCK;
os.check("operator<<(Ostream&, const labelRange&)"); os.check("operator<<(Ostream&, const labelRange&)");
return os; return os;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,7 @@ Class
Foam::labelRange Foam::labelRange
Description Description
A label range specifier. A range of labels.
SourceFiles SourceFiles
labelRange.C labelRange.C
@ -47,8 +47,8 @@ class Ostream;
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
class labelRange; class labelRange;
Istream& operator>>(Istream&, labelRange&); Istream& operator>>(Istream& is, labelRange& range);
Ostream& operator<<(Ostream&, const labelRange&); Ostream& operator<<(Ostream& os, const labelRange& range);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class labelRange Declaration Class labelRange Declaration
@ -63,7 +63,7 @@ class labelRange
public: public:
static int debug; static int debug;
// Public classes // Public classes
@ -75,31 +75,50 @@ public:
bool operator()(const labelRange& a, const labelRange& b) bool operator()(const labelRange& a, const labelRange& b)
{ {
return a.first() < b.first(); return a.operator<(b);
} }
}; };
// Constructors // Constructors
//- Construct an empty range //- Construct an empty range with zero as start and size.
inline labelRange(); inline labelRange();
//- Construct a range //- Construct a range from start and size.
// A negative size is autmatically changed to zero. // Optionally adjust the start to avoid any negative indices.
inline labelRange(const label start, const label size); // Always reduce a negative size to zero.
inline labelRange
(
const label start,
const label size,
const bool adjustStart = false
);
//- Construct from Istream. //- Construct from Istream.
labelRange(Istream&); labelRange(Istream& is);
// Member Functions // Member Functions
//- Reset to zero size //- Alias for setSize(const label)
inline void resize(const label n);
//- Adjust size
inline void setSize(const label n);
//- Reset to zero start and zero size
inline void clear(); inline void clear();
//- Is the range empty? //- Is the range empty?
inline bool empty() const; inline bool empty() const;
//- Adjust the start to avoid any negative indices
void adjust();
//- Is the range valid (non-empty)?
inline bool valid() const;
//- Return the effective size of the range //- Return the effective size of the range
inline label size() const; inline label size() const;
@ -109,32 +128,44 @@ public:
//- The (inclusive) upper value of the range //- The (inclusive) upper value of the range
inline label last() const; inline label last() const;
//- Return true if the value is within the range //- Reset start and size.
inline bool contains(const label) const; // Optionally adjust the start to avoid any negative indices.
// Always reduce a negative size to zero.
// Return true if the updated range valid (non-empty).
inline bool reset
(
const label start,
const label size,
const bool adjustStart = false
);
//- Return true if the ranges intersect //- Return true if the value is within the range
inline bool contains(const label value) const;
//- Return true if the ranges overlap.
// Optional test for ranges that also just touch each other // Optional test for ranges that also just touch each other
bool intersects(const labelRange&, const bool touches = false) const; bool overlaps(const labelRange& range, bool touches=false) const;
//- Return a joined range, squashing any gaps in between //- Return a joined range, squashing any gaps in between
// A prior intersects() check can be used to avoid squashing gaps. // A prior overlaps() check can be used to avoid squashing gaps.
labelRange join(const labelRange&) const; labelRange join(const labelRange& range) const;
// Member Operators // Member Operators
//- Return element in range, no bounds checking //- Return element in range, no bounds checking
inline label operator[](const label) const; inline label operator[](const label i) const;
//- Comparison function for sorting, compares the start //- Comparison function for sorting, compares the start.
// If the start values are equal, also compares the size.
inline bool operator<(const labelRange& rhs) const; inline bool operator<(const labelRange& rhs) const;
//- Join ranges, squashing any gaps in between //- Join ranges, squashing any gaps in between
// A prior intersects() check can be used to avoid squashing gaps. // A prior overlaps() check can be used to avoid squashing gaps.
labelRange& operator+=(const labelRange&); void operator+=(const labelRange& rhs);
inline bool operator==(const labelRange&) const; inline bool operator==(const labelRange& rhs) const;
inline bool operator!=(const labelRange&) const; inline bool operator!=(const labelRange& rhs) const;
// STL iterator // STL iterator
@ -142,6 +173,8 @@ public:
//- An STL const_iterator //- An STL const_iterator
class const_iterator class const_iterator
{ {
friend class labelRange;
// Private data // Private data
//- Reference to the range for which this is an iterator //- Reference to the range for which this is an iterator
@ -150,54 +183,48 @@ public:
//- Current index //- Current index
label index_; label index_;
public:
// Constructors // Constructors
//- Construct null - equivalent to an 'end' position //- Construct from range at 'begin' or 'end' position
inline const_iterator(); inline const_iterator
(
//- Construct from range, moving to its 'begin' position const labelRange& range,
inline explicit const_iterator(const labelRange&); const bool endIter = false
);
public:
// Member operators // Member operators
inline bool operator==(const const_iterator&) const; inline bool operator==(const const_iterator& iter) const;
inline bool operator!=(const const_iterator& iter) const;
inline bool operator!=(const const_iterator&) const; inline label operator*() const;
inline label operator()() const;
inline label operator*();
inline label operator()();
inline const_iterator& operator++(); inline const_iterator& operator++();
inline const_iterator operator++(int); inline const_iterator operator++(int);
}; };
//- const_iterator set to the beginning of the range //- A const_iterator set to the beginning of the range
inline const_iterator cbegin() const; inline const_iterator cbegin() const;
//- const_iterator set to beyond the end of the range //- A const_iterator set to beyond the end of the range
inline const const_iterator& cend() const; inline const const_iterator cend() const;
//- const_iterator set to the beginning of the range //- A const_iterator set to the beginning of the range
inline const_iterator begin() const; inline const_iterator begin() const;
//- const_iterator set to beyond the end of the range //- A const_iterator set to beyond the end of the range
inline const const_iterator& end() const; inline const const_iterator end() const;
// IOstream Operators // IOstream Operators
friend Istream& operator>>(Istream&, labelRange&); friend Istream& operator>>(Istream& is, labelRange& range);
friend Ostream& operator<<(Ostream&, const labelRange&); friend Ostream& operator<<(Ostream& os, const labelRange& range);
private:
//- const_iterator returned by end(), cend()
static const const_iterator endIter_;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,32 +33,39 @@ inline Foam::labelRange::labelRange()
{} {}
inline Foam::labelRange::labelRange(const label start, const label size) inline Foam::labelRange::labelRange
(
const label start,
const label size,
const bool adjustStart
)
: :
start_(start), start_(start),
size_(size) size_(size)
{ {
// disallow invalid sizes if (adjustStart)
if (size_ <= 0)
{ {
this->clear(); // Disallow invalid indices and sizes
adjust();
}
else if (size_ < 0)
{
// Disallow invalid sizes
size_ = 0;
} }
} }
// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
inline Foam::labelRange::const_iterator::const_iterator() inline Foam::labelRange::const_iterator::const_iterator
: (
range_(*reinterpret_cast<Foam::labelRange* >(0)), const labelRange& range,
index_(-1) const bool endIter
{} )
inline Foam::labelRange::const_iterator::const_iterator(const labelRange& range)
: :
range_(range), range_(range),
index_(range_.empty() ? -1 : 0) index_(endIter ? range_.size() : 0)
{} {}
@ -76,17 +83,17 @@ inline bool Foam::labelRange::const_iterator::operator!=
const const_iterator& iter const const_iterator& iter
) const ) const
{ {
return !(this->operator==(iter)); return (this->index_ != iter.index_);
} }
inline Foam::label Foam::labelRange::const_iterator::operator*() inline Foam::label Foam::labelRange::const_iterator::operator*() const
{ {
return range_[index_]; return range_[index_];
} }
inline Foam::label Foam::labelRange::const_iterator::operator()() inline Foam::label Foam::labelRange::const_iterator::operator()() const
{ {
return range_[index_]; return range_[index_];
} }
@ -95,12 +102,7 @@ inline Foam::label Foam::labelRange::const_iterator::operator()()
inline Foam::labelRange::const_iterator& inline Foam::labelRange::const_iterator&
Foam::labelRange::const_iterator::operator++() Foam::labelRange::const_iterator::operator++()
{ {
if (++index_ >= range_.size()) ++index_;
{
// equivalent to end iterator
index_ = -1;
}
return *this; return *this;
} }
@ -109,7 +111,7 @@ inline Foam::labelRange::const_iterator
Foam::labelRange::const_iterator::operator++(int) Foam::labelRange::const_iterator::operator++(int)
{ {
const_iterator old = *this; const_iterator old = *this;
this->operator++(); ++index_;
return old; return old;
} }
@ -120,9 +122,9 @@ inline Foam::labelRange::const_iterator Foam::labelRange::cbegin() const
} }
inline const Foam::labelRange::const_iterator& Foam::labelRange::cend() const inline const Foam::labelRange::const_iterator Foam::labelRange::cend() const
{ {
return endIter_; return const_iterator(*this, true);
} }
@ -132,14 +134,31 @@ inline Foam::labelRange::const_iterator Foam::labelRange::begin() const
} }
inline const Foam::labelRange::const_iterator& Foam::labelRange::end() const inline const Foam::labelRange::const_iterator Foam::labelRange::end() const
{ {
return endIter_; return const_iterator(*this, true);
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline void Foam::labelRange::resize(const label n)
{
setSize(n);
}
inline void Foam::labelRange::setSize(const label n)
{
size_ = n;
if (size_ < 0)
{
size_ = 0;
}
}
inline void Foam::labelRange::clear() inline void Foam::labelRange::clear()
{ {
start_ = size_ = 0; start_ = size_ = 0;
@ -152,6 +171,12 @@ inline bool Foam::labelRange::empty() const
} }
inline bool Foam::labelRange::valid() const
{
return size_;
}
inline Foam::label Foam::labelRange::size() const inline Foam::label Foam::labelRange::size() const
{ {
return size_; return size_;
@ -170,6 +195,31 @@ inline Foam::label Foam::labelRange::last() const
} }
inline bool Foam::labelRange::reset
(
const label start,
const label size,
const bool adjustStart
)
{
start_ = start;
size_ = size;
if (adjustStart)
{
// Disallow invalid indices and sizes
adjust();
}
else if (size_ < 0)
{
// Disallow invalid sizes
size_ = 0;
}
return size_;
}
inline bool Foam::labelRange::contains(const label value) const inline bool Foam::labelRange::contains(const label value) const
{ {
return value >= this->first() && value <= this->last(); return value >= this->first() && value <= this->last();
@ -186,7 +236,11 @@ inline Foam::label Foam::labelRange::operator[](const label i) const
inline bool Foam::labelRange::operator<(const labelRange& rhs) const inline bool Foam::labelRange::operator<(const labelRange& rhs) const
{ {
return this->first() < rhs.first(); return
(
this->first() < rhs.first()
|| (this->first() == rhs.first() && this->size() < rhs.size())
);
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,11 +26,6 @@ License
#include "labelRanges.H" #include "labelRanges.H"
#include "ListOps.H" #include "ListOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::labelRanges::const_iterator Foam::labelRanges::endIter_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::labelRanges::insertBefore void Foam::labelRanges::insertBefore
@ -141,7 +136,7 @@ bool Foam::labelRanges::add(const labelRange& range)
{ {
labelRange& currRange = ParentType::operator[](elemI); labelRange& currRange = ParentType::operator[](elemI);
if (currRange.intersects(range, true)) if (currRange.overlaps(range, true))
{ {
// absorb into the existing (adjacent/overlapping) range // absorb into the existing (adjacent/overlapping) range
currRange += range; currRange += range;
@ -150,7 +145,7 @@ bool Foam::labelRanges::add(const labelRange& range)
for (; elemI < this->size()-1; ++elemI) for (; elemI < this->size()-1; ++elemI)
{ {
labelRange& nextRange = ParentType::operator[](elemI+1); labelRange& nextRange = ParentType::operator[](elemI+1);
if (currRange.intersects(nextRange, true)) if (currRange.overlaps(nextRange, true))
{ {
currRange += nextRange; currRange += nextRange;
nextRange.clear(); nextRange.clear();

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -49,8 +49,8 @@ class Ostream;
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
class labelRanges; class labelRanges;
Istream& operator>>(Istream&, labelRanges&); Istream& operator>>(Istream& is, labelRanges& ranges);
Ostream& operator<<(Ostream&, const labelRanges&); Ostream& operator<<(Ostream& is, const labelRanges& ranges);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class labelRanges Declaration Class labelRanges Declaration
@ -68,13 +68,13 @@ class labelRanges
// Private Member Functions // Private Member Functions
//- Insert range before specified insertion index, by copying up //- Insert range before specified insertion index, by copying up
void insertBefore(const label, const labelRange&); void insertBefore(const label insert, const labelRange& range);
//- Purge empty ranges, by copying down //- Purge empty ranges, by copying down
void purgeEmpty(); void purgeEmpty();
//- Print the range for debugging purposes //- Print the range for debugging purposes
Ostream& printRange(Ostream&, const labelRange&) const; Ostream& printRange(Ostream& os, const labelRange& range) const;
public: public:
@ -85,10 +85,10 @@ public:
inline labelRanges(); inline labelRanges();
//- Construct given size //- Construct given size
inline explicit labelRanges(const label); inline explicit labelRanges(const label nElem);
//- Construct from Istream. //- Construct from Istream.
labelRanges(Istream&); labelRanges(Istream& is);
// Member Functions // Member Functions
@ -100,19 +100,22 @@ public:
using DynamicList<labelRange>::empty; using DynamicList<labelRange>::empty;
//- Return true if the value is within any of the ranges //- Return true if the value is within any of the ranges
inline bool contains(const label) const; inline bool contains(const label value) const;
//- Add the range to the list //- Add the range to the list
bool add(const labelRange&); bool add(const labelRange& range);
//- Remove the range from the list //- Remove the range from the list
bool remove(const labelRange&); bool remove(const labelRange& range);
// STL iterator // STL iterator
//- An STL const_iterator //- An STL const_iterator
class const_iterator class const_iterator
{ {
friend class labelRanges;
// Private data // Private data
//- Reference to the list for which this is an iterator //- Reference to the list for which this is an iterator
@ -124,22 +127,21 @@ public:
//- Index of current element at listIndex //- Index of current element at listIndex
label subIndex_; label subIndex_;
public:
// Constructors // Constructors
//- Construct null - equivalent to an 'end' position //- Construct from ranges at 'begin' or 'end' position
inline const_iterator(); inline const_iterator
(
//- Construct from list, moving to its 'begin' position const labelRanges& lst,
inline explicit const_iterator(const labelRanges&); const bool endIter = false
);
public:
// Member operators // Member operators
inline bool operator==(const const_iterator&) const; inline bool operator==(const const_iterator& iter) const;
inline bool operator!=(const const_iterator& iter) const;
inline bool operator!=(const const_iterator&) const;
inline label operator*(); inline label operator*();
inline label operator()(); inline label operator()();
@ -149,29 +151,23 @@ public:
}; };
//- const_iterator set to the beginning of the list //- A const_iterator set to the beginning of the list
inline const_iterator cbegin() const; inline const_iterator cbegin() const;
//- const_iterator set to beyond the end of the list //- A const_iterator set to beyond the end of the list
inline const const_iterator& cend() const; inline const const_iterator cend() const;
//- const_iterator set to the beginning of the list //- A const_iterator set to the beginning of the list
inline const_iterator begin() const; inline const_iterator begin() const;
//- const_iterator set to beyond the end of the list //- A const_iterator set to beyond the end of the list
inline const const_iterator& end() const; inline const const_iterator end() const;
// IOstream Operators // IOstream Operators
friend Istream& operator>>(Istream&, labelRanges&); friend Istream& operator>>(Istream& is, labelRanges& ranges);
friend Ostream& operator<<(Ostream&, const labelRanges&); friend Ostream& operator<<(Ostream& os, const labelRanges& ranges);
private:
//- const_iterator returned by end(), cend()
static const const_iterator endIter_;
}; };

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,28 +40,18 @@ inline Foam::labelRanges::labelRanges(const label nElem)
// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
inline Foam::labelRanges::const_iterator::const_iterator() inline Foam::labelRanges::const_iterator::const_iterator
(
const labelRanges& lst,
const bool endIter
)
: :
list_(*reinterpret_cast<Foam::labelRanges* >(0)), list_(lst),
index_(-1), index_(endIter ? lst.size() : 0),
subIndex_(-1) subIndex_(0)
{} {}
inline Foam::labelRanges::const_iterator::const_iterator(const labelRanges& lst)
:
list_(lst),
index_(0),
subIndex_(0)
{
if (list_.empty())
{
// equivalent to end iterator
index_ = subIndex_ = -1;
}
}
inline bool Foam::labelRanges::const_iterator::operator== inline bool Foam::labelRanges::const_iterator::operator==
( (
const const_iterator& iter const const_iterator& iter
@ -69,7 +59,7 @@ inline bool Foam::labelRanges::const_iterator::operator==
{ {
return return
( (
this->index_ == iter.index_ this->index_ == iter.index_
&& this->subIndex_ == iter.subIndex_ && this->subIndex_ == iter.subIndex_
); );
} }
@ -101,13 +91,9 @@ Foam::labelRanges::const_iterator::operator++()
{ {
if (++subIndex_ >= list_[index_].size()) if (++subIndex_ >= list_[index_].size())
{ {
// go to next list entry // Next sub-list
++index_;
subIndex_ = 0; subIndex_ = 0;
if (++index_ >= list_.size())
{
// equivalent to end iterator
index_ = subIndex_ = -1;
}
} }
return *this; return *this;
@ -129,9 +115,9 @@ inline Foam::labelRanges::const_iterator Foam::labelRanges::cbegin() const
} }
inline const Foam::labelRanges::const_iterator& Foam::labelRanges::cend() const inline const Foam::labelRanges::const_iterator Foam::labelRanges::cend() const
{ {
return endIter_; return const_iterator(*this, true);
} }
@ -141,9 +127,9 @@ inline Foam::labelRanges::const_iterator Foam::labelRanges::begin() const
} }
inline const Foam::labelRanges::const_iterator& Foam::labelRanges::end() const inline const Foam::labelRanges::const_iterator Foam::labelRanges::end() const
{ {
return endIter_; return const_iterator(*this, true);
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,94 +25,46 @@ License
#include "hashedWordList.H" #include "hashedWordList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::hashedWordList::rehash()
{
indices_.clear();
forAll(*this, i)
{
indices_.insert(List<word>::operator[](i), i);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::hashedWordList::hashedWordList() Foam::hashedWordList::hashedWordList
(
const label count,
const char** lst,
const bool removeDuplicates
)
: :
List<word>() List<word>(count)
{}
Foam::hashedWordList::hashedWordList(const UList<word>& names)
:
List<word>(names)
{ {
rehash(); forAll(*this, i)
} {
List<word>::operator[](i) = lst[i];
}
rehash(removeDuplicates);
Foam::hashedWordList::hashedWordList(const hashedWordList& names)
:
List<word>(static_cast<const UList<word>&>(names))
{
rehash();
}
Foam::hashedWordList::hashedWordList(const Xfer<List<word>>& names)
:
List<word>(names)
{
rehash();
}
Foam::hashedWordList::hashedWordList(std::initializer_list<word> lst)
:
List<word>(lst)
{
rehash();
} }
Foam::hashedWordList::hashedWordList Foam::hashedWordList::hashedWordList
( (
const label nNames, const char** lst,
const char** names const bool removeDuplicates
)
:
List<word>(nNames)
{
forAll(*this, i)
{
List<word>::operator[](i) = names[i];
}
rehash();
}
Foam::hashedWordList::hashedWordList
(
const char** names
) )
{ {
// count names // Determine the number of entries
label nNames = 0; label count = 0;
for (unsigned i = 0; names[i] && *(names[i]); ++i) for (unsigned i = 0; lst[i] && *(lst[i]); ++i)
{ {
++nNames; ++count;
} }
List<word>::setSize(nNames); List<word>::setSize(count);
forAll(*this, i) forAll(*this, i)
{ {
List<word>::operator[](i) = names[i]; List<word>::operator[](i) = lst[i];
} }
rehash(); rehash(removeDuplicates);
} }
@ -124,59 +76,48 @@ Foam::hashedWordList::hashedWordList(Istream& is)
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::hashedWordList::clear() void Foam::hashedWordList::transfer
{ (
List<word>::clear(); List<word>& lst,
indices_.clear(); const bool removeDuplicates
} )
void Foam::hashedWordList::append(const word& name)
{
const label idx = size();
List<word>::append(name);
indices_.insert(name, idx);
}
void Foam::hashedWordList::transfer(List<word>& lst)
{ {
List<word>::transfer(lst); List<word>::transfer(lst);
rehash(); rehash(removeDuplicates);
} }
void Foam::hashedWordList::sort() void Foam::hashedWordList::rehash() const
{ {
Foam::sort(*this); indices_.clear();
rehash();
forAll(*this, i)
{
indices_.insert(List<word>::operator[](i), i);
}
} }
void Foam::hashedWordList::uniq() void Foam::hashedWordList::uniq()
{ {
if (size() != indices_.size()) indices_.clear();
label nElem = 0;
forAll(*this, i)
{ {
// sizes don't match, which means there appear to be duplicates const word& item = List<word>::operator[](i);
indices_.clear(); if (indices_.insert(item, nElem))
label nElem = 0;
forAll(*this, i)
{ {
const word& item = List<word>::operator[](i); if (nElem != i)
if (indices_.insert(item, nElem))
{ {
if (nElem != i) List<word>::operator[](nElem) = item;
{
List<word>::operator[](nElem) = item;
}
++nElem;
} }
++nElem;
} }
List<word>::setSize(nElem);
} }
List<word>::setSize(nElem);
} }
@ -193,7 +134,7 @@ Foam::Istream& Foam::operator>>(Istream& is, hashedWordList& lst)
Foam::Ostream& Foam::operator<<(Ostream& os, const hashedWordList& lst) Foam::Ostream& Foam::operator<<(Ostream& os, const hashedWordList& lst)
{ {
os << static_cast<const List<word>&>(lst); os << static_cast<const UList<word>&>(lst);
return os; return os;
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,7 @@ Class
Foam::hashedWordList Foam::hashedWordList
Description Description
A wordList with hashed indices for faster lookup by name. A wordList with hashed indices for additional fast lookup by name.
SourceFiles SourceFiles
hashedWordListI.H hashedWordListI.H
@ -62,38 +62,64 @@ class hashedWordList
// Private data // Private data
//- Hash of words/indices //- Hash of words/indices
HashTable<label,word> indices_; mutable HashTable<label,word> indices_;
// Private Member Functions // Private Member Functions
//- Rebuild the hash of indices //- Rebuild the lookup hash or make unique entries first.
void rehash(); inline void rehash(const bool unique);
public: public:
// Constructors // Constructors
//- Construct null //- Construct null
hashedWordList(); inline hashedWordList();
//- Copy constructor. //- Copy constructor.
hashedWordList(const hashedWordList&); inline hashedWordList(const hashedWordList& lst);
//- Construct from list of words //- Construct from list of words,
hashedWordList(const UList<word>&); // optionally eliminating duplicates
inline hashedWordList
(
const UList<word>& lst,
const bool removeDuplicates=false
);
//- Construct by transferring the parameter contents,
// optionally eliminating duplicates
inline hashedWordList
(
const Xfer<List<word>>& lst,
const bool removeDuplicates=false
);
//- Construct from an initializer list //- Construct from an initializer list
hashedWordList(std::initializer_list<word>); inline hashedWordList(std::initializer_list<word>);
//- Construct by transferring the parameter contents //- Construct from the word keys of any HashTable, sorting immediately.
hashedWordList(const Xfer<List<word>>&); // This also handles a wordHashSet, which is derived from a HashTable.
// The result is similar to a HashTable::sortedToc.
template<class AnyType, class AnyHash>
explicit inline hashedWordList
(
const HashTable<AnyType, word, AnyHash>& h
);
//- Construct from number and list of names //- Construct from number and list of words,
hashedWordList(const label nNames, const char** names); // optionally eliminating duplicates
hashedWordList
(
const label count,
const char** lst,
const bool removeDuplicates=false
);
//- Construct from a nullptr-terminated list of names //- Construct from a nullptr-terminated list of words,
hashedWordList(const char** names); // optionally eliminating duplicates
hashedWordList(const char** lst, const bool removeDuplicates=false);
//- Construct from Istream //- Construct from Istream
hashedWordList(Istream&); hashedWordList(Istream&);
@ -102,47 +128,53 @@ public:
// Member Functions // Member Functions
//- Clear the list, i.e. set size to zero. //- Clear the list, i.e. set size to zero.
void clear(); inline void clear();
//- Append an element at the end of the list //- Append an element at the end of the list,
void append(const word&); // optionally avoid append if it would be a duplicate entry
inline void append(const word& name, const bool avoidDuplicates=false);
//- Does the list contain the specified name //- Does the list contain the specified name
inline bool found(const word&) const; inline bool found(const word& name) const;
//- Does the list contain the specified name //- Does the list contain the specified name
inline bool contains(const word&) const; inline bool contains(const word& name) const;
//- Return the hash of words/indices for inspection //- Return the hash of words/indices for inspection
inline const HashTable<label,word>& lookup() const; inline const HashTable<label,word>& lookup() const;
//- Transfer the contents of the argument List into this list //- Transfer the contents of the argument List into this list
// and annul the argument list. // and annul the argument list,
void transfer(List<word>&); // optionally eliminating duplicates
void transfer(List<word>& lst, const bool removeDuplicates=false);
//- Rebuild the lookup hash indices
void rehash() const;
//- Sort the list and rehash the indices //- Sort the list and rehash the indices
void sort(); inline void sort();
//- Adjust the list if necessary to eliminate duplicate entries //- Adjust the list if necessary to eliminate duplicate entries,
// and rehash the indices
void uniq(); void uniq();
// Member Operators // Member Operators
//- Assignment operator from list of words //- Assignment operator from list of words
inline void operator=(const UList<word>&); inline void operator=(const UList<word>& lst);
//- Assignment operator from initializer list //- Assignment operator from initializer list
inline void operator=(std::initializer_list<word>); inline void operator=(std::initializer_list<word> lst);
//- Assignment operator. //- Assignment operator.
inline void operator=(const hashedWordList&); inline void operator=(const hashedWordList& lst);
//- Return name corresponding to specified index //- Return name corresponding to specified index
inline const word& operator[](const label index) const; inline const word& operator[](const label index) const;
//- Return index corresponding to specified name //- Return index corresponding to specified name
inline label operator[](const word&) const; inline label operator[](const word& name) const;
// Istream operators // Istream operators

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -23,8 +23,117 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline void Foam::hashedWordList::rehash(const bool unique)
{
if (unique)
{
uniq();
}
else
{
rehash();
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::hashedWordList::hashedWordList()
:
List<word>(),
indices_()
{}
inline Foam::hashedWordList::hashedWordList(const hashedWordList& lst)
:
List<word>(static_cast<const UList<word>&>(lst))
{
rehash();
}
inline Foam::hashedWordList::hashedWordList
(
const UList<word>& lst,
const bool removeDuplicates
)
:
List<word>(lst)
{
rehash(removeDuplicates);
}
inline Foam::hashedWordList::hashedWordList
(
const Xfer<List<word>>& lst,
const bool removeDuplicates
)
:
List<word>(lst)
{
rehash(removeDuplicates);
}
inline Foam::hashedWordList::hashedWordList(std::initializer_list<word> lst)
:
List<word>(lst)
{
rehash();
}
template<class AnyType, class AnyHash>
inline Foam::hashedWordList::hashedWordList
(
const HashTable<AnyType, word, AnyHash>& h
)
:
List<word>(h.size())
{
label nElem = 0;
for
(
typename HashTable<AnyType, word, AnyHash>::const_iterator
iter = h.cbegin();
iter != h.cend();
++iter
)
{
List<word>::operator[](nElem++) = iter.key();
}
this->sort();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline void Foam::hashedWordList::clear()
{
List<word>::clear();
indices_.clear();
}
inline void Foam::hashedWordList::append
(
const word& name,
const bool avoidDuplicates
)
{
// name is either unique or we don't care about duplicates
if (indices_.insert(name, size()) || !avoidDuplicates)
{
List<word>::append(name);
}
}
inline const Foam::HashTable<Foam::label,Foam::word>& inline const Foam::HashTable<Foam::label,Foam::word>&
Foam::hashedWordList::lookup() const Foam::hashedWordList::lookup() const
{ {
@ -44,6 +153,13 @@ inline bool Foam::hashedWordList::contains(const word& name) const
} }
inline void Foam::hashedWordList::sort()
{
Foam::sort(*this);
rehash();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline void Foam::hashedWordList::operator=(const UList<word>& lst) inline void Foam::hashedWordList::operator=(const UList<word>& lst)
@ -75,9 +191,9 @@ inline const Foam::word& Foam::hashedWordList::operator[]
} }
// could return -1 instead of bombing out
inline Foam::label Foam::hashedWordList::operator[](const word& name) const inline Foam::label Foam::hashedWordList::operator[](const word& name) const
{ {
// Could return -1 instead of bombing out
return indices_[name]; return indices_[name];
} }

View File

@ -39,8 +39,8 @@ Description
Note Note
If the string contents are changed - eg, by the operator+=() or by If the string contents are changed - eg, by the operator+=() or by
string::replace(), etc - it will be necessary to use compile() or string::replace(), etc - it will be necessary to use compile() to
recompile() to synchronize the regular expression. synchronize the regular expression.
SourceFiles SourceFiles
wordRe.C wordRe.C
@ -161,9 +161,6 @@ public:
//- Possibly compile the regular expression, with greater control //- Possibly compile the regular expression, with greater control
inline bool compile(const compOption) const; inline bool compile(const compOption) const;
//- Recompile an existing regular expression
inline bool recompile() const;
//- Frees precompiled regular expression, making wordRe a literal. //- Frees precompiled regular expression, making wordRe a literal.
// Optionally strips invalid word characters // Optionally strips invalid word characters
inline void uncompile(const bool doStripInvalid = false) const; inline void uncompile(const bool doStripInvalid = false) const;

View File

@ -165,17 +165,6 @@ inline bool Foam::wordRe::compile() const
} }
inline bool Foam::wordRe::recompile() const
{
if (re_.exists())
{
re_ = *this;
}
return re_.exists();
}
inline void Foam::wordRe::uncompile(const bool doStripInvalid) const inline void Foam::wordRe::uncompile(const bool doStripInvalid) const
{ {
if (re_.clear()) if (re_.clear())
@ -265,6 +254,10 @@ inline void Foam::wordRe::operator=(const keyType& str)
{ {
compile(); compile();
} }
else
{
re_.clear();
}
} }

View File

@ -78,7 +78,7 @@ Foam::temperatureCoupledBase::temperatureCoupledBase
patch_(patch), patch_(patch),
method_(KMethodTypeNames_.read(dict.lookup("kappaMethod"))), method_(KMethodTypeNames_.read(dict.lookup("kappaMethod"))),
kappaName_(dict.lookupOrDefault<word>("kappa", "none")), kappaName_(dict.lookupOrDefault<word>("kappa", "none")),
alphaAniName_(dict.lookupOrDefault<word>("alphaAni","Anialpha")) alphaAniName_(dict.lookupOrDefault<word>("alphaAni","none"))
{} {}

View File

@ -254,7 +254,7 @@ bool Foam::ensightOutput::writeField
forAll(patchIds, listi) forAll(patchIds, listi)
{ {
const label patchId = patchIds[listi]; const label patchId = patchIds[listi];
const word& patchName = patchLookup[listi]; const word& patchName = patchLookup[patchId];
const ensightFaces& ensFaces = patchFaces[patchName]; const ensightFaces& ensFaces = patchFaces[patchName];
writeFaceField writeFaceField

View File

@ -326,7 +326,7 @@ void Foam::foamVtkCells::correct()
nAddVerts += 5; nAddVerts += 5;
vertOffset_[celLoc] = nAddVerts; vertOffset_[celLoc] = nAddVerts;
decompose_.superCells_[nAddCells++] = celLoc; decompose_.superCells_[nAddCells++] = cellI;
} }
cellTypes_[celLoc] = foamVtkCore::VTK_PYRAMID; cellTypes_[celLoc] = foamVtkCore::VTK_PYRAMID;
@ -373,7 +373,7 @@ void Foam::foamVtkCells::correct()
nAddVerts += 4; nAddVerts += 4;
vertOffset_[celLoc] = nAddVerts; vertOffset_[celLoc] = nAddVerts;
decompose_.superCells_[nAddCells++] = celLoc; decompose_.superCells_[nAddCells++] = cellI;
} }
cellTypes_[celLoc] = foamVtkCore::VTK_TETRA; cellTypes_[celLoc] = foamVtkCore::VTK_TETRA;

View File

@ -1260,20 +1260,36 @@ void Foam::extendedEdgeMesh::add(const extendedEdgeMesh& fem)
// ~~~~~~~ // ~~~~~~~
// Combine normals // Combine normals
DynamicField<point> newNormals(normals().size()+fem.normals().size()); DynamicField<point> newNormals
(
normals().size()
+ fem.normals().size()
);
newNormals.append(normals()); newNormals.append(normals());
newNormals.append(fem.normals()); newNormals.append(fem.normals());
// Combine and re-index into newNormals // Combine and re-index into newNormals
labelListList newEdgeNormals(edgeNormals().size()+fem.edgeNormals().size()); labelListList newEdgeNormals
UIndirectList<labelList>(newEdgeNormals, reverseEdgeMap) = (
edgeNormals(); edgeNormals().size()
UIndirectList<labelList>(newEdgeNormals, reverseFemEdgeMap) = + fem.edgeNormals().size()
fem.edgeNormals(); );
forAll(reverseFemEdgeMap, i)
UIndirectList<labelList>
(
newEdgeNormals,
SubList<label>(reverseEdgeMap, edgeNormals().size())
) = edgeNormals();
UIndirectList<labelList>
(
newEdgeNormals,
SubList<label>(reverseFemEdgeMap, fem.edgeNormals().size())
) = fem.edgeNormals();
forAll(fem.edgeNormals(), i)
{ {
label mapI = reverseFemEdgeMap[i]; const label mapI = reverseFemEdgeMap[i];
labelList& en = newEdgeNormals[mapI]; labelList& en = newEdgeNormals[mapI];
forAll(en, j) forAll(en, j)
{ {
@ -1300,9 +1316,10 @@ void Foam::extendedEdgeMesh::add(const extendedEdgeMesh& fem)
newFeaturePointNormals, newFeaturePointNormals,
SubList<label>(reverseFemPointMap, fem.featurePointNormals().size()) SubList<label>(reverseFemPointMap, fem.featurePointNormals().size())
) = fem.featurePointNormals(); ) = fem.featurePointNormals();
forAll(fem.featurePointNormals(), i) forAll(fem.featurePointNormals(), i)
{ {
label mapI = reverseFemPointMap[i]; const label mapI = reverseFemPointMap[i];
labelList& fn = newFeaturePointNormals[mapI]; labelList& fn = newFeaturePointNormals[mapI];
forAll(fn, j) forAll(fn, j)
{ {

View File

@ -19,6 +19,7 @@ vtk/format/foamVtkAppendBase64Formatter.C
vtk/format/foamVtkAppendRawFormatter.C vtk/format/foamVtkAppendRawFormatter.C
vtk/format/foamVtkAsciiFormatter.C vtk/format/foamVtkAsciiFormatter.C
vtk/format/foamVtkBase64Formatter.C vtk/format/foamVtkBase64Formatter.C
vtk/format/foamVtkBase64Layer.C
vtk/format/foamVtkLegacyFormatter.C vtk/format/foamVtkLegacyFormatter.C
vtk/format/foamVtkFormatter.C vtk/format/foamVtkFormatter.C
vtk/format/foamVtkOutputOptions.C vtk/format/foamVtkOutputOptions.C

View File

@ -34,28 +34,33 @@ Foam::fileFormats::NASCore::NASCore()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::scalar Foam::fileFormats::NASCore::parseNASCoord Foam::scalar Foam::fileFormats::NASCore::parseNASCoord(const string& s)
(
const string& s
)
{ {
size_t expSign = s.find_last_of("+-"); scalar value = 0;
if (expSign != string::npos && expSign > 0 && !isspace(s[expSign-1])) const size_t expSign = s.find_last_of("+-");
if (expSign != std::string::npos && expSign > 0 && !isspace(s[expSign-1]))
{ {
scalar mantissa = readScalar(IStringStream(s.substr(0, expSign))()); scalar exponent = 0;
scalar exponent = readScalar(IStringStream(s.substr(expSign+1))());
// Parse as per strtod/strtof - allowing trailing space or [Ee]
readScalar(s.substr(0, expSign).c_str(), value); // mantissa
readScalar(s.substr(expSign+1).c_str(), exponent);
if (s[expSign] == '-') if (s[expSign] == '-')
{ {
exponent = -exponent; exponent = -exponent;
} }
return mantissa * pow(10, exponent);
value *= ::pow(10, exponent);
} }
else else
{ {
return readScalar(IStringStream(s)()); readScalar(s.c_str(), value);
} }
return value;
} }

View File

@ -55,8 +55,8 @@ public:
// Public Member Functions // Public Member Functions
//- Do weird things to extract number //- Extract numbers from things like "-2.358-8" (same as "-2.358e-8")
static scalar parseNASCoord(const string&); static scalar parseNASCoord(const string& s);
// Constructors // Constructors

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,8 +27,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* Foam::foamVtkAppendBase64Formatter::name_ = "append"; const char* Foam::foamVtkAppendBase64Formatter::name_ = "append";
const char* Foam::foamVtkAppendBase64Formatter::encoding_ = "base64";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -38,14 +37,16 @@ Foam::foamVtkAppendBase64Formatter::foamVtkAppendBase64Formatter
std::ostream& os std::ostream& os
) )
: :
foamVtkBase64Formatter(os) foamVtkBase64Layer(os)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::foamVtkAppendBase64Formatter::~foamVtkAppendBase64Formatter() Foam::foamVtkAppendBase64Formatter::~foamVtkAppendBase64Formatter()
{} {
base64Layer::close();
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
@ -56,10 +57,4 @@ const char* Foam::foamVtkAppendBase64Formatter::name() const
} }
const char* Foam::foamVtkAppendBase64Formatter::encoding() const
{
return encoding_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,7 +36,7 @@ SourceFiles
#ifndef foamVtkAppendBase64Formatter_H #ifndef foamVtkAppendBase64Formatter_H
#define foamVtkAppendBase64Formatter_H #define foamVtkAppendBase64Formatter_H
#include "foamVtkBase64Formatter.H" #include "foamVtkBase64Layer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,12 +49,11 @@ namespace Foam
class foamVtkAppendBase64Formatter class foamVtkAppendBase64Formatter
: :
public foamVtkBase64Formatter public foamVtkBase64Layer
{ {
// Private Data Members // Private Data Members
static const char* name_; static const char* name_;
static const char* encoding_;
// Private Member Functions // Private Member Functions
@ -71,7 +70,7 @@ public:
// Constructors // Constructors
//- Construct and attach to an output stream //- Construct and attach to an output stream
foamVtkAppendBase64Formatter(std::ostream&); foamVtkAppendBase64Formatter(std::ostream& os);
//- Destructor //- Destructor
@ -83,9 +82,6 @@ public:
//- Output name for XML type ("append") //- Output name for XML type ("append")
virtual const char* name() const; virtual const char* name() const;
//- Name for the XML append encoding ("base64").
virtual const char* encoding() const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,9 +71,9 @@ const char* Foam::foamVtkAppendRawFormatter::encoding() const
} }
void Foam::foamVtkAppendRawFormatter::writeSize(const uint64_t val) void Foam::foamVtkAppendRawFormatter::writeSize(const uint64_t nBytes)
{ {
write(reinterpret_cast<const char*>(&val), sizeof(uint64_t)); write(reinterpret_cast<const char*>(&nBytes), sizeof(uint64_t));
} }
@ -85,28 +85,28 @@ void Foam::foamVtkAppendRawFormatter::write(const uint8_t val)
void Foam::foamVtkAppendRawFormatter::write(const label val) void Foam::foamVtkAppendRawFormatter::write(const label val)
{ {
// std::cerr<<"label is:" << sizeof(val) << '\n'; // std::cerr<<"label:" << sizeof(val) << "=" << val << '\n';
write(reinterpret_cast<const char*>(&val), sizeof(label)); write(reinterpret_cast<const char*>(&val), sizeof(label));
} }
void Foam::foamVtkAppendRawFormatter::write(const float val) void Foam::foamVtkAppendRawFormatter::write(const float val)
{ {
// std::cerr<<"float is:" << sizeof(val) << '\n'; // std::cerr<<"float:" << sizeof(val) << "=" << val << '\n';
write(reinterpret_cast<const char*>(&val), sizeof(float)); write(reinterpret_cast<const char*>(&val), sizeof(float));
} }
void Foam::foamVtkAppendRawFormatter::write(const double val) void Foam::foamVtkAppendRawFormatter::write(const double val)
{ {
// std::cerr<<"write double as float:" << val << '\n'; // std::cerr<<"double as float=" << val << '\n';
float copy(val); float copy(val);
write(copy); write(copy);
} }
void Foam::foamVtkAppendRawFormatter::flush() void Foam::foamVtkAppendRawFormatter::flush()
{} {/*nop*/}
// ************************************************************************* // // ************************************************************************* //

View File

@ -77,7 +77,7 @@ public:
// Constructors // Constructors
//- Construct and attach to an output stream //- Construct and attach to an output stream
foamVtkAppendRawFormatter(std::ostream&); foamVtkAppendRawFormatter(std::ostream& os);
//- Destructor //- Destructor
@ -94,12 +94,14 @@ public:
//- Write leading size for binary output //- Write leading size for binary output
virtual void writeSize(const uint64_t); virtual void writeSize(const uint64_t nBytes);
virtual void write(const uint8_t); virtual void write(const uint8_t val);
virtual void write(const label); virtual void write(const label val);
virtual void write(const float); virtual void write(const float val);
virtual void write(const double); virtual void write(const double val);
//- A no-op for this format
virtual void flush(); virtual void flush();
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -47,6 +47,16 @@ inline void Foam::foamVtkAsciiFormatter::next()
} }
inline void Foam::foamVtkAsciiFormatter::done()
{
if (pos_)
{
os()<< '\n';
}
pos_ = 0;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::foamVtkAsciiFormatter::foamVtkAsciiFormatter(std::ostream& os) Foam::foamVtkAsciiFormatter::foamVtkAsciiFormatter(std::ostream& os)
@ -73,7 +83,7 @@ Foam::foamVtkAsciiFormatter::foamVtkAsciiFormatter
Foam::foamVtkAsciiFormatter::~foamVtkAsciiFormatter() Foam::foamVtkAsciiFormatter::~foamVtkAsciiFormatter()
{ {
flush(); done();
} }
@ -91,7 +101,7 @@ const char* Foam::foamVtkAsciiFormatter::encoding() const
} }
void Foam::foamVtkAsciiFormatter::writeSize(const uint64_t) void Foam::foamVtkAsciiFormatter::writeSize(const uint64_t ignored)
{/*nop*/} {/*nop*/}
@ -125,11 +135,14 @@ void Foam::foamVtkAsciiFormatter::write(const double val)
void Foam::foamVtkAsciiFormatter::flush() void Foam::foamVtkAsciiFormatter::flush()
{ {
if (pos_) done();
{ }
os()<< '\n';
}
pos_ = 0; std::size_t
Foam::foamVtkAsciiFormatter::encodedLength(std::size_t ignored) const
{
return 0;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,9 +62,12 @@ class foamVtkAsciiFormatter
// Private Member Functions // Private Member Functions
//- Advance to next position, adding space or newline as required //- Advance to next position, adding space or newline as needed
inline void next(); inline void next();
//- Finish an output line, adding newline as needed
inline void done();
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
foamVtkAsciiFormatter(const foamVtkAsciiFormatter&) = delete; foamVtkAsciiFormatter(const foamVtkAsciiFormatter&) = delete;
@ -78,10 +81,10 @@ public:
// Constructors // Constructors
//- Construct and attach to an output stream, use default precision //- Construct and attach to an output stream, use default precision
foamVtkAsciiFormatter(std::ostream&); foamVtkAsciiFormatter(std::ostream& os);
//- Construct and attach to an output stream, use specified precision //- Construct and attach to an output stream, use specified precision
foamVtkAsciiFormatter(std::ostream&, unsigned precision); foamVtkAsciiFormatter(std::ostream& os, unsigned precision);
//- Destructor //- Destructor
@ -95,18 +98,24 @@ public:
virtual const char* name() const; virtual const char* name() const;
//- Name for the XML append encoding - unused. //- Name for the XML append encoding - unused.
// Currently simply "ASCII", but this should not be relied upon. // Currently identical to name(), but do not rely on this.
virtual const char* encoding() const; virtual const char* encoding() const;
//- Write leading size - this is a no-op for ascii output //- Write leading size - this is a no-op for ascii output
virtual void writeSize(const uint64_t); virtual void writeSize(const uint64_t ignored);
virtual void write(const uint8_t); virtual void write(const uint8_t val);
virtual void write(const label); virtual void write(const label val);
virtual void write(const float); virtual void write(const float val);
virtual void write(const double); virtual void write(const double val);
//- Write a newline if needed to finish a line of output.
virtual void flush(); virtual void flush();
//- The encoded length for ascii output is not applicable.
virtual std::size_t encodedLength(std::size_t ignored) const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,28 +27,14 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* Foam::foamVtkBase64Formatter::name_ = "binary"; const char* Foam::foamVtkBase64Formatter::name_ = "binary";
const char* Foam::foamVtkBase64Formatter::encoding_ = "base64";
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::foamVtkBase64Formatter::write
(
const char* s,
std::streamsize n
)
{
base64Layer::write(s, n);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::foamVtkBase64Formatter::foamVtkBase64Formatter(std::ostream& os) Foam::foamVtkBase64Formatter::foamVtkBase64Formatter(std::ostream& os)
: :
foamVtkFormatter(os), foamVtkBase64Layer(os)
base64Layer(os)
{} {}
@ -56,7 +42,10 @@ Foam::foamVtkBase64Formatter::foamVtkBase64Formatter(std::ostream& os)
Foam::foamVtkBase64Formatter::~foamVtkBase64Formatter() Foam::foamVtkBase64Formatter::~foamVtkBase64Formatter()
{ {
flush(); if (base64Layer::close())
{
os().put('\n');
}
} }
@ -68,46 +57,6 @@ const char* Foam::foamVtkBase64Formatter::name() const
} }
const char* Foam::foamVtkBase64Formatter::encoding() const
{
return encoding_;
}
void Foam::foamVtkBase64Formatter::writeSize(const uint64_t val)
{
write(reinterpret_cast<const char*>(&val), sizeof(uint64_t));
}
void Foam::foamVtkBase64Formatter::write(const uint8_t val)
{
base64Layer::add(val);
}
void Foam::foamVtkBase64Formatter::write(const label val)
{
// std::cerr<<"label is:" << sizeof(val) << '\n';
write(reinterpret_cast<const char*>(&val), sizeof(label));
}
void Foam::foamVtkBase64Formatter::write(const float val)
{
// std::cerr<<"float is:" << sizeof(val) << '\n';
write(reinterpret_cast<const char*>(&val), sizeof(float));
}
void Foam::foamVtkBase64Formatter::write(const double val)
{
// std::cerr<<"write double as float:" << val << '\n';
float copy(val);
write(copy);
}
void Foam::foamVtkBase64Formatter::flush() void Foam::foamVtkBase64Formatter::flush()
{ {
if (base64Layer::close()) if (base64Layer::close())

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,8 +33,7 @@ Description
#ifndef foamVtkBase64Formatter_H #ifndef foamVtkBase64Formatter_H
#define foamVtkBase64Formatter_H #define foamVtkBase64Formatter_H
#include "foamVtkFormatter.H" #include "foamVtkBase64Layer.H"
#include "base64Layer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,8 +46,7 @@ namespace Foam
class foamVtkBase64Formatter class foamVtkBase64Formatter
: :
public foamVtkFormatter, public foamVtkBase64Layer
private base64Layer
{ {
// Private Data Members // Private Data Members
@ -64,20 +62,12 @@ class foamVtkBase64Formatter
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const foamVtkBase64Formatter&) = delete; void operator=(const foamVtkBase64Formatter&) = delete;
protected:
// Protected Member Functions
//- Write
void write(const char* s, std::streamsize n);
public: public:
// Constructors // Constructors
//- Construct and attach to an output stream //- Construct and attach to an output stream
foamVtkBase64Formatter(std::ostream&); foamVtkBase64Formatter(std::ostream& os);
//- Destructor //- Destructor
@ -90,17 +80,9 @@ public:
// The lowercase version of the Legacy output type. // The lowercase version of the Legacy output type.
virtual const char* name() const; virtual const char* name() const;
//- Name for the XML append encoding.
virtual const char* encoding() const;
//- End the encoding sequence (padding the final characters with '=')
//- Write leading size for binary output // and write a newline to the output if any encoding was done.
virtual void writeSize(const uint64_t);
virtual void write(const uint8_t);
virtual void write(const label);
virtual void write(const float);
virtual void write(const double);
virtual void flush(); virtual void flush();
}; };

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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/>.
\*---------------------------------------------------------------------------*/
#include "foamVtkBase64Layer.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* Foam::foamVtkBase64Layer::encoding_ = "base64";
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::foamVtkBase64Layer::write
(
const char* s,
std::streamsize n
)
{
base64Layer::write(s, n);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::foamVtkBase64Layer::foamVtkBase64Layer(std::ostream& os)
:
foamVtkFormatter(os),
base64Layer(os)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::foamVtkBase64Layer::~foamVtkBase64Layer()
{
base64Layer::close();
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const char* Foam::foamVtkBase64Layer::encoding() const
{
return encoding_;
}
void Foam::foamVtkBase64Layer::writeSize(const uint64_t nBytes)
{
write(reinterpret_cast<const char*>(&nBytes), sizeof(uint64_t));
}
void Foam::foamVtkBase64Layer::write(const uint8_t val)
{
base64Layer::add(val);
}
void Foam::foamVtkBase64Layer::write(const label val)
{
// std::cerr<<"label:" << sizeof(val) << "=" << val << '\n';
write(reinterpret_cast<const char*>(&val), sizeof(label));
}
void Foam::foamVtkBase64Layer::write(const float val)
{
// std::cerr<<"float:" << sizeof(val) << "=" << val << '\n';
write(reinterpret_cast<const char*>(&val), sizeof(float));
}
void Foam::foamVtkBase64Layer::write(const double val)
{
// std::cerr<<"double as float=" << val << '\n';
float copy(val);
write(copy);
}
void Foam::foamVtkBase64Layer::flush()
{
base64Layer::close();
}
std::size_t Foam::foamVtkBase64Layer::encodedLength(std::size_t n) const
{
return base64Layer::encodedLength(n);
}
// ************************************************************************* //

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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/>.
Class
foamVtkBase64Layer
Description
Base-64 encoded output.
\*---------------------------------------------------------------------------*/
#ifndef foamVtkBase64Layer_H
#define foamVtkBase64Layer_H
#include "foamVtkFormatter.H"
#include "base64Layer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class foamVtkBase64Layer Declaration
\*---------------------------------------------------------------------------*/
class foamVtkBase64Layer
:
public foamVtkFormatter,
protected base64Layer
{
// Private Data Members
static const char* encoding_;
// Private Member Functions
//- Disallow default bitwise copy construct
foamVtkBase64Layer(const foamVtkBase64Layer&) = delete;
//- Disallow default bitwise assignment
void operator=(const foamVtkBase64Layer&) = delete;
protected:
// Protected Member Functions
//- Write
void write(const char* s, std::streamsize n);
// Constructors
//- Construct and attach to an output stream
foamVtkBase64Layer(std::ostream& os);
public:
//- Destructor
virtual ~foamVtkBase64Layer();
// Member Functions
//- Name for the XML append encoding ("base64").
virtual const char* encoding() const;
//- Write leading size for binary output
virtual void writeSize(const uint64_t nBytes);
virtual void write(const uint8_t val);
virtual void write(const label val);
virtual void write(const float val);
virtual void write(const double val);
//- End the encoding sequence (padding the final characters with '=')
virtual void flush();
//- The encoded length for base64 encoded output.
virtual std::size_t encodedLength(std::size_t n) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,6 +52,12 @@ Foam::foamVtkFormatter::~foamVtkFormatter()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
std::size_t Foam::foamVtkFormatter::encodedLength(std::size_t n) const
{
return n;
}
void Foam::foamVtkFormatter::indent() void Foam::foamVtkFormatter::indent()
{ {
label n = xmlTags_.size() * 2; label n = xmlTags_.size() * 2;
@ -149,7 +155,6 @@ Foam::foamVtkFormatter::tag(const word& tag)
} }
Foam::foamVtkFormatter& Foam::foamVtkFormatter&
Foam::foamVtkFormatter::endTag(const word& tag) Foam::foamVtkFormatter::endTag(const word& tag)
{ {
@ -181,7 +186,6 @@ Foam::foamVtkFormatter::endTag(const word& tag)
} }
Foam::foamVtkFormatter& Foam::foamVtkFormatter&
Foam::foamVtkFormatter::xmlAttr Foam::foamVtkFormatter::xmlAttr
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -74,8 +74,8 @@ class foamVtkFormatter
template<class Type> template<class Type>
foamVtkFormatter& xmlAttribute foamVtkFormatter& xmlAttribute
( (
const word&, const word& k,
const Type&, const Type& v,
const char quote const char quote
); );
@ -120,14 +120,20 @@ public:
//- Write leading size for binary output //- Write leading size for binary output
virtual void writeSize(const uint64_t) = 0; virtual void writeSize(const uint64_t nBytes) = 0;
virtual void write(const uint8_t) = 0; virtual void write(const uint8_t val) = 0;
virtual void write(const label) = 0; virtual void write(const label val) = 0;
virtual void write(const float) = 0; virtual void write(const float val) = 0;
virtual void write(const double) = 0; virtual void write(const double val) = 0;
//- Flush encoding, write newline etc.
virtual void flush() = 0; virtual void flush() = 0;
//- The encoded length for binary output.
// The default is pass-through.
virtual std::size_t encodedLength(std::size_t n) const;
// Member Functions // Member Functions
@ -138,7 +144,7 @@ public:
foamVtkFormatter& xmlHeader(); foamVtkFormatter& xmlHeader();
//- Write XML comment (at the current indentation level) //- Write XML comment (at the current indentation level)
foamVtkFormatter& comment(const std::string&); foamVtkFormatter& comment(const std::string& text);
//- Open XML tag //- Open XML tag
@ -177,40 +183,40 @@ public:
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& xmlAttr foamVtkFormatter& xmlAttr
( (
const word&, const word& k,
const std::string&, const std::string& v,
const char quote = '\'' const char quote = '\''
); );
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& xmlAttr foamVtkFormatter& xmlAttr
( (
const word&, const word& k,
const int32_t, const int32_t v,
const char quote = '\'' const char quote = '\''
); );
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& xmlAttr foamVtkFormatter& xmlAttr
( (
const word&, const word& k,
const int64_t, const int64_t v,
const char quote = '\'' const char quote = '\''
); );
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& xmlAttr foamVtkFormatter& xmlAttr
( (
const word&, const word& k,
const uint64_t, const uint64_t v,
const char quote = '\'' const char quote = '\''
); );
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& xmlAttr foamVtkFormatter& xmlAttr
( (
const word&, const word& k,
const scalar, const scalar v,
const char quote = '\'' const char quote = '\''
); );
@ -219,19 +225,19 @@ public:
// Member Operators // Member Operators
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& operator()(const word&, const std::string&); foamVtkFormatter& operator()(const word& k, const std::string& v);
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& operator()(const word&, const int32_t); foamVtkFormatter& operator()(const word& k, const int32_t v);
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& operator()(const word&, const int64_t); foamVtkFormatter& operator()(const word& k, const int64_t v);
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& operator()(const word&, const uint64_t); foamVtkFormatter& operator()(const word& k, const uint64_t v);
//- Write XML attribute //- Write XML attribute
foamVtkFormatter& operator()(const word&, const scalar); foamVtkFormatter& operator()(const word& k, const scalar v);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,8 +71,8 @@ const char* Foam::foamVtkLegacyFormatter::encoding() const
} }
void Foam::foamVtkLegacyFormatter::writeSize(const uint64_t) void Foam::foamVtkLegacyFormatter::writeSize(const uint64_t ignored)
{} {/*nop*/}
void Foam::foamVtkLegacyFormatter::write(const uint8_t val) void Foam::foamVtkLegacyFormatter::write(const uint8_t val)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,11 +25,10 @@ Class
foamVtkLegacyFormatter foamVtkLegacyFormatter
Description Description
Binary output for the VTK legacy format, always written as big-endian. Binary output for the VTK legacy format, always written as big-endian
and with 32-bit integers.
The legacy files are always written as big endian. This format should never be used for OpenFOAM with 64-bit label sizes.
Since integers in the legacy format are limited to 32-bit,
this format should not be used for OpenFOAM with 64-bit label sizes.
SourceFiles SourceFiles
foamVtkLegacyFormatter.C foamVtkLegacyFormatter.C
@ -81,7 +80,7 @@ public:
// Constructors // Constructors
//- Construct and attach to an output stream //- Construct and attach to an output stream
foamVtkLegacyFormatter(std::ostream&); foamVtkLegacyFormatter(std::ostream& os);
//- Destructor //- Destructor
@ -90,22 +89,25 @@ public:
// Member Functions // Member Functions
//- Name for the Legacy output type ("BINARY") //- Name for the legacy binary output type ("BINARY")
virtual const char* name() const; virtual const char* name() const;
//- Name for the XML append encoding (unused) //- Name for the XML append encoding (unused)
// Currently simply "BINARY", but this should not be relied upon. // Currently identical to name(), but do not rely on this.
virtual const char* encoding() const; virtual const char* encoding() const;
//- Write leading size - a no-op for legacy binary output //- Write leading size - a no-op for legacy binary output
virtual void writeSize(const uint64_t); virtual void writeSize(const uint64_t ignored);
virtual void write(const uint8_t); virtual void write(const uint8_t val);
virtual void write(const label); virtual void write(const label val);
virtual void write(const float); virtual void write(const float val);
virtual void write(const double); virtual void write(const double val);
//- Write a newline to the output
virtual void flush(); virtual void flush();
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,10 +45,8 @@ Foam::foamVtkOutputOptions::foamVtkOutputOptions()
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::foamVtkFormatter> Foam::foamVtkOutputOptions::newFormatter Foam::autoPtr<Foam::foamVtkFormatter>
( Foam::foamVtkOutputOptions::newFormatter(std::ostream& os) const
std::ostream& os
) const
{ {
switch (type_) switch (type_)
{ {
@ -87,9 +85,9 @@ Foam::autoPtr<Foam::foamVtkFormatter> Foam::foamVtkOutputOptions::newFormatter
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::foamVtkOutputOptions::ascii(bool b) void Foam::foamVtkOutputOptions::ascii(bool on)
{ {
if (b) if (on)
{ {
// Force ASCII: // Force ASCII:
@ -132,9 +130,9 @@ void Foam::foamVtkOutputOptions::ascii(bool b)
} }
void Foam::foamVtkOutputOptions::append(bool b) void Foam::foamVtkOutputOptions::append(bool on)
{ {
if (b) if (on)
{ {
if (!(type_ & APPEND)) if (!(type_ & APPEND))
{ {
@ -153,9 +151,9 @@ void Foam::foamVtkOutputOptions::append(bool b)
} }
void Foam::foamVtkOutputOptions::legacy(bool b) void Foam::foamVtkOutputOptions::legacy(bool on)
{ {
if (b) if (on)
{ {
if (type_ & APPEND) if (type_ & APPEND)
{ {
@ -180,9 +178,9 @@ void Foam::foamVtkOutputOptions::legacy(bool b)
} }
void Foam::foamVtkOutputOptions::precision(unsigned val) const void Foam::foamVtkOutputOptions::precision(unsigned prec) const
{ {
precision_ = val; precision_ = prec;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -88,7 +88,7 @@ public:
// Selectors // Selectors
//- Return new data formatter based on the writer options //- Return new data formatter based on the writer options
autoPtr<foamVtkFormatter> newFormatter(std::ostream&) const; autoPtr<foamVtkFormatter> newFormatter(std::ostream& os) const;
// Member Functions // Member Functions
@ -117,16 +117,16 @@ public:
// In append mode, this switches between base64 and raw binary. // In append mode, this switches between base64 and raw binary.
// In XML mode, this switches between ASCII and base64. // In XML mode, this switches between ASCII and base64.
// In legacy mode, this switches between ASCII and binary. // In legacy mode, this switches between ASCII and binary.
void ascii(bool); void ascii(bool on);
//- Toggle append mode on/off. //- Toggle append mode on/off.
void append(bool); void append(bool on);
//- Toggle legacy mode on/off. //- Toggle legacy mode on/off.
void legacy(bool); void legacy(bool on);
//- Set the write precision to be used for new ASCII formatters //- Set the write precision to be used for new ASCII formatters
void precision(unsigned val) const; void precision(unsigned prec) const;
// Other // Other

View File

@ -59,11 +59,11 @@ Foam::foamVtkPTraits<double>::typeName = "Float64";
#ifdef WM_LITTLE_ENDIAN #ifdef WM_LITTLE_ENDIAN
template<> template<>
const char* const const char* const
Foam::foamVtkPTraits<::Foam::endian>::typeName = "LittleEndian"; Foam::foamVtkPTraits<Foam::endian>::typeName = "LittleEndian";
#else #else
template<> template<>
const char* const const char* const
Foam::foamVtkPTraits<::Foam::endian>::typeName = "BigEndian"; Foam::foamVtkPTraits<Foam::endian>::typeName = "BigEndian";
#endif #endif

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd. \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -58,28 +58,28 @@ public:
template<> template<>
const char* const foamVtkPTraits<uint8_t>::typeName; // = UInt8 const char* const foamVtkPTraits<uint8_t>::typeName; // UInt8
template<> template<>
const char* const foamVtkPTraits<int32_t>::typeName; // = Int32 const char* const foamVtkPTraits<int32_t>::typeName; // Int32
template<> template<>
const char* const foamVtkPTraits<int32_t>::typeName; // = UInt32 const char* const foamVtkPTraits<uint32_t>::typeName; // UInt32
template<> template<>
const char* const foamVtkPTraits<int32_t>::typeName; // = Int64 const char* const foamVtkPTraits<int64_t>::typeName; // Int64
template<> template<>
const char* const foamVtkPTraits<int64_t>::typeName; // = UInt64 const char* const foamVtkPTraits<uint64_t>::typeName; // UInt64
template<> template<>
const char* const foamVtkPTraits<float>::typeName; // = Float32 const char* const foamVtkPTraits<float>::typeName; // Float32
template<> template<>
const char* const foamVtkPTraits<double>::typeName; // = Float64 const char* const foamVtkPTraits<double>::typeName; // Float64
template<> template<>
const char* const foamVtkPTraits<::Foam::endian>::typeName; const char* const foamVtkPTraits<Foam::endian>::typeName; // (Big|Little)Endian
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -159,13 +159,6 @@ Foam::tmp<Foam::Field<Type>> Foam::slicedFvPatchField<Type>::snGrad() const
} }
template<class Type>
void Foam::slicedFvPatchField<Type>::updateCoeffs()
{
NotImplemented;
}
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::slicedFvPatchField<Type>::patchInternalField() const Foam::slicedFvPatchField<Type>::patchInternalField() const

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -153,10 +153,6 @@ public:
//- Return patch-normal gradient //- Return patch-normal gradient
virtual tmp<Field<Type>> snGrad() const; virtual tmp<Field<Type>> snGrad() const;
//- Update the coefficients associated with the patch field
// Sets Updated to true
virtual void updateCoeffs();
//- Return internal field next to patch as patch field //- Return internal field next to patch as patch field
virtual tmp<Field<Type>> patchInternalField() const; virtual tmp<Field<Type>> patchInternalField() const;

View File

@ -25,7 +25,7 @@ Class
Foam::fixedNormalInletOutletVelocityFvPatchVectorField Foam::fixedNormalInletOutletVelocityFvPatchVectorField
Group Group
grpInletletBoundaryConditions grpOutletBoundaryConditions grpInletBoundaryConditions grpOutletBoundaryConditions
Description Description
This velocity inlet/outlet boundary condition combines a fixed normal This velocity inlet/outlet boundary condition combines a fixed normal

View File

@ -34,7 +34,7 @@ Description
Usage Usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default value
valueFraction | fraction od value used for boundary [0-1] | yes | valueFraction | fraction of value used for boundary [0-1] | yes |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:

View File

@ -25,7 +25,7 @@ Class
Foam::pressureInletOutletVelocityFvPatchVectorField Foam::pressureInletOutletVelocityFvPatchVectorField
Group Group
grpInletletBoundaryConditions grpOutletBoundaryConditions grpInletBoundaryConditions grpOutletBoundaryConditions
Description Description
This velocity inlet/outlet boundary condition is applied to pressure This velocity inlet/outlet boundary condition is applied to pressure
@ -49,7 +49,7 @@ Usage
type pressureInletOutletVelocity; type pressureInletOutletVelocity;
phi phi; phi phi;
tangentialVelocity uniform (0 0 0); tangentialVelocity uniform (0 0 0);
value uniform 0; value uniform (0 0 0);
} }
\endverbatim \endverbatim

View File

@ -34,7 +34,7 @@ Foam::slipFvPatchField<Type>::slipFvPatchField
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
basicSymmetryFvPatchField<Type>(p, iF) basicSymmetryFvPatchField<Type>(p, iF)
{} {}

View File

@ -416,7 +416,8 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
// Reread values and interpolate // Reread values and interpolate
fileName valsFile fileName valsFile
( (
this->db().time().caseConstant() this->db().time().path()
/this->db().time().caseConstant()
/"boundaryData" /"boundaryData"
/this->patch().name() /this->patch().name()
/sampleTimes_[endSampleTime_].name() /sampleTimes_[endSampleTime_].name()

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -311,6 +311,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
// Determine if all eddies spawned from a single processor // Determine if all eddies spawned from a single processor
singleProc_ = patch.size() == returnReduce(patch.size(), sumOp<label>()); singleProc_ = patch.size() == returnReduce(patch.size(), sumOp<label>());
reduce(singleProc_, orOp<bool>());
} }

View File

@ -44,6 +44,7 @@ Description
The weight applies to the first scheme and 1-weight to the second scheme. The weight applies to the first scheme and 1-weight to the second scheme.
Usage
Example of the CoBlended scheme specification using LUST for Courant numbers Example of the CoBlended scheme specification using LUST for Courant numbers
less than 1 and linearUpwind for Courant numbers greater than 10: less than 1 and linearUpwind for Courant numbers greater than 10:
\verbatim \verbatim

View File

@ -176,8 +176,9 @@ bool Foam::functionObjects::blendingFactor::write()
<< " blended cells : " << nCellsBlended << nl << " blended cells : " << nCellsBlended << nl
<< endl; << endl;
writeTime(file());
file() file()
<< time_.time().value()
<< token::TAB << nCellsScheme1 << token::TAB << nCellsScheme1
<< token::TAB << nCellsScheme2 << token::TAB << nCellsScheme2
<< token::TAB << nCellsBlended << token::TAB << nCellsBlended

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -98,7 +98,7 @@ void Foam::functionObjects::fieldAverage::initialize()
} }
} }
// ensure first averaging works unconditionally // Ensure first averaging works unconditionally
prevTimeIndex_ = -1; prevTimeIndex_ = -1;
Log << endl; Log << endl;
@ -108,7 +108,8 @@ void Foam::functionObjects::fieldAverage::initialize()
void Foam::functionObjects::fieldAverage::restart() void Foam::functionObjects::fieldAverage::restart()
{ {
Log << " Restarting averaging at time " << obr().time().timeName() Log << " Restarting averaging at time "
<< obr().time().timeOutputValue()
<< nl << endl; << nl << endl;
totalIter_.clear(); totalIter_.clear();
@ -221,7 +222,8 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
if (restartOnRestart_ || restartOnOutput_) if (restartOnRestart_ || restartOnOutput_)
{ {
Info<< " Starting averaging at time " << obr().time().timeName() Info<< " Starting averaging at time "
<< obr().time().timeOutputValue()
<< nl; << nl;
} }
else else
@ -240,15 +242,18 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
totalIter_[fieldi] = readLabel(fieldDict.lookup("totalIter")); totalIter_[fieldi] = readLabel(fieldDict.lookup("totalIter"));
totalTime_[fieldi] = readScalar(fieldDict.lookup("totalTime")); totalTime_[fieldi] = readScalar(fieldDict.lookup("totalTime"));
scalar userTotalTime =
obr().time().timeToUserTime(totalTime_[fieldi]);
Info<< " " << fieldName Info<< " " << fieldName
<< " iters = " << totalIter_[fieldi] << " iters = " << totalIter_[fieldi]
<< " time = " << totalTime_[fieldi] << nl; << " time = " << userTotalTime << nl;
} }
else else
{ {
Info<< " " << fieldName Info<< " " << fieldName
<< ": starting averaging at time " << ": starting averaging at time "
<< obr().time().timeName() << endl; << obr().time().timeOutputValue() << endl;
} }
} }
} }
@ -312,7 +317,8 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
if (periodicRestart_) if (periodicRestart_)
{ {
dict.lookup("restartPeriod") >> restartPeriod_; scalar userRestartPeriod = readScalar(dict.lookup("restartPeriod"));
restartPeriod_ = obr().time().userTimeToTime(userRestartPeriod);
if (restartPeriod_ > 0) if (restartPeriod_ > 0)
{ {
@ -323,22 +329,25 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
++periodIndex_; ++periodIndex_;
} }
Info<< " Restart period " << restartPeriod_ Info<< " Restart period " << userRestartPeriod
<< " - next restart at " << (restartPeriod_*periodIndex_) << " - next restart at " << (userRestartPeriod*periodIndex_)
<< nl << endl; << nl << endl;
} }
else else
{ {
periodicRestart_ = false; periodicRestart_ = false;
Info<< " Restart period " << restartPeriod_ Info<< " Restart period " << userRestartPeriod
<< " - ignored" << " - ignored"
<< nl << endl; << nl << endl;
} }
} }
if (dict.readIfPresent("restartTime", restartTime_)) scalar userRestartTime = 0;
if (dict.readIfPresent("restartTime", userRestartTime))
{ {
restartTime_ = obr().time().userTimeToTime(userRestartTime);
if (currentTime > restartTime_) if (currentTime > restartTime_)
{ {
// The restart time is already in the past - ignore // The restart time is already in the past - ignore
@ -346,7 +355,7 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
} }
else else
{ {
Info<< " Restart scheduled at time " << restartTime_ Info<< " Restart scheduled at time " << userRestartTime
<< nl << endl; << nl << endl;
} }
} }

View File

@ -122,6 +122,8 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
mesh_.objectRegistry::store(wallHeatFluxPtr); mesh_.objectRegistry::store(wallHeatFluxPtr);
read(dict); read(dict);
writeFileHeader(file());
} }
@ -267,8 +269,9 @@ bool Foam::functionObjects::wallHeatFlux::write()
if (Pstream::master()) if (Pstream::master())
{ {
writeTime(file());
file() file()
<< mesh_.time().value()
<< token::TAB << pp.name() << token::TAB << pp.name()
<< token::TAB << minHfp << token::TAB << minHfp
<< token::TAB << maxHfp << token::TAB << maxHfp

View File

@ -249,7 +249,9 @@ bool Foam::functionObjects::wallShearStress::write()
if (Pstream::master()) if (Pstream::master())
{ {
file() << mesh_.time().value() writeTime(file());
file()
<< token::TAB << pp.name() << token::TAB << pp.name()
<< token::TAB << minSsp << token::TAB << minSsp
<< token::TAB << maxSsp << token::TAB << maxSsp

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -186,7 +186,7 @@ void Foam::functionObjects::forceCoeffs::writeBinData
Ostream& os Ostream& os
) const ) const
{ {
os << obr_.time().value(); writeTime(os);
for (label bini = 0; bini < nBin_; bini++) for (label bini = 0; bini < nBin_; bini++)
{ {
@ -250,6 +250,14 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
// Free stream velocity magnitude // Free stream velocity magnitude
dict.lookup("magUInf") >> magUInf_; dict.lookup("magUInf") >> magUInf_;
// If case is compressible we must read rhoInf (store in rhoRef_) to
// calculate the reference dynamic pressure
// - note: for incompressible, rhoRef_ is already initialised
if (rhoName_ != "rhoInf")
{
dict.lookup("rhoInf") >> rhoRef_;
}
// Reference length and area scales // Reference length and area scales
dict.lookup("lRef") >> lRef_; dict.lookup("lRef") >> lRef_;
dict.lookup("Aref") >> Aref_; dict.lookup("Aref") >> Aref_;

View File

@ -593,8 +593,9 @@ void Foam::functionObjects::forces::writeIntegratedForceMoment
{ {
Ostream& os = osPtr(); Ostream& os = osPtr();
os << obr_.time().value() writeTime(os);
<< tab << total
os << tab << total
<< tab << pressure << tab << pressure
<< tab << viscous; << tab << viscous;

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