STYLE: prefer std::unique_ptr instead of (aliased) Foam::unique_ptr

This commit is contained in:
Mark Olesen
2022-12-01 16:06:34 +00:00
parent 3151dacccc
commit 3ab182b1ae
17 changed files with 53 additions and 50 deletions

View File

@ -206,7 +206,7 @@ private:
// Private Data // Private Data
//- Reader options //- Reader options
const unique_ptr<options> options_; const std::unique_ptr<options> options_;
//- Enumeration defining the status of a ccmio node //- Enumeration defining the status of a ccmio node

View File

@ -133,7 +133,7 @@ class writer
// Member Data // Member Data
//- MapIds for various components (cell, internalFaces, boundaries) //- MapIds for various components (cell, internalFaces, boundaries)
unique_ptr<ccmMaps> maps_; std::unique_ptr<ccmMaps> maps_;
//- mesh reference //- mesh reference
const polyMesh& mesh_; const polyMesh& mesh_;

View File

@ -122,7 +122,7 @@ private:
//- Point-cell addressing. Used for topological analysis //- Point-cell addressing. Used for topological analysis
// Warning. This point cell addressing list potentially contains // Warning. This point cell addressing list potentially contains
// duplicate cell entries. Use additional checking // duplicate cell entries. Use additional checking
mutable unique_ptr<labelListList> pointCellsPtr_; mutable std::unique_ptr<labelListList> pointCellsPtr_;
//- Association between two faces //- Association between two faces
List<labelPair> interfaces_; List<labelPair> interfaces_;

View File

@ -105,7 +105,7 @@ class attachDetach
// Private addressing data. Created on topology change // Private addressing data. Created on topology change
//- Map of matching points //- Map of matching points
mutable unique_ptr<Map<label>> pointMatchMapPtr_; mutable std::unique_ptr<Map<label>> pointMatchMapPtr_;
// Private Member Functions // Private Member Functions

View File

@ -1806,7 +1806,7 @@ void Foam::boundaryMesh::changeFaces
// Reconstruct 'mesh' from new faces and (copy of) existing points. // Reconstruct 'mesh' from new faces and (copy of) existing points.
unique_ptr<bMesh> newMeshPtr(new bMesh(newFaces, mesh().points())); std::unique_ptr<bMesh> newMeshPtr(new bMesh(newFaces, mesh().points()));
// Reset meshFace_ to new ordering. // Reset meshFace_ to new ordering.
meshFace_.transfer(newMeshFace); meshFace_.transfer(newMeshFace);

View File

@ -77,7 +77,7 @@ class boundaryMesh
// Private Data // Private Data
//- All boundary mesh data. Reconstructed every time faces are repatched //- All boundary mesh data. Reconstructed every time faces are repatched
unique_ptr<bMesh> meshPtr_; std::unique_ptr<bMesh> meshPtr_;
//- Patches. Reconstructed every time faces are repatched. //- Patches. Reconstructed every time faces are repatched.
PtrList<boundaryPatch> patches_; PtrList<boundaryPatch> patches_;

View File

@ -77,10 +77,10 @@ class layerAdditionRemoval
mutable scalar oldLayerThickness_; mutable scalar oldLayerThickness_;
//- Point pairing //- Point pairing
mutable unique_ptr<labelList> pointsPairingPtr_; mutable std::unique_ptr<labelList> pointsPairingPtr_;
//- Face pairing //- Face pairing
mutable unique_ptr<labelList> facesPairingPtr_; mutable std::unique_ptr<labelList> facesPairingPtr_;
//- Layer removal trigger time index //- Layer removal trigger time index
mutable label triggerRemoval_; mutable label triggerRemoval_;

View File

@ -134,7 +134,7 @@ class cellCuts
//- Cuts per existing face (includes those along edge of face) //- Cuts per existing face (includes those along edge of face)
// Cuts in no particular order. // Cuts in no particular order.
mutable unique_ptr<labelListList> faceCutsPtr_; mutable std::unique_ptr<labelListList> faceCutsPtr_;
//- Per face : cut across edge (so not along existing edge) //- Per face : cut across edge (so not along existing edge)
// (can only be one per face) // (can only be one per face)

View File

@ -165,10 +165,10 @@ class faceCoupleInfo
static const scalar angleTol_; static const scalar angleTol_;
//- Master patch //- Master patch
unique_ptr<indirectPrimitivePatch> masterPatchPtr_; std::unique_ptr<indirectPrimitivePatch> masterPatchPtr_;
//- Slave patch //- Slave patch
unique_ptr<indirectPrimitivePatch> slavePatchPtr_; std::unique_ptr<indirectPrimitivePatch> slavePatchPtr_;
//- Description of cut. //- Description of cut.
@ -186,7 +186,7 @@ class faceCoupleInfo
// Orientation of cutFaces should be same as masterFaces! // Orientation of cutFaces should be same as masterFaces!
pointField cutPoints_; pointField cutPoints_;
unique_ptr<primitiveFacePatch> cutFacesPtr_; std::unique_ptr<primitiveFacePatch> cutFacesPtr_;
//- Additional point coupling information. Is between points on //- Additional point coupling information. Is between points on
// boundary of both meshes. // boundary of both meshes.

View File

@ -99,38 +99,38 @@ class enrichedPatch
// Demand-driven private data // Demand-driven private data
//- Enriched patch //- Enriched patch
mutable unique_ptr<faceList> enrichedFacesPtr_; mutable std::unique_ptr<faceList> enrichedFacesPtr_;
//- Mesh points //- Mesh points
mutable unique_ptr<labelList> meshPointsPtr_; mutable std::unique_ptr<labelList> meshPointsPtr_;
//- Local faces //- Local faces
mutable unique_ptr<faceList> localFacesPtr_; mutable std::unique_ptr<faceList> localFacesPtr_;
//- Local points //- Local points
mutable unique_ptr<pointField> localPointsPtr_; mutable std::unique_ptr<pointField> localPointsPtr_;
//- Point-point addressing //- Point-point addressing
mutable unique_ptr<labelListList> pointPointsPtr_; mutable std::unique_ptr<labelListList> pointPointsPtr_;
// Master point addressing // Master point addressing
mutable unique_ptr<Map<labelList>> masterPointFacesPtr_; mutable std::unique_ptr<Map<labelList>> masterPointFacesPtr_;
// Cut faces and addressing // Cut faces and addressing
//- Cut faces //- Cut faces
mutable unique_ptr<faceList> cutFacesPtr_; mutable std::unique_ptr<faceList> cutFacesPtr_;
//- Cut face master //- Cut face master
// - the face on the master patch for internal faces // - the face on the master patch for internal faces
// - the creator face for boundary face // - the creator face for boundary face
mutable unique_ptr<labelList> cutFaceMasterPtr_; mutable std::unique_ptr<labelList> cutFaceMasterPtr_;
//- Cut face slave //- Cut face slave
// - the face on the slave patch for internal faces // - the face on the slave patch for internal faces
// - -1 for boundary face // - -1 for boundary face
mutable unique_ptr<labelList> cutFaceSlavePtr_; mutable std::unique_ptr<labelList> cutFaceSlavePtr_;
// Private Member Functions // Private Member Functions

View File

