COMP: avoid incomplete types in runTime tables, unneeded typedefs etc

This commit is contained in:
Mark Olesen
2021-07-13 13:01:12 +02:00
parent ccc751e55d
commit 09aa3d8b43
11 changed files with 36 additions and 45 deletions

View File

@ -27,6 +27,7 @@ License
#include "mixtureViscosityModel.H" #include "mixtureViscosityModel.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "phaseChangeTwoPhaseMixture.H" #include "phaseChangeTwoPhaseMixture.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -28,6 +28,7 @@ License
#include "phaseChangeTwoPhaseMixture.H" #include "phaseChangeTwoPhaseMixture.H"
#include "incompressibleTwoPhaseMixture.H" #include "incompressibleTwoPhaseMixture.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -73,9 +73,6 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
<< "combustion model " << combModelName << "." << endl; << "combustion model " << combModelName << "." << endl;
} }
typedef typename CombustionModel::dictionaryConstructorTable cstrTableType;
cstrTableType* cstrTable = CombustionModel::dictionaryConstructorTablePtr_;
const word compCombModelName const word compCombModelName
( (
combModelName + '<' + CombustionModel::reactionThermo::typeName + '>' combModelName + '<' + CombustionModel::reactionThermo::typeName + '>'
@ -87,9 +84,12 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
+ thermo.thermoName() + '>' + thermo.thermoName() + '>'
); );
auto compCstrIter = cstrTable->cfind(compCombModelName);
auto thermoCstrIter = cstrTable->cfind(thermoCombModelName); const auto& cnstrTable = *(CombustionModel::dictionaryConstructorTablePtr_);
auto compCstrIter = cnstrTable.cfind(compCombModelName);
auto thermoCstrIter = cnstrTable.cfind(thermoCombModelName);
if (!compCstrIter.found() && !thermoCstrIter.found()) if (!compCstrIter.found() && !thermoCstrIter.found())
{ {
@ -129,7 +129,7 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
}) })
); );
for (const word& validName : cstrTable->sortedToc()) for (const word& validName : cnstrTable.sortedToc())
{ {
wordList cmpts(basicThermo::splitThermoName(validName, 2)); wordList cmpts(basicThermo::splitThermoName(validName, 2));
@ -163,7 +163,7 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
( (
combustionModel::typeName, combustionModel::typeName,
combModelName, combModelName,
*cstrTable cnstrTable
) )
<< "All " << validCmpts2[0][0] << '/' << validCmpts2[0][1] << "All " << validCmpts2[0][0] << '/' << validCmpts2[0][1]
<< " combinations are:" << nl << nl; << " combinations are:" << nl << nl;

View File

@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faPatchFields.H" #include "faPatchFields.H"
#include "areaFaMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,12 +23,10 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Finite area edge-based patch fields
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faePatchFields.H" #include "faePatchFields.H"
#include "edgeFaMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -33,6 +33,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "Table.H" #include "Table.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makePatchFunction1s(Type) \ #define makePatchFunction1s(Type) \
makePatchFunction1(Type); \ makePatchFunction1(Type); \
makePatchFunction1Type(ConstantField, Type); \ makePatchFunction1Type(ConstantField, Type); \
@ -124,29 +126,22 @@ namespace Foam
//// This does not work because we cannot guarantee that the Function1 //// This does not work because we cannot guarantee that the Function1
//// static initialisation has happened already. //// static initialisation has happened already.
//template<class Type> //template<class Type>
//class addToUniform //struct addToUniform
//{ //{
//public:
// addToUniform() // addToUniform()
// { // {
// // Get the Function1 table // // Get the Function1 table
// typedef typename Function1<Type>::dictionaryConstructorTable
// F1Type;
// Function1<Type>::constructdictionaryConstructorTables(); // Function1<Type>::constructdictionaryConstructorTables();
// const F1Type& F1Table = // const auto& F1Table =
// *Function1<Type>::dictionaryConstructorTablePtr_; // *Function1<Type>::dictionaryConstructorTablePtr_;
// //
// // Get the PatchFunction1 table // // Get the PatchFunction1 table
// typedef typename PatchFunction1<Type>::dictionaryConstructorTable
// PF1Type;
//
// PatchFunction1<Type>::constructdictionaryConstructorTables(); // PatchFunction1<Type>::constructdictionaryConstructorTables();
// PF1Type& PF1Table = // auto& PF1Table =
// *PatchFunction1<Type>::dictionaryConstructorTablePtr_; // *PatchFunction1<Type>::dictionaryConstructorTablePtr_;
// //
// // Get the UniformValueField constructor // // Get the UniformValueField constructor
// auto cstrIter = // auto cstrIter = PF1Table.cfind
// PatchFunction1<Type>::dictionaryConstructorTablePtr_->cfind
// ( // (
// PatchFunction1Types::UniformValueField<Type>::typeName // PatchFunction1Types::UniformValueField<Type>::typeName
// ); // );
@ -154,12 +149,7 @@ namespace Foam
// // Add the UniformValueField under the Function1 name // // Add the UniformValueField under the Function1 name
// forAllConstIters(F1Table, iter) // forAllConstIters(F1Table, iter)
// { // {
// //bool ok =
// PF1Table.insert(iter.key(), cstrIter()); // PF1Table.insert(iter.key(), cstrIter());
// //if (!ok)
// //{
// // std::cout<< "** problem" << std::endl;
// //}
// } // }
// } // }
//}; //};

View File

@ -86,18 +86,17 @@ optimisationType::optimisationType
&& !isA<constrainedOptimisationMethod>(updateMethod_()) && !isA<constrainedOptimisationMethod>(updateMethod_())
) )
{ {
const auto& cnstrTable =
*(constrainedOptimisationMethod::dictionaryConstructorTablePtr_);
// Has constraints but is not a constraint optimisation method // Has constraints but is not a constraint optimisation method
auto cstTablePtr
(
constrainedOptimisationMethod::dictionaryConstructorTablePtr_
);
FatalErrorInFunction FatalErrorInFunction
<< "Found " << nConstraints << " adjoint solvers corresponding to " << "Found " << nConstraints << " adjoint solvers corresponding to "
<< "constraints but the optimisation method used " << "constraints but the optimisation method ("
<< "(" << updateMethod_().type() << ") " << updateMethod_().type()
<< "is not a constrainedOptimisationMethod. " << nl << ") is not a constrainedOptimisationMethod." << nl
<< "Available constrainedOptimisationMethods are :" << nl << "Available constrainedOptimisationMethods:" << nl
<< cstTablePtr->sortedToc() << cnstrTable.sortedToc()
<< exit(FatalError); << exit(FatalError);
} }
else if else if
@ -109,9 +108,9 @@ optimisationType::optimisationType
// Does not have constraints but is a constrained optimisation method // Does not have constraints but is a constrained optimisation method
WarningInFunction WarningInFunction
<< "Did not find any adjoint solvers corresponding to " << "Did not find any adjoint solvers corresponding to "
<< "constraints but the optimisation method used " << "constraints but the optimisation method ("
<< "(" << updateMethod_().type() << ") " << updateMethod_().type()
<< "is a constrainedOptimisationMethod. " << nl << nl << ") is a constrainedOptimisationMethod." << nl << nl
<< "This can cause some constraintOptimisationMethods to misbehave." << "This can cause some constraintOptimisationMethods to misbehave."
<< nl << nl << nl << nl
<< "Either the isConstraint bool is not set in one of the adjoint " << "Either the isConstraint bool is not set in one of the adjoint "

