diff --git a/applications/test/00-dummy/Test-dummyLib.C b/applications/test/00-dummy/Test-dummyLib.C index e89e8f45d7..0e78ca738e 100644 --- a/applications/test/00-dummy/Test-dummyLib.C +++ b/applications/test/00-dummy/Test-dummyLib.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,33 +32,121 @@ Description \*---------------------------------------------------------------------------*/ #include "dummyLib.H" +#include #include +constexpr char nl = '\n'; +constexpr const char* const bold = "\\fB"; // nroff +constexpr const char* const norm = "\\fR"; // nroff + +constexpr const char* const website = "www.openfoam.com"; + +using std::cout; +using wmake = Foam::Detail::dummyLib; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: + +static void printMan(const char* exeName) +{ + cout + << ".TH \"" << exeName << "\" 1 " + << "\"OpenFOAM-v" << OPENFOAM + << "\" \"" << website << "\" \"OpenFOAM Commands Manual\"" + << nl; + + cout + << ".SH NAME" << nl + << exeName + << " \\- part of " << bold << "OpenFOAM" << norm + << " (The Open Source CFD Toolbox)." << nl + << ".SH SYNOPSIS" << nl + << bold << exeName << norm << " [OPTIONS]" << nl; + + cout + << ".SH DESCRIPTION" << nl + << ".nf" << nl + << "Minimal compilation test with wmake, without OpenFOAM libraries." + << nl + << ".fi" << nl; + + cout + << ".SH OPTIONS" << nl + << ".TP" << nl + << "-help-man" << nl + << "Display manpage" << nl; + + cout + << ".SH INFORMATION" << nl + << ".nf" << nl + << "label = " << wmake::label_size << nl + << "scalar = " << wmake::scalar_size; + + if + ( + wmake::solveScalar_size + && wmake::solveScalar_size != wmake::scalar_size + ) + { + cout + << " [solve=" << wmake::solveScalar_size << "]"; + } + cout + << " (" << wmake::precision << ')' << nl + << "arch = " << wmake::arch << nl + << "compiler = " << wmake::compiler << nl; + + cout + << nl + << "archComp = " << wmake::archComp << nl + << "archCompBase = " << wmake::archCompBase << nl + << "archCompFull = " << wmake::archCompFull << nl; + cout + << ".fi" << nl; + + cout + << ".SH \"SEE ALSO\"" << nl + << "Online documentation https://" << website << "/documentation/" + << nl; +} + int main(int argc, char *argv[]) { - using wmake = Foam::Detail::dummyLib; + // Process -help-man + if (argc > 1 && strcmp(argv[1], "-help-man") == 0) + { + printMan("Test-dummyLib"); + return 0; + } - std::cout - << '\n' - << "OPENFOAM = " << OPENFOAM << '\n' - << "label = " << wmake::label_size << '\n' + cout + << nl + << "OPENFOAM = " << OPENFOAM << nl + << "label = " << wmake::label_size << nl << "scalar = " << wmake::scalar_size - << " (" << wmake::precision << ")\n" - << "arch = " << wmake::arch << '\n' - << "compiler = " << wmake::compiler << '\n'; + << " (" << wmake::precision << ')' << nl; + if + ( + wmake::solveScalar_size + && wmake::solveScalar_size != wmake::scalar_size + ) + { + cout + << "solve = " << wmake::solveScalar_size << nl; + } - std::cout - << '\n' - << "archComp = " << wmake::archComp << '\n' - << "archCompBase = " << wmake::archCompBase << '\n' - << "archCompFull = " << wmake::archCompFull << '\n'; + cout + << "arch = " << wmake::arch << nl + << "compiler = " << wmake::compiler << nl; - std::cout - << '\n'; + cout + << nl + << "archComp = " << wmake::archComp << nl + << "archCompBase = " << wmake::archCompBase << nl + << "archCompFull = " << wmake::archCompFull << nl; + + cout<< nl; return 0; } diff --git a/applications/test/00-dummy/dummy/dummyLib.C b/applications/test/00-dummy/dummy/dummyLib.C index bbb1326b77..1130023f40 100644 --- a/applications/test/00-dummy/dummy/dummyLib.C +++ b/applications/test/00-dummy/dummy/dummyLib.C @@ -29,12 +29,15 @@ License // We know that our options file has properly defined types here +#undef SOLVE_SIZE + #if defined WM_SP # define PRECISION "SP" # define SCALAR_SIZE (8*sizeof(float)) #elif defined(WM_SPDP) # define PRECISION "SPDP" # define SCALAR_SIZE (8*sizeof(float)) +# define SOLVE_SIZE (8*sizeof(double)) #elif defined WM_DP # define PRECISION "DP" # define SCALAR_SIZE (8*sizeof(double)) @@ -66,14 +69,17 @@ const std::string Foam::Detail::dummyLib::compiler(WM_COMPILER); const std::string Foam::Detail::dummyLib::precision(PRECISION); -const std::string Foam::Detail::dummyLib::scalar_size -( - std::to_string(SCALAR_SIZE) -); +const int Foam::Detail::dummyLib::label_size(WM_LABEL_SIZE); -const std::string Foam::Detail::dummyLib::label_size +const int Foam::Detail::dummyLib::scalar_size(SCALAR_SIZE); + +const int Foam::Detail::dummyLib::solveScalar_size ( - std::to_string(WM_LABEL_SIZE) + #ifdef SOLVE_SIZE + SOLVE_SIZE + #else + SCALAR_SIZE + #endif ); const std::string Foam::Detail::dummyLib::archComp diff --git a/applications/test/00-dummy/dummy/dummyLib.H b/applications/test/00-dummy/dummy/dummyLib.H index 159403977d..7189b250a2 100644 --- a/applications/test/00-dummy/dummy/dummyLib.H +++ b/applications/test/00-dummy/dummy/dummyLib.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,14 +60,17 @@ struct dummyLib //- Compile-time value of WM_COMPILER static const std::string compiler; - //- Compile-time equivalent to WM_PRECISION_OPTION - static const std::string scalar_size; + //- Compile-time of WM_PRECISION_OPTION + static const std::string precision; //- Compile-time of WM_LABEL_SIZE - static const std::string label_size; + static const int label_size; - //- Compile-time value of WM_PRECISION_OPTION - static const std::string precision; + //- Compile-time equivalent to WM_PRECISION_OPTION + static const int scalar_size; + + //- Compile-time equivalent to WM_PRECISION_OPTION + static const int solveScalar_size; //- Compile-time value of WM_ARCH + WM_COMPILER static const std::string archComp;