@ -161,53 +161,53 @@ private:
//- Cut face master face. Gives the index of face in master patch //- Cut face master face. Gives the index of face in master patch
// the cut face has been created from. For a slave-only face // the cut face has been created from. For a slave-only face
// this will be -1 // this will be -1
mutable unique_ptr<labelList> cutFaceMasterPtr_; mutable std::unique_ptr<labelList> cutFaceMasterPtr_;
//- Cut face slave face. Gives the index of face in slave patch //- Cut face slave face. Gives the index of face in slave patch
// the cut face has been created from. For a master-only face // the cut face has been created from. For a master-only face
// this will be -1 // this will be -1
mutable unique_ptr<labelList> cutFaceSlavePtr_; mutable std::unique_ptr<labelList> cutFaceSlavePtr_;
//- Master zone faceCells //- Master zone faceCells
mutable unique_ptr<labelList> masterFaceCellsPtr_; mutable std::unique_ptr<labelList> masterFaceCellsPtr_;
//- Slave zone faceCells //- Slave zone faceCells
mutable unique_ptr<labelList> slaveFaceCellsPtr_; mutable std::unique_ptr<labelList> slaveFaceCellsPtr_;
//- Master stick-out faces //- Master stick-out faces
mutable unique_ptr<labelList> masterStickOutFacesPtr_; mutable std::unique_ptr<labelList> masterStickOutFacesPtr_;
//- Slave stick-out faces //- Slave stick-out faces
mutable unique_ptr<labelList> slaveStickOutFacesPtr_; mutable std::unique_ptr<labelList> slaveStickOutFacesPtr_;
//- Retired point mapping. //- Retired point mapping.
// For every retired slave side point, gives the label of the // For every retired slave side point, gives the label of the
// master point that replaces it // master point that replaces it
mutable unique_ptr<Map<label>> retiredPointMapPtr_; mutable std::unique_ptr<Map<label>> retiredPointMapPtr_;
//- Cut edge pairs //- Cut edge pairs
// For cut points created by intersection two edges, // For cut points created by intersection two edges,
// store the master-slave edge pair used in creation // store the master-slave edge pair used in creation
mutable unique_ptr<Map<Pair<edge>>> cutPointEdgePairMapPtr_; mutable std::unique_ptr<Map<Pair<edge>>> cutPointEdgePairMapPtr_;
//- Slave point hit. The index of master point hit by the //- Slave point hit. The index of master point hit by the
// slave point in projection. For no point hit, set to -1 // slave point in projection. For no point hit, set to -1
mutable unique_ptr<labelList> slavePointPointHitsPtr_; mutable std::unique_ptr<labelList> slavePointPointHitsPtr_;
//- Slave edge hit. The index of master edge hit by the //- Slave edge hit. The index of master edge hit by the
// slave point in projection. For point or no edge hit, set to -1 // slave point in projection. For point or no edge hit, set to -1
mutable unique_ptr<labelList> slavePointEdgeHitsPtr_; mutable std::unique_ptr<labelList> slavePointEdgeHitsPtr_;
//- Slave face hit. The index of master face hit by the //- Slave face hit. The index of master face hit by the
// slave point in projection. // slave point in projection.
mutable unique_ptr<List<objectHit>> slavePointFaceHitsPtr_; mutable std::unique_ptr<List<objectHit>> slavePointFaceHitsPtr_;
//- Master point edge hit. The index of slave edge hit by //- Master point edge hit. The index of slave edge hit by
// a master point. For no hit set to -1 // a master point. For no hit set to -1
mutable unique_ptr<labelList> masterPointEdgeHitsPtr_; mutable std::unique_ptr<labelList> masterPointEdgeHitsPtr_;
//- Projected slave points //- Projected slave points
mutable unique_ptr<pointField> projectedSlavePointsPtr_; mutable std::unique_ptr<pointField> projectedSlavePointsPtr_;
// Private Member Functions // Private Member Functions

View File

@ -278,7 +278,7 @@ void Foam::slidingInterface::renumberAttachedAddressing
const labelList& sfc = slaveFaceCells(); const labelList& sfc = slaveFaceCells();
// Master side // Master side
unique_ptr<labelList> newMfcPtr(new labelList(mfc.size(), -1)); std::unique_ptr<labelList> newMfcPtr(new labelList(mfc.size(), -1));
auto& newMfc = *newMfcPtr; auto& newMfc = *newMfcPtr;
const labelList& mfzRenumber = const labelList& mfzRenumber =
@ -295,7 +295,7 @@ void Foam::slidingInterface::renumberAttachedAddressing
} }
// Slave side // Slave side
unique_ptr<labelList> newSfcPtr(new labelList(sfc.size(), -1)); std::unique_ptr<labelList> newSfcPtr(new labelList(sfc.size(), -1));
auto& newSfc = *newSfcPtr; auto& newSfc = *newSfcPtr;
const labelList& sfzRenumber = const labelList& sfzRenumber =
@ -331,7 +331,7 @@ void Foam::slidingInterface::renumberAttachedAddressing
// Master side // Master side
const labelList& msof = masterStickOutFaces(); const labelList& msof = masterStickOutFaces();
unique_ptr<labelList> newMsofPtr(new labelList(msof.size(), -1)); std::unique_ptr<labelList> newMsofPtr(new labelList(msof.size(), -1));
auto& newMsof = *newMsofPtr; auto& newMsof = *newMsofPtr;
forAll(msof, facei) forAll(msof, facei)
@ -347,7 +347,7 @@ void Foam::slidingInterface::renumberAttachedAddressing
// Slave side // Slave side
const labelList& ssof = slaveStickOutFaces(); const labelList& ssof = slaveStickOutFaces();
unique_ptr<labelList> newSsofPtr(new labelList(ssof.size(), -1)); std::unique_ptr<labelList> newSsofPtr(new labelList(ssof.size(), -1));
auto& newSsof = *newSsofPtr; auto& newSsof = *newSsofPtr;
forAll(ssof, facei) forAll(ssof, facei)
@ -376,7 +376,7 @@ void Foam::slidingInterface::renumberAttachedAddressing
// Renumber the retired point map. Need to take a copy! // Renumber the retired point map. Need to take a copy!
const Map<label> rpm = retiredPointMap(); const Map<label> rpm = retiredPointMap();
unique_ptr<Map<label>> newRpmPtr(new Map<label>(rpm.size())); std::unique_ptr<Map<label>> newRpmPtr(new Map<label>(rpm.size()));
auto& newRpm = *newRpmPtr; auto& newRpm = *newRpmPtr;
// Get reference to point renumbering // Get reference to point renumbering
@ -406,7 +406,10 @@ void Foam::slidingInterface::renumberAttachedAddressing
// Renumber the cut point edge pair map. Need to take a copy! // Renumber the cut point edge pair map. Need to take a copy!
const Map<Pair<edge>> cpepm = cutPointEdgePairMap(); const Map<Pair<edge>> cpepm = cutPointEdgePairMap();
unique_ptr<Map<Pair<edge>>> newCpepmPtr(new Map<Pair<edge>>(cpepm.size())); std::unique_ptr<Map<Pair<edge>>> newCpepmPtr
(
new Map<Pair<edge>>(cpepm.size())
);
auto& newCpepm = *newCpepmPtr; auto& newCpepm = *newCpepmPtr;
forAllConstIters(cpepm, iter) forAllConstIters(cpepm, iter)
@ -447,7 +450,7 @@ void Foam::slidingInterface::renumberAttachedAddressing
// Renumber the projected slave zone points // Renumber the projected slave zone points
const pointField& projectedSlavePoints = *projectedSlavePointsPtr_; const pointField& projectedSlavePoints = *projectedSlavePointsPtr_;
unique_ptr<pointField> newProjectedSlavePointsPtr std::unique_ptr<pointField> newProjectedSlavePointsPtr
( (
new pointField(projectedSlavePoints.size()) new pointField(projectedSlavePoints.size())
); );

View File

@ -122,7 +122,7 @@ private:
bool degrees_; bool degrees_;
//- Tensor rotation of lumped points //- Tensor rotation of lumped points
mutable unique_ptr<tensorField> rotationPtr_; mutable std::unique_ptr<tensorField> rotationPtr_;
// Private Member Functions // Private Member Functions

View File

@ -80,7 +80,7 @@ class edgeMesh
edgeList edges_; edgeList edges_;
//- From point to edges //- From point to edges
mutable unique_ptr<labelListList> pointEdgesPtr_; mutable std::unique_ptr<labelListList> pointEdgesPtr_;
// Private Member Functions // Private Member Functions

View File

@ -193,10 +193,10 @@ protected:
labelList regionEdges_; labelList regionEdges_;
//- Search tree for all feature points //- Search tree for all feature points
mutable unique_ptr<indexedOctree<treeDataPoint>> pointTree_; mutable std::unique_ptr<indexedOctree<treeDataPoint>> pointTree_;
//- Search tree for all edges //- Search tree for all edges
mutable unique_ptr<indexedOctree<treeDataEdge>> edgeTree_; mutable std::unique_ptr<indexedOctree<treeDataEdge>> edgeTree_;
//- Individual search trees for each type of edge //- Individual search trees for each type of edge
mutable PtrList<indexedOctree<treeDataEdge>> edgeTreesByType_; mutable PtrList<indexedOctree<treeDataEdge>> edgeTreesByType_;

View File

@ -91,13 +91,13 @@ class meshToMesh0
labelListList boundaryAddressing_; labelListList boundaryAddressing_;
//- Inverse-distance interpolation weights //- Inverse-distance interpolation weights
mutable unique_ptr<scalarListList> inverseDistanceWeightsPtr_; mutable std::unique_ptr<scalarListList> inverseDistanceWeightsPtr_;
//- Inverse-volume interpolation weights //- Inverse-volume interpolation weights
mutable unique_ptr<scalarListList> inverseVolumeWeightsPtr_; mutable std::unique_ptr<scalarListList> inverseVolumeWeightsPtr_;
//- Cell to cell overlap addressing //- Cell to cell overlap addressing
mutable unique_ptr<labelListList> cellToCellAddressingPtr_; mutable std::unique_ptr<labelListList> cellToCellAddressingPtr_;
//- Overlap volume //- Overlap volume
mutable scalar V_; mutable scalar V_;

View File

@ -95,11 +95,11 @@ class triSurface
// Demand Driven // Demand Driven
//- Edge-face addressing (sorted) //- Edge-face addressing (sorted)
mutable unique_ptr<labelListList> sortedEdgeFacesPtr_; mutable std::unique_ptr<labelListList> sortedEdgeFacesPtr_;
//- Label of face that 'owns' edge //- Label of face that 'owns' edge
//- i.e. e.vec() is righthanded walk along face //- i.e. e.vec() is righthanded walk along face
mutable unique_ptr<labelList> edgeOwnerPtr_; mutable std::unique_ptr<labelList> edgeOwnerPtr_;
// Private Member Functions // Private Member Functions