Commit 1a4507fc authored by mark's avatar mark

STYLE: reorganized code structure

- make a clearer distinction between 'core' and function-object related.
parent 4be3eda9
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
[ -n "$FOAM_USER_LIBBIN" ] || {
echo "Error: FOAM_USER_LIBBIN not set"
......@@ -7,13 +9,9 @@ cd ${0%/*} || exit 1 # run from this directory
exit 1
}
# Build OpenFOAM user libraries and applications
if [ -d src ]
then
src/Allwmake
fi
if [ -d applications ]
then
applications/Allwmake
fi
[ -d src ] && src/Allwmake $targetType $*
# [ -d applications ] && applications/Allwmake $targetType $*
#------------------------------------------------------------------------------
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
makeType=${1:-libso}
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
if [ -n "$ADIOS_DIR" ]
then
echo "using ADIOS_DIR=$ADIOS_DIR"
else
export ADIOS_DIR=$WM_THIRD_PARTY_DIR/platforms/linux64Gcc/adios-git
echo "setting ADIOS_DIR=$ADIOS_DIR"
fi
set -x
postProcessing/Allwmake $*
adiosFoam/Allwmake $targetType $*
postProcessing/Allwmake $targetType $*
# ----------------------------------------------------------------- end-of-file
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
if [ -n "$ADIOS_DIR" ]
then
echo "using ADIOS_DIR=$ADIOS_DIR"
else
export ADIOS_DIR=$WM_THIRD_PARTY_DIR/platforms/linux64Gcc/adios-git
echo "setting ADIOS_DIR=$ADIOS_DIR"
fi
set -x
wmake $targetType
# ----------------------------------------------------------------- end-of-file
adiosTypes.C
adiosTime.C
adiosCore.C
adiosCoreWrite.C
adiosCoreWriteMesh.C
adiosCoreWriteField.C
adiosReader.C
adiosReaderCloudInfo.C
adiosReaderVarInfo.C
lagrangian/ParcelEncoding.C
lagrangian/ParcelEncodingFragment.C
streams/OCompactStream.C
LIB = $(FOAM_USER_LIBBIN)/libadiosFoam
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(RULES)/mplib$(WM_MPLIB)
ADIOS_LIBS := ${shell ${ADIOS_DIR}/bin/adios_config -l}
EXE_INC = -DFOAM_PLATFORM="$(WM_ARCH)$(WM_COMPILER)" \
$(PFLAGS) $(PINC) \
-I${ADIOS_DIR}/include \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = $(PLIBS) \
$(ADIOS_LIBS) \
-llagrangian \
-lmeshTools -lfiniteVolume
......@@ -23,7 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#include "adiosWrite.H"
#include "adiosCoreWrite.H"
#include "volFields.H"
#include "nullObject.H"
#include "IOstreams.H"
......
......@@ -25,6 +25,9 @@ License
#include "adiosCoreWrite.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "OBufStream.H"
#include "IOstream.H"
#include "IOstreams.H"
......
......@@ -374,6 +374,7 @@ class adiosReader::cloudInfo
public fileName
{
word className_;
size_t nBytes_;
//- Total number of parcels (sum of nParcels_ list)
......
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
makeType=${1:-libso}
set -x
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
functionObjects/Allwmake $*
functionObjects/Allwmake $targetType $*
# ----------------------------------------------------------------- end-of-file
......@@ -11,15 +11,13 @@ else
echo "setting ADIOS_DIR=$ADIOS_DIR"
fi
set -x
wmake $targetType streams
# an extra compile options for adios
incdir=$(cd streams && pwd -P)
# extra compile/link options
adiosFoam=$(cd ../../adiosFoam && pwd -P)
export ADIOS_EXTRA_COMP="-I$incdir/lnInclude"
export ADIOS_EXTRA_LINK='-L$(FOAM_USER_LIBBIN) -ladiosStreams'
export ADIOS_EXTRA_COMP="-I$adiosFoam/lnInclude"
export ADIOS_EXTRA_LINK='-L$(FOAM_USER_LIBBIN) -ladiosFoam'
wmake $targetType IOadiosWrite
set -x
wmake $targetType adiosWrite
# ----------------------------------------------------------------- end-of-file
adiosWrite/adiosTypes.C
adiosWrite/adiosCore.C
adiosWrite/adiosCoreWrite.C
adiosWrite/adiosCoreWriteMesh.C
adiosWrite/adiosCoreWriteField.C
adiosWrite/adiosTime.C
adiosWrite/adiosReader.C
adiosWrite/adiosReaderCloudInfo.C
adiosWrite/adiosReaderVarInfo.C
adiosWrite/adiosRegion.C
adiosWrite/adiosWrite.C
adiosWrite/adiosWriteCloud.C
adiosWrite/adiosWriteFunctionObject.C
adiosWrite/adiosRestart.C
adiosWrite/ParcelEncoding.C
adiosWrite/ParcelEncodingFragment.C
/* these files should likely migrate into the OpenFOAM src */
/* adiosWrite/OCompactStream.C */
LIB = $(FOAM_USER_LIBBIN)/libIOadiosWrite
adiosRegion.C
adiosWrite.C
adiosWriteCloud.C
adiosWriteFunctionObject.C
adiosReadData.C
adiosReadField.C
adiosReadCloud.C
LIB = $(FOAM_USER_LIBBIN)/libIOadiosWrite
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(RULES)/mplib$(WM_MPLIB)
ADIOS_INC := -I${ADIOS_DIR}/include -g -O0
ADIOS_LIBS := ${shell ${ADIOS_DIR}/bin/adios_config -l}
EXE_INC = -DFOAM_PLATFORM="$(WM_ARCH)$(WM_COMPILER)" \
EXE_INC = \
$(PFLAGS) $(PINC) \
$(ADIOS_INC) $(ADIOS_EXTRA_COMP) \
-I${ADIOS_DIR}/include $(ADIOS_EXTRA_COMP) \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/spray/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
......@@ -27,7 +24,6 @@ EXE_INC = -DFOAM_PLATFORM="$(WM_ARCH)$(WM_COMPILER)" \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = $(PLIBS) \
$(ADIOS_LIBS) \
${ADIOS_EXTRA_LINK} \
-llagrangian -llagrangianIntermediate -llagrangianSpray \
-lmolecule \
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright(C) 2015 Norbert Podhorszki
\\/ M anipulation | Copyright(C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "adiosWrite.H"
#include "adiosReader.H"
#include "adiosCloudHeaders.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::adiosWrite::readCloudObject
(
regIOobject& obj,
const adiosReader& reader,
const adiosReader::cloudInfo& src
)
{
const word& cloudType = obj.type();
const word& srcType = src.type();
if (cloudType != srcType)
{
// probably fatal:
Info<<"WARNING mismatch on cloud " << src
<< " (expected: " << cloudType
<< " but had " << srcType << ")\n";
return false;
}
// this needs reworking:
if (cloudType == Cloud<indexedParticle>::typeName)
{
// problems...
// return cloudRead
// (
// static_cast<Cloud<indexedParticle>&>(obj),
// reader, src
// );
}
else if (cloudType == Cloud<passiveParticle>::typeName)
{
return cloudRead
(
static_cast<Cloud<passiveParticle>&>(obj),
reader, src
);
}
else if (cloudType == Cloud<basicKinematicCollidingParcel>::typeName)
{
return cloudRead
(
static_cast<Cloud<basicKinematicCollidingParcel>&>(obj),
reader, src
);
}
else if (cloudType == Cloud<basicKinematicMPPICParcel>::typeName)
{
// return cloudRead
// (
// // using alternative
// static_cast<Cloud<basicKinematicParcel>&>(obj),
// reader, src
// );
}
else if (cloudType == Cloud<basicKinematicParcel>::typeName)
{
return cloudRead
(
static_cast<Cloud<basicKinematicParcel>&>(obj),
reader, src
);
}
else if (cloudType == Cloud<basicReactingMultiphaseParcel>::typeName)
{
return cloudRead
(
static_cast<Cloud<basicReactingMultiphaseParcel>&>(obj),
reader, src
);
}
else if (cloudType == Cloud<basicReactingParcel>::typeName)
{
return cloudRead
(
static_cast<Cloud<basicReactingParcel>&>(obj),
reader, src
);
}
// else if (cloudType == Cloud<basicThermoParcel>::typeName)
// else if (cloudType == Cloud<molecule>::typeName)
// else if (cloudType == Cloud<solidParticle>::typeName)
// else if (cloudType == Cloud<basicSprayParcel>::typeName)
else
{
Info<<"read cloud " << obj.name() << " (type " << cloudType
<< ") from file - unsupported type" << endl;
}
return false;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright(C) 2015 Norbert Podhorszki
\\/ M anipulation | Copyright(C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "adiosWrite.H"
#include "adiosReader.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::adiosTime Foam::adiosWrite::readData(const fileName& bpFile)
{
Info<< " Read adios step from file: " << bpFile << endl;
adiosReader reader(bpFile.c_str(), communicator());
if (!reader.isGood())
{
return adiosTime();
}
adiosTime timeInfo(reader);
iobuffer_.reserve(reader.sizeOf()); // this is per process
// direct lookup via time_.lookupClass<fvMesh>() would be nice,
// but have to trick the compiler not to get the const-version.
// - instead, get the names and do the lookup ourselves
wordList meshNames = time_.names<fvMesh>();
sort(meshNames);
// this is somewhat like demand-driven loading
forAll(meshNames, regI)
{
const word& regName = meshNames[regI];
fvMesh& mesh = const_cast<fvMesh&>(time_.lookupObject<fvMesh>(regName));
HashTable<adiosReader::fieldInfo> readerFields = reader.getFieldInfo(regName);
HashTable<adiosReader::cloudInfo> readerClouds = reader.getCloudInfo(regName);
wordList fieldNames = readerFields.sortedToc();
wordList cloudNames = readerClouds.sortedToc();
Info<<"region " << regName << " has reader:" << nl
<< " fields: " << FlatListOutput<word>(fieldNames) << nl
<< " clouds: " << FlatListOutput<word>(cloudNames) << endl;
// fields
forAll(fieldNames, fieldI)
{
const word& name = fieldNames[fieldI];
if ((static_cast<objectRegistry&>(mesh)).found(name))
{
readFieldObject
(
*(mesh.find(name)()),
reader,
readerFields[name]
);
}
}
// clouds
forAll(cloudNames, fieldI)
{
const word& name = cloudNames[fieldI];
if ((static_cast<objectRegistry&>(mesh)).found(name))
{
readCloudObject
(
*(mesh.find(name)()),
reader,
readerClouds[name]
);
}
}
}
reader.close();
return timeInfo;
}
Foam::adiosTime Foam::adiosWrite::readData(const instant& when)
{
return readData(when.name());
}
Foam::adiosTime Foam::adiosWrite::readData()
{
return readData(dataDirectory/obr_.time().timeName() + ".bp");
}
// ************************************************************************* //
......@@ -26,108 +26,14 @@ License
#include "adiosWrite.H"
#include "adiosReader.H"
#include "dictionary.H"
#include "scalar.H"
#include "basicKinematicCloud.H"
#include "basicKinematicCollidingCloud.H"
#include "reactingCloud.H"
#include "emptyFvPatchField.H"
#include "pointFields.H"
#include "IBufStream.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::adiosTime Foam::adiosWrite::readData(const fileName& bpFile)
{
Info<< " Read adios step from file: " << bpFile << endl;
adiosReader reader(bpFile.c_str(), communicator());
if (!reader.isGood())
{
return adiosTime();
}
adiosTime timeInfo(reader);
iobuffer_.reserve(reader.sizeOf()); // this is per process
// direct lookup via time_.lookupClass<fvMesh>() would be nice,
// but have to trick the compiler not to get the const-version.
// - instead, get the names and do the lookup ourselves
wordList meshNames = time_.names<fvMesh>();
sort(meshNames);
// this is somewhat like demand-driven loading
forAll(meshNames, regI)
{
const word& regName = meshNames[regI];
fvMesh& mesh = const_cast<fvMesh&>(time_.lookupObject<fvMesh>(regName));
HashTable<adiosReader::fieldInfo> readerFields = reader.getFieldInfo(regName);
HashTable<adiosReader::cloudInfo> readerClouds = reader.getCloudInfo(regName);
wordList fieldNames = readerFields.sortedToc();
wordList cloudNames = readerClouds.sortedToc();
Info<<"region " << regName << " has reader:" << nl
<< " fields: " << FlatListOutput<word>(fieldNames) << nl
<< " clouds: " << FlatListOutput<word>(cloudNames) << endl;
// fields
forAll(fieldNames, fieldI)
{
const word& name = fieldNames[fieldI];
if ((static_cast<objectRegistry&>(mesh)).found(name))
{
readFieldObject
(
*(mesh.find(name)()),
reader,
readerFields[name]
);
}
}
// clouds
forAll(cloudNames, fieldI)
{
const word& name = cloudNames[fieldI];
if ((static_cast<objectRegistry&>(mesh)).found(name))
{
readCloudObject
(
*(mesh.find(name)()),
reader,
readerClouds[name]
);
}
}
}
reader.close();
return timeInfo;
}
Foam::adiosTime Foam::adiosWrite::readData(const instant& when)
{
return readData(when.name());
}
Foam::adiosTime Foam::adiosWrite::readData()
{
return readData(dataDirectory/obr_.time().timeName() + ".bp");
}
bool Foam::adiosWrite::readFieldObject
(
regIOobject& obj,
......@@ -283,96 +189,4 @@ bool Foam::adiosWrite::readFieldObject
}
bool Foam::adiosWrite::readCloudObject
(
regIOobject& obj,
const adiosReader& reader,
const adiosReader::cloudInfo& src
)
{
const word& cloudType = obj.type();
const word& srcType = src.type();
if (cloudType != srcType)
{
// probably fatal:
Info<<"WARNING mismatch on cloud " << src
<< " (expected: " << cloudType
<< " but had " << srcType << ")\n";
return false;
}
// this needs reworking:
if (cloudType == Cloud<indexedParticle>::typeName)
{
// problems...
// return cloudRead
// (
// static_cast<Cloud<indexedParticle>&>(obj),
// reader, src
// );
}
else if (cloudType == Cloud<passiveParticle>::typeName)
{
return cloudRead
(
static_cast<Cloud<passiveParticle>&>(obj),
reader, src
);
}
else if (cloudType == Cloud<basicKinematicCollidingParcel>::typeName)