Commit 46b76862 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use FieldBase for template invariant parts

- use refCount instead of the tmp<...>::refCount alias
parent fe80e3b4
......@@ -627,36 +627,36 @@ fields/cloud/cloud.C
Fields = fields/Fields
$(Fields)/Field/FieldBase.C
$(Fields)/labelField/labelField.C
$(Fields)/scalarField/scalarField.C
$(Fields)/vectorField/vectorField.C
$(Fields)/vector2DField/vector2DField.C
$(Fields)/sphericalTensorField/sphericalTensorField.C
$(Fields)/diagTensorField/diagTensorField.C
$(Fields)/symmTensorField/symmTensorField.C
$(Fields)/tensorField/tensorField.C
$(Fields)/quaternionField/quaternionField.C
$(Fields)/triadField/triadField.C
$(Fields)/complexFields/complexFields.C
$(Fields)/labelField/labelIOField.C
$(Fields)/labelField/labelFieldIOField.C
$(Fields)/scalarField/scalarField.C
$(Fields)/scalarField/scalarIOField.C
$(Fields)/scalarField/scalarFieldIOField.C
$(Fields)/vectorField/vectorField.C
$(Fields)/vectorField/vectorIOField.C
$(Fields)/vectorField/vectorFieldIOField.C
$(Fields)/vector2DField/vector2DField.C
$(Fields)/vector2DField/vector2DIOField.C
$(Fields)/vector2DField/vector2DFieldIOField.C
$(Fields)/sphericalTensorField/sphericalTensorField.C
$(Fields)/sphericalTensorField/sphericalTensorIOField.C
$(Fields)/sphericalTensorField/sphericalTensorFieldIOField.C
$(Fields)/diagTensorField/diagTensorField.C
$(Fields)/diagTensorField/diagTensorIOField.C
$(Fields)/diagTensorField/diagTensorFieldIOField.C
$(Fields)/symmTensorField/symmTensorField.C
$(Fields)/symmTensorField/symmTensorIOField.C
$(Fields)/symmTensorField/symmTensorFieldIOField.C
$(Fields)/tensorField/tensorField.C
$(Fields)/tensorField/tensorIOField.C
$(Fields)/tensorField/tensorFieldIOField.C
$(Fields)/quaternionField/quaternionField.C
$(Fields)/quaternionField/quaternionIOField.C
$(Fields)/triadField/triadField.C
$(Fields)/triadField/triadIOField.C
$(Fields)/complexFields/complexFields.C
$(Fields)/transformField/transformField.C
......
......@@ -63,7 +63,7 @@ inline Foam::SubDimensionedField<Type, GeoMesh>::SubDimensionedField
const SubDimensionedField<Type, GeoMesh>& sfield
)
:
tmp<SubDimensionedField<Type, GeoMesh>>::refCount(),
refCount(),
SubField<Type>(sfield)
{}
......
......@@ -21,9 +21,6 @@ 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
Generic fieldField type.
\*---------------------------------------------------------------------------*/
#include "FieldField.H"
......@@ -137,7 +134,7 @@ FieldField<Field, Type>::FieldField
template<template<class> class Field, class Type>
FieldField<Field, Type>::FieldField(const FieldField<Field, Type>& f)
:
tmp<FieldField<Field, Type>>::refCount(),
refCount(),
PtrList<Field<Type>>(f)
{}
......
......@@ -73,7 +73,7 @@ Ostream& operator<<
template<template<class> class Field, class Type>
class FieldField
:
public tmp<FieldField<Field, Type>>::refCount,
public refCount,
public PtrList<Field<Type>>
{
......
......@@ -29,12 +29,6 @@ License
#include "contiguous.H"
#include "mapDistributeBase.H"
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
template<class Type>
const char* const Foam::Field<Type>::typeName("Field");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
......
......@@ -47,6 +47,7 @@ SourceFiles
#include "VectorSpace.H"
#include "scalarList.H"
#include "labelList.H"
#include "FieldBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -73,7 +74,7 @@ Ostream& operator<<(Ostream&, const tmp<Field<Type>>&);
template<class Type>
class Field
:
public tmp<Field<Type>>::refCount,
public FieldBase,
public List<Type>
{
......@@ -86,11 +87,6 @@ public:
typedef SubField<Type> subField;
// Static data members
static const char* const typeName;
// Static Member Functions
//- Return nullObject reference field
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "FieldBase.H"
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
const char* const Foam::FieldBase::typeName("Field");
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::FieldBase
Description
Template invariant parts for Field
SourceFiles
FieldBase.C
\*---------------------------------------------------------------------------*/
#ifndef FieldBase_H
#define FieldBase_H
#include "refCount.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class FieldBase Declaration
\*---------------------------------------------------------------------------*/
class FieldBase
:
public refCount
{
public:
// Static data members
//- Typename for Field
static const char* const typeName;
// Constructors
//- Construct null, with refCount zero
constexpr FieldBase() noexcept
:
refCount()
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
#endif
// ************************************************************************* //
......@@ -59,7 +59,7 @@ template<class Type> class SubField;
template<class Type>
class SubField
:
public tmp<SubField<Type>>::refCount,
public refCount,
public SubList<Type>
{
......
......@@ -74,7 +74,7 @@ inline Foam::SubField<Type>::SubField
const SubField<Type>& sfield
)
:
tmp<SubField<Type>>::refCount(),
refCount(),
SubList<Type>(sfield)
{}
......
......@@ -38,18 +38,11 @@ Foam::Function1<Type>::Function1(const word& entryName)
template<class Type>
Foam::Function1<Type>::Function1(const Function1<Type>& de)
:
tmp<Function1<Type>>::refCount(),
refCount(),
name_(de.name_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Function1<Type>::~Function1()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
......@@ -111,8 +104,8 @@ Foam::FieldFunction1<Function1Type>::value
const scalarField& x
) const
{
tmp<Field<Type>> tfld(new Field<Type>(x.size()));
Field<Type>& fld = tfld.ref();
auto tfld = tmp<Field<Type>>::New(x.size());
auto& fld = tfld.ref();
forAll(x, i)
{
......@@ -152,8 +145,8 @@ Foam::FieldFunction1<Function1Type>::integrate
const scalarField& x2
) const
{
tmp<Field<Type>> tfld(new Field<Type>(x1.size()));
Field<Type>& fld = tfld.ref();
auto tfld = tmp<Field<Type>>::New(x1.size());
auto& fld = tfld.ref();
forAll(x1, i)
{
......
......@@ -61,11 +61,11 @@ template<class Type> Ostream& operator<<(Ostream&, const Function1<Type>&);
template<class Type>
class Function1
:
public tmp<Function1<Type>>::refCount
public refCount
{
// Private Member Functions
//- Disallow default bitwise assignment
//- No copy assignment
void operator=(const Function1<Type>&) = delete;
......@@ -119,7 +119,7 @@ public:
//- Destructor
virtual ~Function1();
virtual ~Function1() = default;
// Member Functions
......@@ -194,8 +194,7 @@ public:
//- Destructor
virtual ~FieldFunction1()
{}
virtual ~FieldFunction1() = default;
// Member Functions
......
......@@ -71,7 +71,7 @@ Ostream& operator<<(Ostream&, const faMatrix<Type>&);
template<class Type>
class faMatrix
:
public tmp<faMatrix<Type>>::refCount,
public refCount,
public lduMatrix
{
// Private data
......
......@@ -46,7 +46,7 @@ namespace fv
template<class Type>
convectionScheme<Type>::convectionScheme(const convectionScheme& cs)
:
tmp<convectionScheme<Type>>::refCount(),
refCount(),
mesh_(cs.mesh_)
{}
......
......@@ -67,7 +67,7 @@ namespace fv
template<class Type>
class convectionScheme
:
public tmp<convectionScheme<Type>>::refCount
public refCount
{
// Private data
......
......@@ -21,9 +21,6 @@ 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
Abstract base class for finite volume calculus d2dt2 schemes.
\*---------------------------------------------------------------------------*/
#include "fv.H"
......@@ -84,13 +81,6 @@ tmp<d2dt2Scheme<Type>> d2dt2Scheme<Type>::New
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
d2dt2Scheme<Type>::~d2dt2Scheme()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
......
......@@ -25,7 +25,7 @@ Class
Foam::fv::d2dt2Scheme
Description
Abstract base class for d2dt2 schemes.
Abstract base class for finite volume d2dt2 schemes.
SourceFiles
d2dt2Scheme.C
......@@ -64,7 +64,7 @@ namespace fv
template<class Type>
class d2dt2Scheme
:
public tmp<d2dt2Scheme<Type>>::refCount
public refCount
{
protected:
......@@ -76,11 +76,11 @@ protected:
// Private Member Functions
//- Disallow copy construct
d2dt2Scheme(const d2dt2Scheme&);
//- No copy construct
d2dt2Scheme(const d2dt2Scheme&) = delete;
//- Disallow default bitwise assignment
void operator=(const d2dt2Scheme&);
//- No copy assignment
void operator=(const d2dt2Scheme&) = delete;
public:
......@@ -127,7 +127,7 @@ public:
//- Destructor
virtual ~d2dt2Scheme();
virtual ~d2dt2Scheme() = default;
// Member Functions
......
......@@ -84,13 +84,6 @@ tmp<ddtScheme<Type>> ddtScheme<Type>::New
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
ddtScheme<Type>::~ddtScheme()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
......@@ -120,14 +113,11 @@ tmp<fvMatrix<Type>> ddtScheme<Type>::fvmDdt
{
NotImplemented;
return tmp<fvMatrix<Type>>
return tmp<fvMatrix<Type>>::New
(
new fvMatrix<Type>
(
vf,
alpha.dimensions()*rho.dimensions()
*vf.dimensions()*dimVol/dimTime
)
vf,
alpha.dimensions()*rho.dimensions()
*vf.dimensions()*dimVol/dimTime
);
}
......
......@@ -30,7 +30,6 @@ Group
Description
Abstract base class for ddt schemes.
SourceFiles
ddtScheme.C
......@@ -68,7 +67,7 @@ namespace fv
template<class Type>
class ddtScheme
:
public tmp<ddtScheme<Type>>::refCount
public refCount
{
protected:
......@@ -83,11 +82,11 @@ protected:
// Private Member Functions
//- Disallow copy construct
ddtScheme(const ddtScheme&);
//- No copy construct
ddtScheme(const ddtScheme&) = delete;
//- Disallow default bitwise assignment
void operator=(const ddtScheme&);
//- No copy assignment
void operator=(const ddtScheme&) = delete;
public:
......@@ -136,7 +135,7 @@ public:
//- Destructor
virtual ~ddtScheme();
virtual ~ddtScheme() = default;
// Member Functions
......
......@@ -85,16 +85,6 @@ tmp<divScheme<Type>> divScheme<Type>::New
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
divScheme<Type>::~divScheme()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
......
......@@ -67,7 +67,7 @@ namespace fv
template<class Type>
class divScheme
:
public tmp<divScheme<Type>>::refCount
public refCount
{
protected:
......@@ -80,11 +80,11 @@ protected:
// Private Member Functions
//- Disallow copy construct
divScheme(const divScheme&);
//- No copy construct
divScheme(const divScheme&) = delete;
//- Disallow default bitwise assignment
void operator=(const divScheme&);
//- No copy assignment
void operator=(const divScheme&) = delete;
public:
......@@ -133,7 +133,7 @@ public:
//- Destructor
virtual ~divScheme();
virtual ~divScheme() = default;
// Member Functions
......
......@@ -72,12 +72,6 @@ Foam::tmp<Foam::fv::gradScheme<Type>> Foam::fv::gradScheme<Type>::New
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::fv::gradScheme<Type>::~gradScheme()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
......
......@@ -60,7 +60,7 @@ namespace fv
template<class Type>
class gradScheme
:
public tmp<gradScheme<Type>>::refCount
public refCount
{
// Private data
......@@ -69,11 +69,11 @@ class gradScheme
// Private Member Functions
//- Disallow copy construct
gradScheme(const gradScheme&);
//- No copy construct
gradScheme(const gradScheme&) = delete;
//- Disallow default bitwise assignment
void operator=(const gradScheme&);
//- No copy assignment
void operator=(const gradScheme&) = delete;
public:
......@@ -114,7 +114,7 @@ public:
//- Destructor
virtual ~gradScheme();
virtual ~gradScheme() = default;