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
|
#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 * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
|||||||
@ -441,6 +441,9 @@ public:
|
|||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//- Clone
|
||||||
|
tmp<GeometricField<Type, PatchField, GeoMesh>> clone() const;
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~GeometricField();
|
virtual ~GeometricField();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
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 * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template
|
template
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -159,6 +159,10 @@ public:
|
|||||||
>&
|
>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Clone
|
||||||
|
tmp<SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>>
|
||||||
|
clone() const;
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~SlicedGeometricField();
|
~SlicedGeometricField();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -221,7 +221,7 @@ inline T* Foam::tmp<T>::ptr() const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new T(*ptr_);
|
return ptr_->clone().ptr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,10 +105,7 @@ public:
|
|||||||
Function1(const Function1<Type>& de);
|
Function1(const Function1<Type>& de);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
virtual tmp<Function1<Type>> clone() const
|
virtual tmp<Function1<Type>> clone() const = 0;
|
||||||
{
|
|
||||||
return tmp<Function1<Type>>(new Function1<Type>(*this));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Selector
|
//- Selector
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedJumpFvPatchField<Type>(p, iF),
|
fixedJumpFvPatchField<Type>(p, iF),
|
||||||
jumpTable_(new Function1<Type>("jumpTable"))
|
jumpTable_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedJumpFvPatchField<Type>(p, iF),
|
fixedJumpFvPatchField<Type>(p, iF),
|
||||||
jumpTable_(new Function1<Type>("jumpTable"))
|
jumpTable_()
|
||||||
{
|
{
|
||||||
if (this->cyclicPatch().owner())
|
if (this->cyclicPatch().owner())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedJumpAMIFvPatchField<Type>(p, iF),
|
fixedJumpAMIFvPatchField<Type>(p, iF),
|
||||||
jumpTable_(0)
|
jumpTable_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedJumpAMIFvPatchField<Type>(p, iF),
|
fixedJumpAMIFvPatchField<Type>(p, iF),
|
||||||
jumpTable_(new Function1<Type>("jumpTable"))
|
jumpTable_()
|
||||||
{
|
{
|
||||||
if (this->cyclicAMIPatch().owner())
|
if (this->cyclicAMIPatch().owner())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / 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.
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
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>
|
template<class Type>
|
||||||
Foam::fvMatrix<Type>::~fvMatrix()
|
Foam::fvMatrix<Type>::~fvMatrix()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / 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.
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -270,6 +270,9 @@ public:
|
|||||||
//- Construct from Istream given field to solve for
|
//- Construct from Istream given field to solve for
|
||||||
fvMatrix(const GeometricField<Type, fvPatchField, volMesh>&, Istream&);
|
fvMatrix(const GeometricField<Type, fvPatchField, volMesh>&, Istream&);
|
||||||
|
|
||||||
|
//- Clone
|
||||||
|
tmp<fvMatrix<Type>> clone() const;
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~fvMatrix();
|
virtual ~fvMatrix();
|
||||||
|
|||||||
Reference in New Issue
Block a user