foamHelp: Removed

This commit is contained in:
Henry Weller
2018-06-19 17:14:06 +01:00
parent 241b4a60fc
commit 2e37f57275
19 changed files with 0 additions and 1567 deletions

View File

@ -1,8 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
wclean libso helpTypes
wclean
#------------------------------------------------------------------------------

View File

@ -1,10 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmake $targetType helpTypes
wmake $targetType
#------------------------------------------------------------------------------

View File

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

View File

@ -1,15 +0,0 @@
EXE_INC = \
-IhelpTypes/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lhelpTypes \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lradiationModels \
-lfluidThermophysicalModels \
-lfiniteVolume \
-lmeshTools \
-lfvOptions

View File

@ -1,68 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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

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

View File

@ -1,10 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lradiationModels \
-lfluidThermophysicalModels

View File

@ -1,246 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 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)
{
// Pre-construct and compile regular expressions
const wordRe nameRe(".*.H", wordRe::DETECT);
const wordRe searchStrRe(searchStr, wordRe::DETECT);
// Pre-construct constant strings and names to speed-up comparisons
const string slashStartTag('/' + startTag);
const string kindFileStr("kind=\"file\"");
const word compoundWord("compound");
const word nameWord("name");
const word pathWord("path");
const word filenameWord("filename");
IFstream is(fName);
// Skip forward to entry name
skipForward(is, startTag);
char c;
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 == slashStartTag)
{
break;
}
if ((blockName == compoundWord) && (params == kindFileStr))
{
// 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 == nameWord)
{
getValue<word>(is, name);
if (nameRe.match(name))
{
foundName = true;
}
else
{
// Not interested in this compound
break;
}
}
else if (entryName == pathWord)
{
getValue<fileName>(is, path);
// Filter path on regExp
if (searchStrRe.match(path))
{
foundPath = true;
}
else
{
// Not interested in this compound
break;
}
}
else if (entryName == filenameWord)
{
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;
char c;
while (is.good() && (closeName != blockName))
{
// Fast-forward until we reach a '<'
while (is.get(c) && c != '<')
{}
// Check to see if this is a closing block
if (is.get(c) && c == '/')
{
closeName = "";
while (is.get(c) && c != '>')
{
closeName += c;
}
}
}
}
void Foam::doxygenXmlParser::skipForward
(
IFstream& is,
const word& blockName
) const
{
// Recurse to move forward in 'is' until come across <blockName>
string entryName = "";
char c;
while (is.good() && (entryName != blockName))
{
entryName = "";
// Fast-forward until we reach a '<'
while (is.get(c) && c != '<')
{}
while (is.get(c) && c != '>')
{
entryName = entryName + c;
}
}
}
// ************************************************************************* //

View File

@ -1,99 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 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
Parser for doxygen XML
SourceFiles
doxygenXmlParser.C
\*---------------------------------------------------------------------------*/
#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

@ -1,67 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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

@ -1,172 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2018 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)
{
FatalErrorInFunction
<< "Please unset FOAM_ABORT to use this utility"
<< 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
);
// Check for any type of volField
if (fieldHeader.typeHeaderOk<volScalarField>(false))
{
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
{
FatalErrorInFunction
<< "Unable to read field " << fieldName << exit(FatalError);
}
}
else if (args.optionReadIfPresent("fixedValue", fieldName))
{
FatalErrorInFunction
<< "-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

@ -1,126 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2018 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::helpTypes::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
See also
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

@ -1,158 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2017 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, 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 (...)
{}
}
if (!foundFixed)
{
// no conditions???
Info<< " none" << nl;
}
Info<< endl;
}
// ************************************************************************* //

View File

@ -1,88 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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

@ -1,98 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2018 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::helpTypes::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
See also
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

@ -1,182 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 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 classDirectory(parser.subDict(className).lookup("path"));
word classFile(parser.subDict(className).lookup("name"));
Info<< "Showing documentation for type " << className << nl << endl;
Info<< "Source file: " << classDirectory.c_str() << classFile << nl
<< endl;
system(docBrowser);
}
else
{
FatalErrorInFunction
<< "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

@ -1,125 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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

@ -1,65 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 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")
{
FatalErrorInFunction
<< "Valid helpType selections are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
else
{
FatalErrorInFunction
<< "Unknown helpType type " << helpTypeName << nl
<< "Valid helpType selections are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< abort(FatalError);
}
}
return autoPtr<helpType>(cstrIter()());
}
// ************************************************************************* //

View File

@ -1614,25 +1614,6 @@ _foamFormatConvert_ ()
} }
complete -o filenames -o nospace -F _foamFormatConvert_ foamFormatConvert complete -o filenames -o nospace -F _foamFormatConvert_ foamFormatConvert
_foamHelp_ ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
local line=${COMP_LINE}
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
opts=""
for o in $used ; do opts="${opts/$o/}" ; done
extra=""
[ "$COMP_CWORD" = 1 ] || \
case "$prev" in
*) ;;
esac
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
}
complete -o filenames -o nospace -F _foamHelp_ foamHelp
_foamListTimes_ () _foamListTimes_ ()
{ {
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"