ENH: export FOAM_API in dictionary (issue #1158)

- uses the value of foamVersion::api, which should be reliable.
This commit is contained in:
Mark Olesen
2019-01-07 19:04:50 +01:00
parent 62a7582d6d
commit cf8d500f8c
7 changed files with 39 additions and 5 deletions

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
_FOAM_API $FOAM_API;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,6 +30,7 @@ License
#include "areaFaMesh.H" #include "areaFaMesh.H"
#include "faMesh.H" #include "faMesh.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "foamVersion.H"
#include "Time.H" #include "Time.H"
#include "patchZones.H" #include "patchZones.H"
#include "IOobjectList.H" #include "IOobjectList.H"
@ -314,6 +315,9 @@ Foam::vtkPVFoam::vtkPVFoam
fullCasePath = cwd(); fullCasePath = cwd();
} }
// OPENFOAM API
setEnv("FOAM_API", std::to_string(foamVersion::api), true);
// The name of the executable, unless already present in the environment // The name of the executable, unless already present in the environment
setEnv("FOAM_EXECUTABLE", "paraview", false); setEnv("FOAM_EXECUTABLE", "paraview", false);

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) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -29,6 +29,7 @@ License
// OpenFOAM includes // OpenFOAM includes
#include "blockMesh.H" #include "blockMesh.H"
#include "blockMeshTools.H" #include "blockMeshTools.H"
#include "foamVersion.H"
#include "Time.H" #include "Time.H"
#include "patchZones.H" #include "patchZones.H"
#include "StringStream.H" #include "StringStream.H"
@ -206,6 +207,9 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
fullCasePath = cwd(); fullCasePath = cwd();
} }
// OPENFOAM API
setEnv("FOAM_API", std::to_string(foamVersion::api), true);
// The name of the executable, unless already present in the environment // The name of the executable, unless already present in the environment
setEnv("FOAM_EXECUTABLE", "paraview", false); setEnv("FOAM_EXECUTABLE", "paraview", false);

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-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -73,6 +73,7 @@ unsetenv WM_THIRD_PARTY_DIR
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Unset FOAM_* environment variables # Unset FOAM_* environment variables
unsetenv FOAM_API
unsetenv FOAM_APPBIN unsetenv FOAM_APPBIN
unsetenv FOAM_APP unsetenv FOAM_APP
unsetenv FOAM_CODE_TEMPLATES unsetenv FOAM_CODE_TEMPLATES

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-2018 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -63,6 +63,7 @@ unset WM_THIRD_PARTY_DIR
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Unset FOAM_* environment variables # Unset FOAM_* environment variables
unset FOAM_API
unset FOAM_APPBIN unset FOAM_APPBIN
unset FOAM_APP unset FOAM_APP
unset FOAM_CODE_TEMPLATES unset FOAM_CODE_TEMPLATES

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-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -672,6 +672,9 @@ void Foam::argList::setCasePaths()
globalCase_ = caseDir.name(); globalCase_ = caseDir.name();
case_ = globalCase_; // The (processor) local case name case_ = globalCase_; // The (processor) local case name
// OPENFOAM API
setEnv("FOAM_API", std::to_string(foamVersion::api), true);
// Global case (directory) and case-name as environment variables // Global case (directory) and case-name as environment variables
setEnv("FOAM_CASE", caseDir, true); setEnv("FOAM_CASE", caseDir, true);
setEnv("FOAM_CASENAME", globalCase_, true); setEnv("FOAM_CASENAME", globalCase_, 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-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,6 +57,8 @@ Description
may be present for some solvers or utilities. may be present for some solvers or utilities.
Environment variables set by argList or by Time: Environment variables set by argList or by Time:
- \par FOAM_API
The value of foamVersion::api
- \par FOAM_CASE - \par FOAM_CASE
The path of the global case. The path of the global case.
It is the same for serial and parallel jobs. It is the same for serial and parallel jobs.