Commit d18bdd8b authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: build dummy runTimePostProcessing if VTK/ParaView are not available

- this allows more use of the runTimePostProcessing functionObject
  that will fail more gracefully if the proper version could not be
  built.

  The dummy functionObject simply emits a message that it is not available.
parent 3fd38fce
......@@ -2,10 +2,12 @@
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions # Source wmake functions
# Cleanup library
# This cleanup handles both cmake runTimePostProcessing and the dummy version
# Cleanup library files with .so version endings
rm -f $FOAM_LIBBIN/librunTimePostProcessing* 2>/dev/null
# Cleanup generated files - remove entire top-level
removeObjectDir $PWD
removeObjectDir "$PWD"
#------------------------------------------------------------------------------
......@@ -6,9 +6,9 @@ cd ${0%/*} || exit 1 # Run from this directory
echo "======================================================================"
echo "${PWD##*/} : $PWD"
echo
unset depend
unset depend runTimePostProDebug
if [ -d "$VTK_DIR" ]
then
depend="VTK_DIR=$VTK_DIR"
......@@ -17,25 +17,42 @@ then
depend="ParaView_DIR=$ParaView_DIR"
fi
if [ -n "$depend" ]
# Force use of dummy only
# unset depend
# For rebuilding (on error) instead of dropping back to dummy
# runTimePostProDebug=true
if [ "$targetType" = objects ]
then
depend=ignore
elif [ -n "$depend" ]
then
if [ "$targetType" != objects ]
if command -v cmake > /dev/null 2>&1
then
if command -v cmake > /dev/null 2>&1
then
cmakeVersioned "$depend" $PWD || {
echo
echo " WARNING: incomplete build of VTK-based post-processing"
echo
}
else
echo "WARNING: skipped - needs cmake"
fi
cmakeVersioned "$depend" $PWD || {
echo
echo " WARNING: incomplete build of VTK-based post-processing"
echo
if [ -z "$runTimePostProDebug" ]
then
depend="dummy"
fi
}
else
echo "==> skip runTimePostProcessing (needs cmake)"
depend="dummy"
fi
else
echo "WARNING: skipped - needs a VTK or a ParaView installation"
echo " - For ParaView : export the 'ParaView_DIR' variable"
echo " - For VTK : export the 'VTK_DIR' variable"
echo "WARNING: skip runTimePostProcessing (no VTK or ParaView)"
echo " - ParaView : export the 'ParaView_DIR' variable"
echo " - VTK : export the 'VTK_DIR' variable"
fi
if [ "${depend:-dummy}" = dummy ]
then
echo "==> dummy runTimePostProcessing"
wmakeVersioned "vtk=dummy" $PWD dummy
fi
echo "======================================================================"
......
runTimePostProcessingDummy.C
LIB = $(FOAM_LIBBIN)/librunTimePostProcessing
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 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 "runTimePostProcessingDummy.H"
#include "dictionary.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(runTimePostProcessingDummy, 0);
addToRunTimeSelectionTable
(
functionObject,
runTimePostProcessingDummy,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::runTimePostProcessingDummy::runTimePostProcessingDummy
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
functionObject::unavailableFunctionObject(name)
{
carp
(
"VTK libraries were not available at compilation time"
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 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
Foam::functionObjects::runTimePostPro::runTimePostProcessingDummy
Group
grpGraphicsFunctionObjects
Description
Dummy implementation of runTimePostProcessing to report when
the real version is unavailable.
SourceFiles
runTimePostProcessingDummy.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_runTimePostProcessingDummy_H
#define functionObjects_runTimePostProcessingDummy_H
#include "functionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class runTimePostProcessingDummy Declaration
\*---------------------------------------------------------------------------*/
class runTimePostProcessingDummy
:
public functionObject::unavailableFunctionObject
{
public:
//- Declare type-name, virtual type (with debug switch)
TypeName("runTimePostProcessing");
// Constructors
//- Construct from dictionary
runTimePostProcessingDummy
(
const word& name,
const Time& runTime,
const dictionary& dict
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -80,12 +80,6 @@ Foam::functionObjects::runTimePostProcessing::runTimePostProcessing
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::runTimePostProcessing::~runTimePostProcessing()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -119,15 +119,11 @@ private:
PtrList<runTimePostPro::text> text_;
// Private Member Functions
// Private Member Functions
//- Helper function to read scene objects
template<class Type>
void readObjects
(
const dictionary& dict,
PtrList<Type>& objects
) const;
//- Helper function to read scene objects
template<class Type>
void readObjects(const dictionary& dict, PtrList<Type>& objects) const;
public:
......@@ -143,12 +139,12 @@ public:
(
const word& name,
const Time& runTime,
const dictionary&dict
const dictionary& dict
);
//- Destructor
virtual ~runTimePostProcessing();
virtual ~runTimePostProcessing() = default;
// Member Functions
......@@ -158,8 +154,8 @@ public:
return mesh_;
}
//- Read the field min/max data
virtual bool read(const dictionary&);
//- Read the post-processing controls
virtual bool read(const dictionary& dict);
//- Execute, currently does nothing
virtual bool execute();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment