Commit f729c75b authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: new defineTemplate2TypeNameAndDebug macros

- apparently needed to specialize a templated sub-class of a template
  class
  Normal:
      template<>
      defineDebugSwitchWithName(Type, Name, DebugSwitch)
  New for sub-classes:
      template<>
      template<>
      defineDebugSwitchWithName(Type, Name, DebugSwitch)
parent 97517208
......@@ -109,11 +109,19 @@ public: \
//- Define the typeName as @a Name for template classes
# define defineTemplateTypeNameWithName(Type, Name) \
defineTypeNameWithName(Type, Name)
//- Define the typeName as @a Name for template sub-classes
# define defineTemplate2TypeNameWithName(Type, Name) \
defineTypeNameWithName(Type, Name)
#else
//- Define the typeName as @a Name for template classes
# define defineTemplateTypeNameWithName(Type, Name) \
template<> \
defineTypeNameWithName(Type, Name)
//- Define the typeName as @a Name for template sub-classes
# define defineTemplate2TypeNameWithName(Type, Name) \
template<> \
template<> \
defineTypeNameWithName(Type, Name)
#endif
//- Define the typeName for template classes, useful with typedefs
......@@ -143,11 +151,19 @@ public: \
//- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
defineDebugSwitchWithName(Type, Name, DebugSwitch)
//- Define the debug information for templates sub-classes, lookup as @a Name
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
defineDebugSwitchWithName(Type, Name, DebugSwitch)
#else
//- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
template<> \
defineDebugSwitchWithName(Type, Name, DebugSwitch)
//- Define the debug information for templates sub-classes, lookup as @a Name
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
template<> \
template<> \
defineDebugSwitchWithName(Type, Name, DebugSwitch)
#endif
//- Define the debug information for templates
......@@ -160,6 +176,18 @@ public: \
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
// for templated sub-classes
//- Define the debug information for templates
// Useful with typedefs
#define defineTemplate2DebugSwitch(Type, DebugSwitch) \
defineTemplate2DebugSwitchWithName(Type, #Type, DebugSwitch)
//- Define the debug information directly for templates
#define defineNamedTemplate2DebugSwitch(Type, DebugSwitch) \
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// definitions (with debug information)
......@@ -186,6 +214,19 @@ public: \
defineNamedTemplateTypeName(Type); \
defineNamedTemplateDebugSwitch(Type, DebugSwitch)
// for templated sub-classes
//- Define the typeName and debug information, lookup as @a Name
#define defineTemplate2TypeNameAndDebugWithName(Type, Name, DebugSwitch) \
defineTemplate2TypeNameWithName(Type, Name); \
defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch)
//- Define the typeName and debug information for templates, useful
// with typedefs
#define defineTemplate2TypeNameAndDebug(Type, DebugSwitch) \
defineTemplate2TypeNameAndDebugWithName(Type, #Type, DebugSwitch)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -31,21 +31,22 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebug(pointScalarField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug(pointVectorField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug
defineTemplate2TypeNameAndDebug(pointScalarField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug(pointVectorField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug
(
pointSphericalTensorField::DimensionedInternalField,
0
);
defineTemplateTypeNameAndDebug
defineTemplate2TypeNameAndDebug
(
pointSymmTensorField::DimensionedInternalField,
0
);
defineTemplateTypeNameAndDebug(pointTensorField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug(pointTensorField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug(pointScalarField, 0);
defineTemplateTypeNameAndDebug(pointVectorField, 0);
......
......@@ -30,21 +30,34 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebug(surfaceScalarField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug(surfaceVectorField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug
defineTemplate2TypeNameAndDebug
(
surfaceScalarField::DimensionedInternalField,
0
);
defineTemplate2TypeNameAndDebug
(
surfaceVectorField::DimensionedInternalField,
0
);
defineTemplate2TypeNameAndDebug
(
surfaceSphericalTensorField::DimensionedInternalField,
0
);
defineTemplateTypeNameAndDebug
defineTemplate2TypeNameAndDebug
(
surfaceSymmTensorField::DimensionedInternalField,
0
);
defineTemplateTypeNameAndDebug(surfaceTensorField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug
(
surfaceTensorField::DimensionedInternalField,
0
);
defineTemplateTypeNameAndDebug(surfaceScalarField, 0);
defineTemplateTypeNameAndDebug(surfaceVectorField, 0);
......
......@@ -32,15 +32,19 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebug(volScalarField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug(volVectorField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug
defineTemplate2TypeNameAndDebug(volScalarField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug(volVectorField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug
(
volSphericalTensorField::DimensionedInternalField,
0
);
defineTemplateTypeNameAndDebug(volSymmTensorField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug(volTensorField::DimensionedInternalField, 0);
defineTemplate2TypeNameAndDebug
(
volSymmTensorField::DimensionedInternalField,
0
);
defineTemplate2TypeNameAndDebug(volTensorField::DimensionedInternalField, 0);
defineTemplateTypeNameAndDebug(volScalarField, 0);
defineTemplateTypeNameAndDebug(volVectorField, 0);
......@@ -48,6 +52,10 @@ defineTemplateTypeNameAndDebug(volSphericalTensorField, 0);
defineTemplateTypeNameAndDebug(volSymmTensorField, 0);
defineTemplateTypeNameAndDebug(volTensorField, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// specialization for scalar fields
template<>
tmp<GeometricField<scalar, fvPatchField, volMesh> >
GeometricField<scalar, fvPatchField, volMesh>::component
......@@ -58,6 +66,8 @@ GeometricField<scalar, fvPatchField, volMesh>::component
return *this;
}
// specialization for scalar fields
template<>
void GeometricField<scalar, fvPatchField, volMesh>::replace
(
......
Markdown is supported
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