mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamHelp - added support for solvers
This commit is contained in:
@ -5,10 +5,10 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lhelpTypes \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lturbulenceModels \
|
||||
-lincompressibleTurbulenceModels \
|
||||
-lcompressibleTurbulenceModels \
|
||||
-lradiationModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
-lfluidThermophysicalModels
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -62,6 +62,8 @@ int main(int argc, char *argv[])
|
||||
utility().execute(args, mesh);
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ helpType/helpType.C
|
||||
helpType/helpTypeNew.C
|
||||
helpBoundary/helpBoundary.C
|
||||
helpFunctionObject/helpFunctionObject.C
|
||||
helpSolver/helpSolver.C
|
||||
|
||||
doxygenXmlParser/doxygenXmlParser.C
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,7 +26,6 @@ License
|
||||
#include "doxygenXmlParser.H"
|
||||
#include "wordRe.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::doxygenXmlParser::doxygenXmlParser
|
||||
@ -34,11 +33,15 @@ Foam::doxygenXmlParser::doxygenXmlParser
|
||||
const fileName& fName,
|
||||
const string& startTag,
|
||||
const string& searchStr,
|
||||
const bool exactMatch
|
||||
const bool exactMatch,
|
||||
const word& ext
|
||||
)
|
||||
:
|
||||
dictionary(dictionary::null)
|
||||
{
|
||||
const wordRe nameRegEx(".*." + ext, wordRe::DETECT);
|
||||
const wordRe searchRegEx(searchStr, wordRe::DETECT);
|
||||
|
||||
IFstream is(fName);
|
||||
|
||||
char c;
|
||||
@ -95,7 +98,8 @@ Foam::doxygenXmlParser::doxygenXmlParser
|
||||
if (entryName == "name")
|
||||
{
|
||||
getValue<word>(is, name);
|
||||
if (wordRe(".*.H", wordRe::DETECT).match(name))
|
||||
|
||||
if (nameRegEx.match(name))
|
||||
{
|
||||
foundName = true;
|
||||
}
|
||||
@ -110,7 +114,7 @@ Foam::doxygenXmlParser::doxygenXmlParser
|
||||
getValue<fileName>(is, path);
|
||||
|
||||
// filter path on regExp
|
||||
if (wordRe(searchStr, wordRe::DETECT).match(path))
|
||||
if (searchRegEx.match(path))
|
||||
{
|
||||
foundPath = true;
|
||||
}
|
||||
@ -139,7 +143,7 @@ Foam::doxygenXmlParser::doxygenXmlParser
|
||||
// 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)
|
||||
if (exactMatch && (tName + "." + ext) == name)
|
||||
{
|
||||
dictionary dict(dictionary::null);
|
||||
dict.add("name", name);
|
||||
@ -150,7 +154,7 @@ Foam::doxygenXmlParser::doxygenXmlParser
|
||||
else if
|
||||
(
|
||||
!exactMatch
|
||||
&& !found(tName)
|
||||
&& !found(tName) // not already added
|
||||
&& wordRe(".*" + tName + ".*", wordRe::DETECT).match(name)
|
||||
)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -60,7 +60,8 @@ public:
|
||||
const fileName& fName,
|
||||
const string& startTag,
|
||||
const string& searchStr,
|
||||
const bool exactMatch
|
||||
const bool exactMatch,
|
||||
const word& ext
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -89,6 +89,8 @@ void Foam::helpTypes::helpBoundary::execute
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
setEnv("FOAM_ABORT", "", true);
|
||||
/*
|
||||
bool abortVar(env("FOAM_ABORT"));
|
||||
if (abortVar)
|
||||
{
|
||||
@ -100,9 +102,10 @@ void Foam::helpTypes::helpBoundary::execute
|
||||
"const fvMesh&"
|
||||
")"
|
||||
)
|
||||
<< "Please unset FOAM_ABORT to use this utlity"
|
||||
<< "Please unset FOAM_ABORT to use this utility"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
*/
|
||||
|
||||
word condition(word::null);
|
||||
word fieldName(word::null);
|
||||
@ -112,7 +115,7 @@ void Foam::helpTypes::helpBoundary::execute
|
||||
// TODO: strip scoping info if present?
|
||||
// e.g. conditions with leading "compressible::" will not be found
|
||||
// ".*[fF]vPatchField.*" + className + ".*"
|
||||
displayDoc(condition, ".*[fF]vPatchField.*", false);
|
||||
displayDoc(condition, ".*[fF]vPatchField.*", false, "H");
|
||||
}
|
||||
else if (args.optionFound("constraint"))
|
||||
{
|
||||
@ -134,6 +137,7 @@ void Foam::helpTypes::helpBoundary::execute
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
// Check for any type of volField
|
||||
if (fieldHeader.headerOk())
|
||||
{
|
||||
if (args.optionFound("fixedValue"))
|
||||
@ -184,7 +188,7 @@ void Foam::helpTypes::helpBoundary::execute
|
||||
// TODO: strip scoping info if present?
|
||||
// e.g. conditions with leading "compressible::" will not be found
|
||||
// ".*[fF]vPatchField.*" + className + ".*"
|
||||
displayDocOptions(".*[fF]vPatchField.*", false);
|
||||
displayDocOptions(".*[fF]vPatchField.*", false, "H");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,11 +76,11 @@ void Foam::helpTypes::helpFunctionObject::execute
|
||||
|
||||
if (args.optionReadIfPresent("browse", function))
|
||||
{
|
||||
displayDoc(function, ".*[fF]unctionObject.*", true);
|
||||
displayDoc(function, ".*[fF]unctionObject.*", true, "H");
|
||||
}
|
||||
else
|
||||
{
|
||||
displayDocOptions(".*[fF]unctionObject.*", true);
|
||||
displayDocOptions(".*[fF]unctionObject.*", true, "H");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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 "helpSolver.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace helpTypes
|
||||
{
|
||||
defineTypeNameAndDebug(helpSolver, 0);
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
helpType,
|
||||
helpSolver,
|
||||
dictionary,
|
||||
solver
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::helpTypes::helpSolver::helpSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::helpTypes::helpSolver::~helpSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::helpTypes::helpSolver::init()
|
||||
{
|
||||
helpType::init();
|
||||
|
||||
argList::validArgs.append("solver");
|
||||
}
|
||||
|
||||
|
||||
void Foam::helpTypes::helpSolver::execute
|
||||
(
|
||||
const argList& args,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
word solver(word::null);
|
||||
|
||||
if (args.optionReadIfPresent("browse", solver))
|
||||
{
|
||||
displayDoc(solver, ".*solvers/.*Foam/", true, "C");
|
||||
}
|
||||
else
|
||||
{
|
||||
displayDocOptions(".*solvers/.*Foam/", true, "C");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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/>.
|
||||
|
||||
Class
|
||||
Foam::helpSolver
|
||||
|
||||
Description
|
||||
This class provides help for solvers. When no additional arguments
|
||||
are given, the utility outputs all known solvers.
|
||||
|
||||
Usage:
|
||||
\plaintable
|
||||
\c -browse \<patch type\> | open documentation for object in browser
|
||||
\endplaintable
|
||||
|
||||
SeeAlso
|
||||
Foam::helpType
|
||||
|
||||
SourceFiles
|
||||
helpSolver.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef helpSolver_H
|
||||
#define helpSolver_H
|
||||
|
||||
#include "helpType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace helpTypes
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class helpSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class helpSolver
|
||||
:
|
||||
public helpType
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("helpSolver");
|
||||
|
||||
//- Constructor
|
||||
helpSolver();
|
||||
|
||||
//- Destructor
|
||||
virtual ~helpSolver();
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -66,7 +66,8 @@ Foam::fileName Foam::helpType::doxygenPath() const
|
||||
void Foam::helpType::displayDocOptions
|
||||
(
|
||||
const string& searchStr,
|
||||
const bool exactMatch
|
||||
const bool exactMatch,
|
||||
const word& ext
|
||||
) const
|
||||
{
|
||||
fileName doxyPath(doxygenPath());
|
||||
@ -83,9 +84,15 @@ void Foam::helpType::displayDocOptions
|
||||
doxyPath/"../DTAGS",
|
||||
"tagfile",
|
||||
searchStr,
|
||||
exactMatch
|
||||
exactMatch,
|
||||
ext
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< parser;
|
||||
}
|
||||
|
||||
Info<< "Valid types include:" << nl << SortableList<word>(parser.toc());
|
||||
}
|
||||
|
||||
@ -94,7 +101,8 @@ void Foam::helpType::displayDoc
|
||||
(
|
||||
const word& className,
|
||||
const string& searchStr,
|
||||
const bool exactMatch
|
||||
const bool exactMatch,
|
||||
const word& ext
|
||||
) const
|
||||
{
|
||||
fileName doxyPath(doxygenPath());
|
||||
@ -119,7 +127,8 @@ void Foam::helpType::displayDoc
|
||||
doxyPath/"../DTAGS",
|
||||
"tagfile",
|
||||
searchStr,
|
||||
exactMatch
|
||||
exactMatch,
|
||||
ext
|
||||
);
|
||||
|
||||
if (debug)
|
||||
@ -152,7 +161,8 @@ void Foam::helpType::displayDoc
|
||||
"("
|
||||
"const word&, "
|
||||
"const string&, "
|
||||
"const bool"
|
||||
"const bool, "
|
||||
"const word&"
|
||||
")"
|
||||
)
|
||||
<< "No help for type " << className << " found."
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,7 +65,8 @@ protected:
|
||||
void displayDocOptions
|
||||
(
|
||||
const string& searchStr,
|
||||
const bool exactMatch
|
||||
const bool exactMatch,
|
||||
const word& ext
|
||||
) const;
|
||||
|
||||
//- Display the help documentation in a browser
|
||||
@ -73,7 +74,8 @@ protected:
|
||||
(
|
||||
const word& className,
|
||||
const string& searchStr,
|
||||
const bool exactMatch
|
||||
const bool exactMatch,
|
||||
const word& ext
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user