View File

@ -93,7 +93,7 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
Info<< "Selecting chemistry solver " << chemistryTypeDictNew << endl; Info<< "Selecting chemistry solver " << chemistryTypeDictNew << endl;
auto* cstrTable = ChemistryModel::thermoConstructorTablePtr_; const auto& cnstrTable = *(ChemistryModel::thermoConstructorTablePtr_);
const word chemSolverCompThermoName const word chemSolverCompThermoName
( (
@ -102,7 +102,7 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
+ thermo.thermoName() + ">>" + thermo.thermoName() + ">>"
); );
auto cstrIter = cstrTable->cfind(chemSolverCompThermoName); auto cstrIter = cnstrTable.cfind(chemSolverCompThermoName);
if (!cstrIter.found()) if (!cstrIter.found())
{ {
@ -142,7 +142,7 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
}) })
); );
for (const word& validName : cstrTable->sortedToc()) for (const word& validName : cnstrTable.sortedToc())
{ {
validCmpts.append validCmpts.append
( (

View File

@ -41,6 +41,7 @@ SourceFiles
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "dimensionedScalar.H" #include "dimensionedScalar.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H"
#include "IOdictionary.H" #include "IOdictionary.H"
#include "DynamicField.H" #include "DynamicField.H"
#include "MeshedSurface.H" #include "MeshedSurface.H"

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "reconstructionSchemes.H" #include "reconstructionSchemes.H"
#include "messageStream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //