Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2012-09-27 15:21:32 +01:00
359 changed files with 10715 additions and 2207 deletions

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
wmake libso helpTypes
wmake
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,3 @@
foamHelp.C
EXE = $(FOAM_APPBIN)/foamHelp

View File

@ -0,0 +1,15 @@
EXE_INC = \
-IhelpTypes/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lhelpTypes \
-lfiniteVolume \
-lincompressibleTurbulenceModel \
-lcompressibleTurbulenceModel \
-lincompressibleRASModels \
-lcompressibleRASModels \
-lincompressibleLESModels \
-lcompressibleLESModels \
-lradiationModels \
-lfluidThermophysicalModels

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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
foamHelp
Description
Top level wrapper utility around foam help utilities
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "helpType.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "addRegionOption.H"
if (argc < 2)
{
FatalError
<< "No help utility has been supplied" << nl
<< exit(FatalError);
}
const word utilityName = argv[1];
Foam::autoPtr<Foam::helpType> utility
(
helpType::New(utilityName)
);
utility().init();
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedMesh.H"
utility().execute(args, mesh);
Info<< "End\n" << endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,8 @@
helpType/helpType.C
helpType/helpTypeNew.C
helpBoundary/helpBoundary.C
helpFunctionObject/helpFunctionObject.C
doxygenXmlParser/doxygenXmlParser.C
LIB = $(FOAM_LIBBIN)/libhelpTypes

View File

@ -0,0 +1,13 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lincompressibleTurbulenceModel \
-lcompressibleTurbulenceModel \
-lincompressibleRASModels \
-lcompressibleRASModels \
-lincompressibleLESModels \
-lcompressibleLESModels \
-lradiationModels \
-lbasicThermophysicalModels

View File

@ -0,0 +1,246 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "doxygenXmlParser.H"
#include "wordRe.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::doxygenXmlParser::doxygenXmlParser
(
const fileName& fName,
const string& startTag,
const string& searchStr,
const bool exactMatch
)
:
dictionary(dictionary::null)
{
IFstream is(fName);
char c;
// skip forward to entry name
skipForward(is, startTag);
while (is.get(c))
{
if (c == '<')
{
// if in block, read block name
string blockName = "";
string params = "";
bool readingParam = false;
while (is.get(c) && c != '>')
{
if (c == ' ')
{
readingParam = true;
}
else
{
if (readingParam)
{
params = params + c;
}
else
{
blockName = blockName + c;
}
}
}
if (blockName == '/' + startTag)
{
break;
}
if ((blockName == "compound") && (params == "kind=\"file\""))
{
// keep entry
word name = "";
fileName path = "";
word fName = "";
bool foundName = false;
bool foundPath = false;
bool foundFName = false;
bool earlyExit = false;
while (!foundName || !foundPath || !foundFName)
{
word entryName;
getEntry<word>(is, entryName);
if (entryName == "name")
{
getValue<word>(is, name);
if (wordRe(".*.H", wordRe::DETECT).match(name))
{
foundName = true;
}
else
{
// not interested in this compound
break;
}
}
else if (entryName == "path")
{
getValue<fileName>(is, path);
// filter path on regExp
if (wordRe(searchStr, wordRe::DETECT).match(path))
{
foundPath = true;
}
else
{
// not interested in this compound
break;
}
}
else if (entryName == "filename")
{
getValue<word>(is, fName);
foundFName = true;
}
else
{
skipBlock(is, entryName);
}
}
if (foundPath && !earlyExit)
{
word tName(path.components().last());
// only insert if type is not already known
// NOTE: not ideal for cases where there are multiple types
// but contained within different namespaces
// preferentially take exact match if it exists
if (exactMatch && (tName + ".H") == name)
{
dictionary dict(dictionary::null);
dict.add("name", name);
dict.add("filename", fName + ".html");
dict.add("path", path);
this->add(tName, dict);
}
else if
(
!exactMatch
&& !found(tName)
&& wordRe(".*" + tName + ".*", wordRe::DETECT).match(name)
)
{
dictionary dict(dictionary::null);
dict.add("name", name);
dict.add("filename", fName + ".html");
dict.add("path", path);
this->add(tName, dict);
}
}
// skip remanining entries
skipBlock(is, blockName);
}
else
{
skipBlock(is, blockName);
}
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::doxygenXmlParser::skipBlock(IFstream& is, const word blockName) const
{
// recurse to move forward in 'is' until come across </blockName>
string closeName = "";
// fast-forward until we reach a '<'
char c;
while (is.get(c) && c != '<')
{}
// check to see if this is a closing block
if (is.get(c) && c == '/')
{
while (is.get(c) && c != '>')
{
closeName += c;
}
if (closeName == blockName)
{
// finished reading block
return;
}
else
{
skipBlock(is, blockName);
}
}
else
{
skipBlock(is, blockName);
}
}
void Foam::doxygenXmlParser::skipForward
(
IFstream& is,
const word blockName
) const
{
// recurse to move forward in 'is' until come across <blockName>
// fast-forward until we reach a '<'
char c;
while (is.get(c) && c != '<')
{}
string entryName = "";
while (is.get(c) && c != '>')
{
entryName = entryName + c;
}
if (entryName == blockName)
{
return;
}
else
{
skipForward(is, blockName);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,97 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::doxygenXmlParser
Description
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef doxygenXmlParser_H
#define doxygenXmlParser_H
#include "dictionary.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class doxygenXmlParser Declaration
\*---------------------------------------------------------------------------*/
class doxygenXmlParser
:
public dictionary
{
public:
//- Construct from components
doxygenXmlParser
(
const fileName& fName,
const string& startTag,
const string& searchStr,
const bool exactMatch
);
// Member functions
//- Skip past a block
void skipBlock(IFstream& is, const word blockName) const;
//- Skip forward to block
void skipForward(IFstream& is, const word blockName) const;
//- Return the entry
template<class Type>
void getEntry(IFstream& is, Type& entry) const;
//- Return the entry value
template<class Type>
void getValue(IFstream& is, Type& entry) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "doxygenXmlParserTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "doxygenXmlParser.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::doxygenXmlParser::getEntry(IFstream& is, Type& entry) const
{
char c;
while (is.get(c) && c != '<')
{}
entry = "";
if (is.get(c) && c == '/')
{
return;
}
else
{
entry = entry + c;
}
while (is.get(c) && c != '>')
{
entry = entry + c;
}
}
template<class Type>
void Foam::doxygenXmlParser::getValue(IFstream& is, Type& entry) const
{
char c;
entry = "";
while (is.get(c) && c != '<')
{
entry = entry + c;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,192 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "helpBoundary.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace helpTypes
{
defineTypeNameAndDebug(helpBoundary, 0);
addNamedToRunTimeSelectionTable
(
helpType,
helpBoundary,
dictionary,
boundary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::helpTypes::helpBoundary::helpBoundary()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::helpTypes::helpBoundary::~helpBoundary()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::helpTypes::helpBoundary::init()
{
helpType::init();
argList::validArgs.append("boundary");
argList::addOption
(
"field",
"word",
"list available conditions for field"
);
argList::addBoolOption
(
"constraint",
"list constraint patches"
);
argList::addBoolOption
(
"fixedValue",
"list fixed value patches (use with -field option)"
);
}
void Foam::helpTypes::helpBoundary::execute
(
const argList& args,
const fvMesh& mesh
)
{
bool abortVar(env("FOAM_ABORT"));
if (abortVar)
{
FatalErrorIn
(
"void Foam::helpTypes::helpBoundary::execute"
"("
"const argList&, "
"const fvMesh&"
")"
)
<< "Please unset FOAM_ABORT to use this utlity"
<< exit(FatalError);
}
word condition(word::null);
word fieldName(word::null);
if (args.optionReadIfPresent("browse", condition))
{
// TODO: strip scoping info if present?
// e.g. conditions with leading "compressible::" will not be found
// ".*[fF]vPatchField.*" + className + ".*"
displayDoc(condition, ".*[fF]vPatchField.*", false);
}
else if (args.optionFound("constraint"))
{
HashSet<word> constraintTypes(fvPatch::constraintTypes());
Info<< "Constraint types:" << nl;
forAllConstIter(HashSet<word>, constraintTypes, iter)
{
Info<< " " << iter.key() << nl;
}
Info<< endl;
}
else if (args.optionReadIfPresent("field", fieldName))
{
IOobject fieldHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ
);
if (fieldHeader.headerOk())
{
if (args.optionFound("fixedValue"))
{
fixedValueFieldConditions<scalar>(fieldHeader);
fixedValueFieldConditions<vector>(fieldHeader);
fixedValueFieldConditions<sphericalTensor>(fieldHeader);
fixedValueFieldConditions<symmTensor>(fieldHeader);
fixedValueFieldConditions<tensor>(fieldHeader);
}
else
{
(void)fieldConditions<scalar>(fieldHeader, true);
(void)fieldConditions<vector>(fieldHeader, true);
(void)fieldConditions<sphericalTensor>(fieldHeader, true);
(void)fieldConditions<symmTensor>(fieldHeader, true);
(void)fieldConditions<tensor>(fieldHeader, true);
}
}
else
{
FatalErrorIn
(
"void Foam::helpTypes::helpBoundary::execute"
"("
"const argList&, "
"const fvMesh&"
")"
)
<< "Unable to read field " << fieldName << exit(FatalError);
}
}
else if (args.optionReadIfPresent("fixedValue", fieldName))
{
FatalErrorIn
(
"void Foam::helpTypes::helpBoundary::execute"
"("
"const argList&, "
"const fvMesh&"
")"
)
<< "-field option must be specified when using the -fixedValue "
<< "option" << exit(FatalError);
}
else
{
// TODO: strip scoping info if present?
// e.g. conditions with leading "compressible::" will not be found
// ".*[fF]vPatchField.*" + className + ".*"
displayDocOptions(".*[fF]vPatchField.*", false);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::helpBoundary
Description
This class provides help for boundary conditions (patch fields). When no
additional arguments are given, the utility outputs all known boundary
conditions.
Usage:
\plaintable
\c -browse \<patch type\> | open documentation for patch in browser
\c -field \<name\> | boundary conditions for a given field
\c -constraint | list constraint boundary conditions
\c -fixedValue | list \c fixedValue type boundary conditions
\endplaintable
Note
To use the \c -fixedValue option, the \c -field option should also be used
SeeAlso
Foam::helpType
Foam::fvPatchField
SourceFiles
helpBoundary.C
helpBoundaryTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef helpBoundary_H
#define helpBoundary_H
#include "helpType.H"
#include "IOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace helpTypes
{
/*---------------------------------------------------------------------------*\
Class helpBoundary Declaration
\*---------------------------------------------------------------------------*/
class helpBoundary
:
public helpType
{
protected:
// Protected Member Functions
//- Return/output the available boundary conditions for fields of Type
template<class Type>
wordList fieldConditions(const IOobject& io, const bool write) const;
//- Output the available fixed boundary conditions for fields of Type
template<class Type>
void fixedValueFieldConditions(const IOobject& io) const;
public:
//- Runtime type information
TypeName("helpBoundary");
//- Constructor
helpBoundary();
//- Destructor
virtual ~helpBoundary();
// Member Functions
//- Initialise - typically setting static variables,
// e.g. command line arguments
virtual void init();
//- Execute the help
virtual void execute(const argList& args, const fvMesh& mesh);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace helpTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "helpBoundaryTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "GeometricField.H"
#include "fvPatchField.H"
#include "volMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::wordList Foam::helpTypes::helpBoundary::fieldConditions
(
const IOobject& io,
const bool write
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (io.headerClassName() == fieldType::typeName)
{
wordList types
(
fvPatchField<Type>::dictionaryConstructorTablePtr_->sortedToc()
);
if (write)
{
Info<< "Available boundary conditions for "
<< pTraits<Type>::typeName << " field: " << io.name() << nl;
forAll(types, i)
{
Info<< " " << types[i] << nl;
}
Info<< endl;
}
return types;
}
return wordList();
}
template<class Type>
void Foam::helpTypes::helpBoundary::fixedValueFieldConditions
(
const IOobject& io
) const
{
wordList types(fieldConditions<Type>(io, false));
if (!types.size())
{
return;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& mesh = dynamic_cast<const fvMesh&>(io.db());
fieldType fld
(
IOobject
(
"dummy",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh,
dimensioned<Type>("zero", dimless, pTraits<Type>::zero)
);
Info<< "Fixed value boundary conditions for "
<< pTraits<Type>::typeName << " field: " << io.name() << nl;
// throw exceptions to avoid fatal errors when casting from generic patch
// type to incompatible patch type
FatalIOError.throwExceptions();
FatalError.throwExceptions();
bool foundFixed = false;
forAll(types, i)
{
const word& patchType = types[i];
try
{
polyPatch pp
(
"defaultFaces",
0,
mesh.nInternalFaces(),
0,
mesh.boundaryMesh(),
patchType
);
fvPatch fvp(pp, mesh.boundary());
tmp<fvPatchField<Type> > pf
(
fvPatchField<Type>::New
(
patchType,
fvp,
fld
)
);
if (pf().fixesValue())
{
Info<< " " << patchType << nl;
foundFixed = true;
}
}
catch (...)
{
// do nothing
}
}
if (!foundFixed)
{
// no conditions???
Info<< " none" << nl;
}
Info<< endl;
}
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "helpFunctionObject.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace helpTypes
{
defineTypeNameAndDebug(helpFunctionObject, 0);
addNamedToRunTimeSelectionTable
(
helpType,
helpFunctionObject,
dictionary,
functionObject
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::helpTypes::helpFunctionObject::helpFunctionObject()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::helpTypes::helpFunctionObject::~helpFunctionObject()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::helpTypes::helpFunctionObject::init()
{
helpType::init();
argList::validArgs.append("functionObject");
}
void Foam::helpTypes::helpFunctionObject::execute
(
const argList& args,
const fvMesh& mesh
)
{
word function(word::null);
if (args.optionReadIfPresent("browse", function))
{
displayDoc(function, ".*[fF]unctionObject.*", true);
}
else
{
displayDocOptions(".*[fF]unctionObject.*", true);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::helpFunctionObject
Description
This class provides help for functionObjects. When no additional arguments
are given, the utility outputs all known function objects.
Usage:
\plaintable
\c -browse \<patch type\> | open documentation for object in browser
\endplaintable
SeeAlso
Foam::helpType
Foam::functionObject
SourceFiles
helpFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef helpFunctionObject_H
#define helpFunctionObject_H
#include "helpType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace helpTypes
{
/*---------------------------------------------------------------------------*\
Class helpFunctionObject Declaration
\*---------------------------------------------------------------------------*/
class helpFunctionObject
:
public helpType
{
public:
//- Runtime type information
TypeName("helpFunctionObject");
//- Constructor
helpFunctionObject();
//- Destructor
virtual ~helpFunctionObject();
// Member Functions
//- Initialise - typically setting static variables,
// e.g. command line arguments
virtual void init();
//- Execute the help
virtual void execute(const argList& args, const fvMesh& mesh);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace helpTypes
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "helpType.H"
#include "doxygenXmlParser.H"
#include "SortableList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(helpType, 0);
defineRunTimeSelectionTable(helpType, dictionary);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::fileName Foam::helpType::doxygenPath() const
{
const dictionary& docDict = debug::controlDict().subDict("Documentation");
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
label dirI = -1;
forAll(docDirs, i)
{
if (isDir(docDirs[i].expand()))
{
dirI = i;
break;
}
}
if (dirI == -1)
{
Info<< "No Doxygen sources found under search paths: "
<< docDirs << endl;
return fileName();
}
return docDirs[dirI];
}
void Foam::helpType::displayDocOptions
(
const string& searchStr,
const bool exactMatch
) const
{
fileName doxyPath(doxygenPath());
if (doxyPath.empty())
{
return;
}
Info<< "Found doxygen help in " << doxyPath.c_str() << nl << endl;
doxygenXmlParser parser
(
doxyPath/"../DTAGS",
"tagfile",
searchStr,
exactMatch
);
Info<< "Valid types include:" << nl << SortableList<word>(parser.toc());
}
void Foam::helpType::displayDoc
(
const word& className,
const string& searchStr,
const bool exactMatch
) const
{
fileName doxyPath(doxygenPath());
if (doxyPath.empty())
{
return;
}
Info<< "Found doxygen help in " << doxyPath.c_str() << nl << endl;
string docBrowser = getEnv("FOAM_DOC_BROWSER");
if (docBrowser.empty())
{
const dictionary& docDict =
debug::controlDict().subDict("Documentation");
docDict.lookup("docBrowser") >> docBrowser;
}
doxygenXmlParser parser
(
doxyPath/"../DTAGS",
"tagfile",
searchStr,
exactMatch
);
if (debug)
{
Info<< parser;
}
if (parser.found(className))
{
fileName docFile(doxyPath/parser.subDict(className).lookup("filename"));
// can use FOAM_DOC_BROWSER='application file://%f' if required
docBrowser.replaceAll("%f", docFile);
fileName classFolder(parser.subDict(className).lookup("path"));
word classFile(parser.subDict(className).lookup("name"));
Info<< "Showing documentation for type " << className << nl << endl;
Info<< "Source file: " << classFolder.c_str() << classFile << nl
<< endl;
system(docBrowser);
}
else
{
FatalErrorIn
(
"void Foam::helpType::displayDoc(const word, const string)"
)
<< "No help for type " << className << " found."
<< " Valid options include:" << SortableList<word>(parser.toc())
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::helpType::helpType()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::helpType::~helpType()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::helpType::init()
{
argList::addOption
(
"browse",
"word",
"display documentation for boundary condition in browser"
);
}
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::helpType
Description
Base class for foam help classes
SourceFiles
helpType.C
helpTypeNew.C
\*---------------------------------------------------------------------------*/
#ifndef helpType_H
#define helpType_H
#include "runTimeSelectionTables.H"
#include "autoPtr.H"
#include "argList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// forward declaration of classes
class fvMesh;
/*---------------------------------------------------------------------------*\
Class helpType Declaration
\*---------------------------------------------------------------------------*/
class helpType
{
protected:
//- Return file path to the Doxygen sources (if available)
fileName doxygenPath() const;
//- Display the list of documentation options
void displayDocOptions
(
const string& searchStr,
const bool exactMatch
) const;
//- Display the help documentation in a browser
void displayDoc
(
const word& className,
const string& searchStr,
const bool exactMatch
) const;
public:
//- Runtime type information
TypeName("helpType");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
helpType,
dictionary,
(),
()
);
//- Constructor
helpType();
//- Selector
static autoPtr<helpType> New(const word& helpTypeName);
//- Destructor
virtual ~helpType();
// Member Functions
//- Initialise - typically setting static variables,
// e.g. command line arguments
virtual void init();
//- Execute the help
virtual void execute(const argList& args, const fvMesh& mesh) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "helpType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::helpType> Foam::helpType::New
(
const word& helpTypeName
)
{
Info<< "Selecting helpType " << helpTypeName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(helpTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
// special treatment for -help
// exit without stack trace
if (helpTypeName == "-help")
{
FatalErrorIn("helpType::New()")
<< "Valid helpType selections are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
else
{
FatalErrorIn("helpType::New()")
<< "Unknown helpType type " << helpTypeName << nl
<< "Valid helpType selections are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< abort(FatalError);
}
}
return autoPtr<helpType>(cstrIter()());
}
// ************************************************************************* //

View File

@ -62,6 +62,9 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
QGridLayout* form = new QGridLayout();
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
// ROW 0
// ~~~~~
vtkSMProperty* prop = 0;
// refresh button for updating times/fields
@ -107,10 +110,16 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
);
}
// ROW 1
// ~~~~~
QFrame* hline1 = new QFrame(this);
hline1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline1, 1, 0, 1, 3);
// ROW 2
// ~~~~~
// checkbox for caching mesh
if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0)
{
@ -137,62 +146,10 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
);
}
// cell 2,1 empty
// checkbox for patch names
if ((prop = this->proxy()->GetProperty("UiShowPatchNames")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ShowPatchNames_ = new QCheckBox("Patch Names");
ShowPatchNames_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ShowPatchNames_->setToolTip
(
"Show patch names in render window."
);
// row/col 0,1
form->addWidget(ShowPatchNames_, 2, 1, Qt::AlignLeft);
connect
(
ShowPatchNames_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowPatchNamesToggled())
);
}
// checkbox for Groups Only
if ((prop = this->proxy()->GetProperty("UiShowGroupsOnly")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ShowGroupsOnly_ = new QCheckBox("Groups Only");
ShowGroupsOnly_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ShowGroupsOnly_->setToolTip
(
"Show patchGroups only."
);
// row/col 2, 2
form->addWidget(ShowGroupsOnly_, 2, 2, Qt::AlignLeft);
connect
(
ShowGroupsOnly_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowGroupsOnlyToggled())
);
}
// ROW 3
// ~~~~~
// checkbox for include sets
if ((prop = this->proxy()->GetProperty("UiIncludeSets")) != 0)
@ -221,6 +178,36 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
);
}
// checkbox for Groups Only
if ((prop = this->proxy()->GetProperty("UiShowGroupsOnly")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ShowGroupsOnly_ = new QCheckBox("Groups Only");
ShowGroupsOnly_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ShowGroupsOnly_->setToolTip
(
"Show patchGroups only."
);
// row/col 2, 2
form->addWidget(ShowGroupsOnly_, 3, 1, Qt::AlignLeft);
connect
(
ShowGroupsOnly_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowGroupsOnlyToggled())
);
}
// ROW 4
// ~~~~~
// checkbox for include zones
if ((prop = this->proxy()->GetProperty("UiIncludeZones")) != 0)
@ -240,7 +227,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
);
// row/col 1,1
form->addWidget(IncludeZones_, 3, 1, Qt::AlignLeft);
form->addWidget(IncludeZones_, 4, 0, Qt::AlignLeft);
connect
(
IncludeZones_,
@ -250,6 +237,43 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
);
}
// checkbox for patch names
if ((prop = this->proxy()->GetProperty("UiShowPatchNames")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ShowPatchNames_ = new QCheckBox("Patch Names");
ShowPatchNames_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ShowPatchNames_->setToolTip
(
"Show patch names in render window."
);
// row/col 0,1
form->addWidget(ShowPatchNames_, 4, 1, Qt::AlignLeft);
connect
(
ShowPatchNames_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowPatchNamesToggled())
);
}
// ROW 5
// ~~~~~
QFrame* hline2 = new QFrame(this);
hline2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline2, 5, 0, 1, 3);
// ROW 6
// ~~~~~
// checkbox for vol field interpolation
if ((prop = this->proxy()->GetProperty("UiInterpolateVolFields")) != 0)
{
@ -267,7 +291,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
);
// row/col 1,1
form->addWidget(InterpolateVolFields_, 4, 0, Qt::AlignLeft);
form->addWidget(InterpolateVolFields_, 6, 0, Qt::AlignLeft);
connect
(
InterpolateVolFields_,
@ -294,7 +318,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
);
// row/col 1,1
form->addWidget(ExtrapolatePatches_, 4, 1, Qt::AlignLeft);
form->addWidget(ExtrapolatePatches_, 6, 1, Qt::AlignLeft);
connect
(
ExtrapolatePatches_,
@ -304,9 +328,12 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
);
}
QFrame* hline2 = new QFrame(this);
hline2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline2, 5, 0, 1, 3);
// ROW 7
// ~~~~~
QFrame* hline3 = new QFrame(this);
hline3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline3, 7, 0, 1, 3);
}