Skip to content
Snippets Groups Projects
Commit 09aa3d8b authored by Mark OLESEN's avatar Mark OLESEN
Browse files

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

parent ccc751e5
Branches
Tags
No related merge requests found
Showing
with 36 additions and 45 deletions
......@@ -27,6 +27,7 @@ License
#include "mixtureViscosityModel.H"
#include "volFields.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......
......@@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "phaseChangeTwoPhaseMixture.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......
......@@ -28,6 +28,7 @@ License
#include "phaseChangeTwoPhaseMixture.H"
#include "incompressibleTwoPhaseMixture.H"
#include "surfaceMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -73,9 +73,6 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
<< "combustion model " << combModelName << "." << endl;
}
typedef typename CombustionModel::dictionaryConstructorTable cstrTableType;
cstrTableType* cstrTable = CombustionModel::dictionaryConstructorTablePtr_;
const word compCombModelName
(
combModelName + '<' + CombustionModel::reactionThermo::typeName + '>'
......@@ -87,9 +84,12 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
+ 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())
{
......@@ -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));
......@@ -163,7 +163,7 @@ Foam::autoPtr<CombustionModel> Foam::combustionModel::New
(
combustionModel::typeName,
combModelName,
*cstrTable
cnstrTable
)
<< "All " << validCmpts2[0][0] << '/' << validCmpts2[0][1]
<< " combinations are:" << nl << nl;
......
......@@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "faPatchFields.H"
#include "areaFaMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -23,12 +23,10 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Finite area edge-based patch fields
\*---------------------------------------------------------------------------*/
#include "faePatchFields.H"
#include "edgeFaMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -33,6 +33,8 @@ License
#include "addToRunTimeSelectionTable.H"
#include "Table.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makePatchFunction1s(Type) \
makePatchFunction1(Type); \
makePatchFunction1Type(ConstantField, Type); \
......@@ -124,42 +126,30 @@ namespace Foam
//// This does not work because we cannot guarantee that the Function1
//// static initialisation has happened already.
//template<class Type>
//class addToUniform
//struct addToUniform
//{
//public:
// addToUniform()
// {
// // Get the Function1 table
// typedef typename Function1<Type>::dictionaryConstructorTable
// F1Type;
// Function1<Type>::constructdictionaryConstructorTables();
// const F1Type& F1Table =
// const auto& F1Table =
// *Function1<Type>::dictionaryConstructorTablePtr_;
//
// // Get the PatchFunction1 table
// typedef typename PatchFunction1<Type>::dictionaryConstructorTable
// PF1Type;
//
// PatchFunction1<Type>::constructdictionaryConstructorTables();
// PF1Type& PF1Table =
// auto& PF1Table =
// *PatchFunction1<Type>::dictionaryConstructorTablePtr_;
//
// // Get the UniformValueField constructor
// auto cstrIter =
// PatchFunction1<Type>::dictionaryConstructorTablePtr_->cfind
// (
// PatchFunction1Types::UniformValueField<Type>::typeName
// );
// auto cstrIter = PF1Table.cfind
// (
// PatchFunction1Types::UniformValueField<Type>::typeName
// );
//
// // Add the UniformValueField under the Function1 name
// forAllConstIters(F1Table, iter)
// {
// //bool ok =
// PF1Table.insert(iter.key(), cstrIter());
// //if (!ok)
// //{
// // std::cout<< "** problem" << std::endl;
// //}
// }
// }
//};
......
......@@ -86,18 +86,17 @@ optimisationType::optimisationType
&& !isA<constrainedOptimisationMethod>(updateMethod_())
)
{
const auto& cnstrTable =
*(constrainedOptimisationMethod::dictionaryConstructorTablePtr_);
// Has constraints but is not a constraint optimisation method
auto cstTablePtr
(
constrainedOptimisationMethod::dictionaryConstructorTablePtr_
);
FatalErrorInFunction
<< "Found " << nConstraints << " adjoint solvers corresponding to "
<< "constraints but the optimisation method used "
<< "(" << updateMethod_().type() << ") "
<< "is not a constrainedOptimisationMethod. " << nl
<< "Available constrainedOptimisationMethods are :" << nl
<< cstTablePtr->sortedToc()
<< "constraints but the optimisation method ("
<< updateMethod_().type()
<< ") is not a constrainedOptimisationMethod." << nl
<< "Available constrainedOptimisationMethods:" << nl
<< cnstrTable.sortedToc()
<< exit(FatalError);
}
else if
......@@ -109,9 +108,9 @@ optimisationType::optimisationType
// Does not have constraints but is a constrained optimisation method
WarningInFunction
<< "Did not find any adjoint solvers corresponding to "
<< "constraints but the optimisation method used "
<< "(" << updateMethod_().type() << ") "
<< "is a constrainedOptimisationMethod. " << nl << nl
<< "constraints but the optimisation method ("
<< updateMethod_().type()
<< ") is a constrainedOptimisationMethod." << nl << nl
<< "This can cause some constraintOptimisationMethods to misbehave."
<< nl << nl
<< "Either the isConstraint bool is not set in one of the adjoint "
......
......@@ -93,7 +93,7 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
Info<< "Selecting chemistry solver " << chemistryTypeDictNew << endl;
auto* cstrTable = ChemistryModel::thermoConstructorTablePtr_;
const auto& cnstrTable = *(ChemistryModel::thermoConstructorTablePtr_);
const word chemSolverCompThermoName
(
......@@ -102,7 +102,7 @@ Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
+ thermo.thermoName() + ">>"
);
auto cstrIter = cstrTable->cfind(chemSolverCompThermoName);
auto cstrIter = cnstrTable.cfind(chemSolverCompThermoName);
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
(
......
......@@ -41,6 +41,7 @@ SourceFiles
#include "runTimeSelectionTables.H"
#include "dimensionedScalar.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "IOdictionary.H"
#include "DynamicField.H"
#include "MeshedSurface.H"
......
......@@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/
#include "reconstructionSchemes.H"
#include "messageStream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment