diff --git a/applications/utilities/miscellaneous/foamHelp/Make/options b/applications/utilities/miscellaneous/foamHelp/Make/options index b5098371d2..280fed9692 100644 --- a/applications/utilities/miscellaneous/foamHelp/Make/options +++ b/applications/utilities/miscellaneous/foamHelp/Make/options @@ -5,10 +5,10 @@ EXE_INC = \ EXE_LIBS = \ -lhelpTypes \ + -lfiniteVolume \ + -lmeshTools \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ -lcompressibleTurbulenceModels \ -lradiationModels \ - -lfluidThermophysicalModels \ - -lfiniteVolume \ - -lmeshTools + -lfluidThermophysicalModels diff --git a/applications/utilities/miscellaneous/foamHelp/foamHelp.C b/applications/utilities/miscellaneous/foamHelp/foamHelp.C index 39e0cb9130..277b7a024a 100644 --- a/applications/utilities/miscellaneous/foamHelp/foamHelp.C +++ b/applications/utilities/miscellaneous/foamHelp/foamHelp.C @@ -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; } diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/Make/files b/applications/utilities/miscellaneous/foamHelp/helpTypes/Make/files index 1f7de8d62e..35a5b81857 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/Make/files +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/Make/files @@ -2,6 +2,7 @@ helpType/helpType.C helpType/helpTypeNew.C helpBoundary/helpBoundary.C helpFunctionObject/helpFunctionObject.C +helpSolver/helpSolver.C doxygenXmlParser/doxygenXmlParser.C diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.C index b3cc2da3e6..b77feaff34 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/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(is, name); - if (wordRe(".*.H", wordRe::DETECT).match(name)) + + if (nameRegEx.match(name)) { foundName = true; } @@ -110,7 +114,7 @@ Foam::doxygenXmlParser::doxygenXmlParser getValue(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) ) { diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.H b/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.H index 9853589fa3..09af25c57f 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.H +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.H @@ -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 ); diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C index 9fd46f35c1..3fd2a100d3 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundary.C @@ -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"); } } diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpFunctionObject/helpFunctionObject.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpFunctionObject/helpFunctionObject.C index 631a1210ff..c42a430a06 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpFunctionObject/helpFunctionObject.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpFunctionObject/helpFunctionObject.C @@ -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"); } } diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C new file mode 100644 index 0000000000..882b9f2d77 --- /dev/null +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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"); + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.H b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.H new file mode 100644 index 0000000000..6096c3d8bf --- /dev/null +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpSolver/helpSolver.H @@ -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 . + +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 \ | 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 + +// ************************************************************************* // diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C index 65c3fcaca6..e29774ef00 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.C @@ -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(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." diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.H b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.H index f5e65709c6..a3e2449233 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.H +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpType/helpType.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 @@ -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;