mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
made the clone function pure virtual
Avoids potential problems with derived classes which do not define a clone function.
This commit is contained in:
committed by
Andrew Heather
parent
5157be4bb3
commit
2f431ffd3d
@ -721,6 +721,17 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
#endif
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::clone() const
|
||||
{
|
||||
return tmp<GeometricField<Type, PatchField, GeoMesh>>
|
||||
(
|
||||
new GeometricField<Type, PatchField, GeoMesh>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
|
||||
@ -441,6 +441,9 @@ public:
|
||||
);
|
||||
#endif
|
||||
|
||||
//- Clone
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> clone() const;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~GeometricField();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -338,6 +338,33 @@ SlicedGeometricField
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Type,
|
||||
template<class> class PatchField,
|
||||
template<class> class SlicedPatchField,
|
||||
class GeoMesh
|
||||
>
|
||||
Foam::tmp
|
||||
<
|
||||
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>
|
||||
>
|
||||
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
|
||||
clone() const
|
||||
{
|
||||
return tmp
|
||||
<
|
||||
SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>
|
||||
>
|
||||
(
|
||||
new SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -159,6 +159,10 @@ public:
|
||||
>&
|
||||
);
|
||||
|
||||
//- Clone
|
||||
tmp<SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>>
|
||||
clone() const;
|
||||
|
||||
|
||||
//- Destructor
|
||||
~SlicedGeometricField();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -221,7 +221,7 @@ inline T* Foam::tmp<T>::ptr() const
|
||||
}
|
||||
else
|
||||
{
|
||||
return new T(*ptr_);
|
||||
return ptr_->clone().ptr();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,10 +105,7 @@ public:
|
||||
Function1(const Function1<Type>& de);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<Function1<Type>> clone() const
|
||||
{
|
||||
return tmp<Function1<Type>>(new Function1<Type>(*this));
|
||||
}
|
||||
virtual tmp<Function1<Type>> clone() const = 0;
|
||||
|
||||
|
||||
//- Selector
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField
|
||||
)
|
||||
:
|
||||
fixedJumpFvPatchField<Type>(p, iF),
|
||||
jumpTable_(new Function1<Type>("jumpTable"))
|
||||
jumpTable_()
|
||||
{}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField
|
||||
)
|
||||
:
|
||||
fixedJumpFvPatchField<Type>(p, iF),
|
||||
jumpTable_(new Function1<Type>("jumpTable"))
|
||||
jumpTable_()
|
||||
{
|
||||
if (this->cyclicPatch().owner())
|
||||
{
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
|
||||
)
|
||||
:
|
||||
fixedJumpAMIFvPatchField<Type>(p, iF),
|
||||
jumpTable_(0)
|
||||
jumpTable_()
|
||||
{}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
|
||||
)
|
||||
:
|
||||
fixedJumpAMIFvPatchField<Type>(p, iF),
|
||||
jumpTable_(new Function1<Type>("jumpTable"))
|
||||
jumpTable_()
|
||||
{
|
||||
if (this->cyclicAMIPatch().owner())
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -451,6 +451,18 @@ Foam::fvMatrix<Type>::fvMatrix
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::fvMatrix<Type>> Foam::fvMatrix<Type>::clone() const
|
||||
{
|
||||
return tmp<fvMatrix<Type>>
|
||||
(
|
||||
new fvMatrix<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::fvMatrix<Type>::~fvMatrix()
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -270,6 +270,9 @@ public:
|
||||
//- Construct from Istream given field to solve for
|
||||
fvMatrix(const GeometricField<Type, fvPatchField, volMesh>&, Istream&);
|
||||
|
||||
//- Clone
|
||||
tmp<fvMatrix<Type>> clone() const;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fvMatrix();
|
||||
|
||||
Reference in New Issue
Block a user