Commit 12c1d0fb authored by mattijs's avatar mattijs
Browse files

Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

parents b304d4ea 8e9d4198
Test-objectRegistry.C
EXE = $(FOAM_USER_APPBIN)/Test-objectRegistry
/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
/* EXE_LIBS = -lfiniteVolume */
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-objectRegistry
Description
Simple test of objectRegistry functionality.
Particular focus on the behaviour of subRegistry.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
#include "IOstreams.H"
#include "objectRegistry.H"
#include "hashedWordList.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// file variable, needed for switching the default in lookupObject etc.
bool recursive = false;
template<class Type>
Foam::Ostream& printList(Foam::Ostream& os, const UList<Type>& list)
{
// list with out any linebreaks
os << '(';
forAll(list, i)
{
if (i) os << ' ';
os << list[i];
}
os << ')';
return os;
}
void printRegistry
(
Foam::Ostream& os,
const Foam::objectRegistry& obr,
Foam::label indent = 4
);
void printRegistry
(
Foam::Ostream& os,
const Foam::objectRegistry& obr,
Foam::label indent
)
{
hashedWordList regs = obr.names<objectRegistry>();
regs.sort();
wordList names = obr.sortedNames();
std::string prefix;
for (label i=indent; i; --i)
{
prefix += ' ';
}
os << '#' << prefix.c_str() << obr.name()
<< " parent:" << obr.parent().name() << nl;
// all names
{
os << ' ' << prefix.c_str() << "objects: ";
printList(os, names) << nl;
}
// sub-registry names
{
os << ' ' << prefix.c_str() << "registries: ";
printList(os, regs) << nl;
}
// Print, but skip expansion of sub-registries for now
forAll(names, i)
{
const word& name = names[i];
os << (regs.found(name) ? '-' : ' ')
<< prefix.c_str() << name << " => " << obr[name]->type() << nl;
}
for (label i=indent; i; --i)
{
os << '-'; // divider
}
os << '\n';
// Now descend into the sub-registries
forAll(regs, i)
{
const word& name = regs[i];
const objectRegistry& next = obr.lookupObject<objectRegistry>
(
name
);
os << prefix.c_str()
<< "current:" << obr.name() << " next:"
<< next.name() << " next-parent:" << next.parent().name() << nl;
os << prefix.c_str() << name << " => " << obr[name]->type();
if ("dictionary" == obr[name]->type())
{
os << " (skip dictionary)" << nl;
}
else
{
os << nl;
printRegistry(os, next, indent + 4);
}
}
}
// Main program:
int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::addBoolOption
(
"mesh",
"test with polyMesh objectRegistry instead of runTime"
);
argList::addBoolOption
(
"skip",
"skip some parts"
);
// argList::validArgs.append("recursive (true|false)");
#include "setRootCase.H"
#include "createTime.H"
#include "createPolyMesh.H"
// recursive = Switch(args[1]);
const bool optMesh = args.optionFound("mesh");
const bool optSkip = args.optionFound("skip");
const objectRegistry& db = (optMesh ? mesh.thisDb() : runTime);
Info<<"## start ##" << nl;
printRegistry(Info, db);
Info<< nl;
const label nRegs = 3;
// Add some items
for (label j = 0; j < 3; ++j)
{
word entryName = "entry" + name(j);
db.subRegistry
(
entryName,
true
);
}
Info<<"## initally populated ##" << nl;
printRegistry(Info, db);
Info<< nl;
// create a few sub-registries
for (label i = 0; i < nRegs; ++i)
{
word regName = "subreg" + name(i);
const objectRegistry& subreg = db.subRegistry
(
regName,
true
);
for (label j = 0; j < 3; ++j)
{
word entryName = "entry" + name(j);
subreg.subRegistry
(
entryName,
true
);
subreg.subRegistry
(
"$" + entryName, // qualified to avoid collisions
true
);
}
}
Info<<"## after adding sub-registries" << nl;
printRegistry(Info, db);
Info<< nl;
// Add further items into top-level
for (label j = 0; j < 6; ++j)
{
word entryName = "entry" + name(j);
db.subRegistry
(
entryName,
true
);
}
Info<< "after adding some entries, top-level now contains: ";
printList(Info, db.names()) << endl;
Info<<"## Now attempt to add a few more entries ##" << nl;
// Try adding the same items into sub registry
// create a few sub-registries
for (label i = 0; i < nRegs; ++i)
{
word regName = "subreg" + name(i);
const objectRegistry& subreg = db.subRegistry
(
regName,
false
);
if (!optSkip)
{
for (label j = 0; j < 6; ++j)
{
word entryName = "entry" + name(j);
subreg.subRegistry
(
entryName,
true
);
}
}
}
Info<<"## Complete picture ##" << nl;
printRegistry(Info, db);
Info<< nl;
return 0;
}
// ************************************************************************* //
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -148,6 +148,15 @@ int main(int argc, char *argv[])
dictPath =
runTime.constant()
/regionPath/polyMesh::meshSubDir/dictName;
// Warn that constant/polyMesh/blockMesh was selected instead of
// system/blockMesh
WarningIn(args[0])
<< "Using the old blockMeshDict location: "
<< dictPath << nl
<< " instead of the default location: "
<< runTime.system()/regionPath/dictName << nl
<< endl;
}
// Otherwise assume the dictionary is present in the system directory
else
......
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
set -x
#set -x
wclean libso vtkPVReaders
PVblockMeshReader/Allwclean
......
......@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
set -x
#set -x
# deal with client/server vs combined plugins
rm -f $FOAM_LIBBIN/libPVFoamReader* 2>/dev/null
......
......@@ -7,29 +7,49 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
# ensure CMake gets the correct C/C++ compilers
# Ensure CMake gets the correct C/C++ compilers
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
# CMake into objectsDir,
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
doCmake()
{
local sourceDir="$1"
findObjectDir $sourceDir # Where are generated files stored?
test -f "$objectsDir/CMakeCache.txt"
retry=$? # CMakeCache.txt exists, but sources may have moved
mkdir -p $objectsDir && \
(
cd $objectsDir || exit 1
cmake $sourceDir || {
if [ $retry -eq 0 ]
then
echo "Removing CMakeCache.txt and attempt again"
rm -f CMakeCache.txt
cmake $sourceDir
else
exit 1
fi
} && make
)
}
if [ -d "$ParaView_DIR" ]
then
wmake $targetType vtkPVFoam
if [ "$targetType" != "objects" ]
if [ "$targetType" != objects ]
then
sourceDir=$PWD/PVFoamReader
# Where are any generated files stored?
findObjectDir $sourceDir
(
mkdir -p $objectsDir \
&& cd $objectsDir \
&& cmake $sourceDir \
&& make
) || {
doCmake $PWD/PVFoamReader || {
echo
echo " WARNING: incomplete build of ParaView OpenFOAM plugin"
echo
echo "WARNING: incomplete build of ParaView OpenFOAM plugin"
}
fi
fi
......
EXE_INC = \
${c++LESSWARN} \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
......
......@@ -4,7 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
set -x
#set -x
# deal with client/server vs combined plugins
rm -f $FOAM_LIBBIN/libPVblockMeshReader* 2>/dev/null
......
......@@ -11,25 +11,45 @@ cd ${0%/*} || exit 1 # Run from this directory
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
# CMake into objectsDir,
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
doCmake()
{
local sourceDir="$1"
findObjectDir $sourceDir # Where are generated files stored?
test -f "$objectsDir/CMakeCache.txt"
retry=$? # CMakeCache.txt exists, but sources may have moved
mkdir -p $objectsDir && \
(
cd $objectsDir || exit 1
cmake $sourceDir || {
if [ $retry -eq 0 ]
then
echo "Removing CMakeCache.txt and attempt again"
rm -f CMakeCache.txt
cmake $sourceDir
else
exit 1
fi
} && make
)
}
if [ -d "$ParaView_DIR" ]
then
wmake $targetType vtkPVblockMesh
if [ "$targetType" != "objects" ]
if [ "$targetType" != objects ]
then
sourceDir=$PWD/PVblockMeshReader
# Where are any generated files stored?
findObjectDir $sourceDir
(
mkdir -p $objectsDir \
&& cd $objectsDir \
&& cmake $sourceDir \
&& make
) || {
doCmake $PWD/PVblockMeshReader || {
echo
echo " WARNING: incomplete build of ParaView BlockMesh plugin"
echo
echo "WARNING: incomplete build of ParaView BlockMesh plugin"
}
fi
fi
......
EXE_INC = \
${c++LESSWARN} \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
......
EXE_INC = \
${c++LESSWARN} \
-I$(ParaView_INCLUDE_DIR) \
-I$(ParaView_INCLUDE_DIR)/vtkkwiml
......
......@@ -35,7 +35,7 @@
#------------------------------------------------------------------------------
#
# Use other (shipped) paraview.csh with a different ParaView_VERSION
# Use other (shipped) paraview with a different ParaView_VERSION
#
set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o config.csh/paraview`
......
......@@ -60,6 +60,12 @@ case OPENMPI:
# Tell OpenMPI where to find its install directory
setenv OPAL_PREFIX $MPI_ARCH_PATH
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using OPENMPI:"
echo " OPAL_PREFIX : $OPAL_PREFIX"
echo " FOAM_MPI : $FOAM_MPI"
endif
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man
......@@ -111,8 +117,8 @@ case SYSTEMMPI:
case MPICH:
setenv FOAM_MPI mpich2-1.1.1p1
setenv MPI_HOME $WM_THIRD_PARTY_DIR/$FOAM_MPI
setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
setenv MPI_HOME $MPI_ARCH_PATH
_foamAddPath $MPI_ARCH_PATH/bin
......
......@@ -41,17 +41,17 @@
# If using a central installation not located under ThirdParty, you will
# need to set some environment values directly. For example,
#
# setenv ParaView_DIR /opt/paraview/paraview-5.2.0
# setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-5.2
# setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-5.2
# setenv ParaView_DIR /opt/paraview/paraview-5.0.1
# setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-5.0
# setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-5.0
#
# setenv PATH ${ParaView_DIR}/bin:${PATH}
# setenv LD_LIBRARY_PATH ${ParaView_DIR}/lib/paraview-5.2:${LD_LIBRARY_PATH}
# setenv LD_LIBRARY_PATH ${ParaView_DIR}/lib/paraview-5.0:${LD_LIBRARY_PATH}
# unsetenv ParaView_VERSION # avoid using ThirdParty settings
#
#------------------------------------------------------------------------------
setenv ParaView_VERSION 5.2.0
setenv ParaView_VERSION 5.0.1
setenv ParaView_MAJOR detect # Automatically determine major version
set cmake_version=cmake-system
......@@ -66,7 +66,8 @@ if ( $status == 0 ) setenv PATH $cleaned
# ThirdParty cmake
set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake_version
if ( -r $cmake/bin/cmake ) then
_foamAddPath $cmake/bin
# _foamAddPath not available when foamPV alias is used
setenv PATH $cmake/bin:${PATH}
endif
# Evaluate command-line parameters for ParaView
......@@ -101,12 +102,11 @@ if ( $?ParaView_VERSION ) then
set pvName=ParaView-$ParaView_VERSION
set pvMajor=paraview-$ParaView_MAJOR
set pvSrcDir=$WM_THIRD_PARTY_DIR/$pvName
setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$pvName
# Set paths if binaries or source are present
if ( -r $ParaView_DIR || -r $pvSrcDir ) then
# Set paths if binaries are present
if ( -r $ParaView_DIR ) then
set pvLibDir=${ParaView_DIR}/lib/$pvMajor
set pvPython=$ParaView_DIR/Utilities/VTKPythonWrapping
......@@ -132,13 +132,18 @@ if ( $?ParaView_VERSION ) then
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
endif
else
if ($?FOAM_VERBOSE && $?prompt) then
echo "No paraview found"
echo " ParaView_DIR : $ParaView_DIR"
endif
unsetenv ParaView_INCLUDE_DIR PV_PLUGIN_PATH
setenv ParaView_DIR # Defined but empty (used by foamPV alias)
endif
endif
unset cleaned cmake cmake_version pvName pvMajor pvSrcDir pvLibDir pvPython
unsetenv ParaView_VERSION ParaView_MAJOR
unset cleaned cmake cmake_version pvName pvMajor pvLibDir pvPython
unsetenv ParaView_MAJOR ParaView_VERSION
#------------------------------------------------------------------------------
......@@ -63,6 +63,13 @@ OPENMPI)
# Tell OpenMPI where to find its install directory
export OPAL_PREFIX=$MPI_ARCH_PATH
if [ "$FOAM_VERBOSE" -a "$PS1" ]
then
echo "Using OPENMPI:" 1>&2
echo " OPAL_PREFIX : $OPAL_PREFIX" 1>&2
echo " FOAM_MPI : $FOAM_MPI" 1>&2
fi
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man
......@@ -118,8 +125,8 @@ SYSTEMMPI)
MPICH)