mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: avoid autoPtr automatic cast conversion in more places
- Can result in inadvertent conversions where the user should really know or check if the pointer is valid prior to using. - Still have several places to fix that are using the deprecated copy construct and copy assignment
This commit is contained in:
@ -43,7 +43,7 @@ SourceFiles
|
||||
#ifndef autoPtr_H
|
||||
#define autoPtr_H
|
||||
|
||||
// Transitional features/misfeatures:
|
||||
// Transitional features/misfeatures
|
||||
#define Foam_autoPtr_copyConstruct
|
||||
#define Foam_autoPtr_copyAssign
|
||||
#define Foam_autoPtr_castOperator
|
||||
@ -93,7 +93,7 @@ public:
|
||||
// will be constructed.
|
||||
//
|
||||
// \note Similar to New but for derived types.
|
||||
// In the future check for is_convertible on the pointer types
|
||||
// Future check for std::is_base_of ?
|
||||
template<class U, class... Args>
|
||||
inline static autoPtr<T> NewFrom(Args&&... args);
|
||||
|
||||
@ -114,7 +114,7 @@ public:
|
||||
|
||||
//- Move construct, transferring ownership from derived type.
|
||||
// U must be derivable from T
|
||||
// \note In the future check for is_convertible on the pointer types
|
||||
// \note Future check for std::is_base_of ?
|
||||
template<class U>
|
||||
inline explicit autoPtr(autoPtr<U>&& ap);
|
||||
|
||||
@ -226,10 +226,13 @@ public:
|
||||
// Fatal error if no pointer is managed
|
||||
inline const T& operator()() const;
|
||||
|
||||
//- Automatic cast conversion to the underlying type reference
|
||||
//- Deprecated(2019-01) Automatic cast conversion to underlying type
|
||||
// Fatal error if no pointer is managed
|
||||
// \deprecated(2019-01) Can result in inadvertent conversions
|
||||
// where the user should really know or check if the pointer
|
||||
// is valid prior to using.
|
||||
#ifdef Foam_autoPtr_castOperator
|
||||
inline operator const T&() const { return operator*(); }
|
||||
operator const T&() const { return operator*(); }
|
||||
#else
|
||||
operator const T&() const = delete;
|
||||
#endif
|
||||
@ -258,7 +261,7 @@ public:
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- No copy assignment from plain pointer
|
||||
//- Deprecated(2018-02) No copy assignment from plain pointer
|
||||
// \deprecated(2018-02) Convenient, but uncontrolled access
|
||||
void operator=(T* p) = delete;
|
||||
};
|
||||
|
||||
@ -422,7 +422,7 @@ Foam::dynamicRefineFvMesh::refine
|
||||
// cellTreePtr_.clear();
|
||||
|
||||
// Update fields
|
||||
updateMesh(map);
|
||||
updateMesh(*map);
|
||||
|
||||
|
||||
// Move mesh
|
||||
@ -442,7 +442,7 @@ Foam::dynamicRefineFvMesh::refine
|
||||
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter_.updateMesh(map);
|
||||
meshCutter_.updateMesh(*map);
|
||||
|
||||
// Update numbering of protectedCell_
|
||||
if (protectedCell_.size())
|
||||
@ -517,7 +517,7 @@ Foam::dynamicRefineFvMesh::unrefine
|
||||
<< endl;
|
||||
|
||||
// Update fields
|
||||
updateMesh(map);
|
||||
updateMesh(*map);
|
||||
|
||||
|
||||
// Move mesh
|
||||
@ -620,7 +620,7 @@ Foam::dynamicRefineFvMesh::unrefine
|
||||
|
||||
|
||||
// Update numbering of cells/vertices.
|
||||
meshCutter_.updateMesh(map);
|
||||
meshCutter_.updateMesh(*map);
|
||||
|
||||
// Update numbering of protectedCell_
|
||||
if (protectedCell_.size())
|
||||
|
||||
@ -95,7 +95,7 @@ timeVaryingMappedFixedValueFvPatchField
|
||||
(
|
||||
new PatchFunction1Types::MappedFile<Type>
|
||||
(
|
||||
ptf.uniformValue_,
|
||||
ptf.uniformValue_(),
|
||||
p.patch()
|
||||
)
|
||||
)
|
||||
@ -114,7 +114,7 @@ timeVaryingMappedFixedValueFvPatchField
|
||||
(
|
||||
new PatchFunction1Types::MappedFile<Type>
|
||||
(
|
||||
ptf.uniformValue_,
|
||||
ptf.uniformValue_(),
|
||||
this->patch().patch()
|
||||
)
|
||||
)
|
||||
@ -134,7 +134,7 @@ timeVaryingMappedFixedValueFvPatchField
|
||||
(
|
||||
new PatchFunction1Types::MappedFile<Type>
|
||||
(
|
||||
ptf.uniformValue_,
|
||||
ptf.uniformValue_(),
|
||||
this->patch().patch()
|
||||
)
|
||||
)
|
||||
|
||||
@ -2742,7 +2742,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::directionalRefine
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh_, false);
|
||||
|
||||
// Update fields
|
||||
mesh_.updateMesh(morphMap);
|
||||
mesh_.updateMesh(*morphMap);
|
||||
|
||||
// Move mesh (since morphing does not do this)
|
||||
if (morphMap().hasMotionPoints())
|
||||
@ -2759,10 +2759,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::directionalRefine
|
||||
mesh_.setInstance(timeName());
|
||||
|
||||
// Update stored refinement pattern
|
||||
meshRefiner.updateMesh(morphMap);
|
||||
meshRefiner.updateMesh(*morphMap);
|
||||
|
||||
// Update intersection info
|
||||
updateMesh(morphMap, getChangedFaces(morphMap, cellsToRefine));
|
||||
updateMesh(*morphMap, getChangedFaces(*morphMap, cellsToRefine));
|
||||
|
||||
return morphMap;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ public:
|
||||
{
|
||||
const_cast<cellVolumeWeight&>(*this).update();
|
||||
}
|
||||
return cellInterpolationMap_;
|
||||
return *cellInterpolationMap_;
|
||||
}
|
||||
|
||||
//- Per interpolated cell the neighbour cells (in terms of slots as
|
||||
|
||||
Reference in New Issue
Block a user