Using std::unique_ptr

This commit is contained in:
Ingmar Schoegl
2023-08-03 17:08:21 -05:00
committed by Ray Speth
parent e482e13ca2
commit 3dae4d458b
19 changed files with 24 additions and 24 deletions

View File

@@ -585,7 +585,7 @@ public:
private:
const AnyMap* m_data;
OrderVector m_ordered;
std::unique_ptr<std::pair<const std::string, AnyValue>> m_units;
unique_ptr<std::pair<const std::string, AnyValue>> m_units;
};
//! Defined to allow the OrderedProxy class to be used with range-based

View File

@@ -117,7 +117,7 @@ private:
//! ensure that HDF group is writeable
bool checkGroupWrite(const string& id, bool permissive);
std::unique_ptr<HighFive::File> m_file; //!< HDF container file
unique_ptr<HighFive::File> m_file; //!< HDF container file
bool m_write; //!< HDF access mode
int m_compressionLevel=0; //!< HDF compression level
#endif

View File

@@ -1392,7 +1392,7 @@ public:
vector<int> m_elementActive;
//! Array of Phase Structures. Length = number of phases.
vector<std::unique_ptr<vcs_VolPhase>> m_VolPhaseList;
vector<unique_ptr<vcs_VolPhase>> m_VolPhaseList;
//! specifies the activity convention of the phase containing the species
/*!
@@ -1459,7 +1459,7 @@ public:
/*!
* SpeciesThermo[k] pointer to the thermo information for the kth species
*/
vector<std::unique_ptr<VCS_SPECIES_THERMO>> m_speciesThermoList;
vector<unique_ptr<VCS_SPECIES_THERMO>> m_speciesThermoList;
//! Choice of Hessians
/*!

View File

@@ -260,7 +260,7 @@ protected:
vector<vector<int>> pLocVec;
//! Pointer to the CVODE integrator
std::unique_ptr<Integrator> m_integ;
unique_ptr<Integrator> m_integ;
double m_atol, m_rtol; // tolerances
double m_maxstep; //!< max step size
size_t m_nmax; //!< maximum number of steps allowed
@@ -293,7 +293,7 @@ protected:
/**
* Pointer to the helper method, Placid, which solves the surface problem.
*/
std::unique_ptr<solveSP> m_surfSolver;
unique_ptr<solveSP> m_surfSolver;
//! If true, a common temperature and pressure for all surface and bulk
//! phases associated with the surface problem is imposed

View File

@@ -284,7 +284,7 @@ protected:
struct PivData; // pImpl wrapper class
//! Pivot vector
std::unique_ptr<PivData> m_ipiv;
unique_ptr<PivData> m_ipiv;
//! Vector of column pointers
vector<double*> m_colPtrs;

View File

@@ -601,7 +601,7 @@ protected:
//! Identity tag for the domain
std::string m_id;
std::unique_ptr<Refiner> m_refiner;
unique_ptr<Refiner> m_refiner;
vector<std::string> m_name;
int m_bw = -1;
bool m_force_full_update = false;

View File

@@ -343,8 +343,8 @@ protected:
shared_ptr<vector<double>> m_state; //!< Solution vector
std::unique_ptr<MultiJac> m_jac; //!< Jacobian evaluator
std::unique_ptr<MultiNewton> m_newt; //!< Newton iterator
unique_ptr<MultiJac> m_jac; //!< Jacobian evaluator
unique_ptr<MultiNewton> m_newt; //!< Newton iterator
double m_rdt = 0.0; //!< reciprocal of time step
bool m_jac_ok = false; //!< if true, Jacobian is current

View File

@@ -911,7 +911,7 @@ protected:
double m_densWaterSS = 1000.0;
//! Pointer to the water property calculator
std::unique_ptr<WaterProps> m_waterProps;
unique_ptr<WaterProps> m_waterProps;
//! vector of size m_kk, used as a temporary holding area.
mutable vector<double> m_tmpV;

View File

@@ -1457,7 +1457,7 @@ private:
PDSS* m_waterSS = nullptr;
//! Pointer to the water property calculator
std::unique_ptr<WaterProps> m_waterProps;
unique_ptr<WaterProps> m_waterProps;
//! vector of size m_kk, used as a temporary holding area.
mutable vector<double> m_tmpV;

View File

@@ -123,7 +123,7 @@ protected:
vector<double> m_lowerTempBounds;
//! Individual temperature region objects
vector<std::unique_ptr<Nasa9Poly1>> m_regionPts;
vector<unique_ptr<Nasa9Poly1>> m_regionPts;
//! current region
mutable int m_currRegion = 0;

View File

@@ -268,7 +268,7 @@ private:
mutable double m_densWaterSS = -1.0;
//! Pointer to the water property calculator
std::unique_ptr<WaterProps> m_waterProps;
unique_ptr<WaterProps> m_waterProps;
//! Input value of deltaG of Formation at Tr and Pr (cal gmol-1)
/*!

View File

@@ -204,7 +204,7 @@ protected:
private:
//! Pointer to the underlying tpx object Substance that does the work
mutable std::unique_ptr<tpx::Substance> m_sub;
mutable unique_ptr<tpx::Substance> m_sub;
//! Name for this substance used by the TPX package
std::string m_tpx_name;

View File

@@ -245,7 +245,7 @@ public:
virtual bool addSpecies(shared_ptr<Species> spec);
//! Install a PDSS object for species *k*
void installPDSS(size_t k, std::unique_ptr<PDSS>&& pdss);
void installPDSS(size_t k, unique_ptr<PDSS>&& pdss);
//! @}
PDSS* providePDSS(size_t k);
@@ -282,7 +282,7 @@ protected:
* Storage is in species index order. VPStandardStateTp owns each of the
* objects. Copy operations are deep.
*/
vector<std::unique_ptr<PDSS>> m_PDSS_storage;
vector<unique_ptr<PDSS>> m_PDSS_storage;
//! Vector containing the species reference enthalpies at T = m_tlast
//! and P = p_ref.

View File

@@ -198,7 +198,7 @@ private:
* of water. This object owns m_waterProps, and the WaterPropsIAPWS object
* used by WaterProps is m_sub, which is defined above.
*/
std::unique_ptr<WaterProps> m_waterProps;
unique_ptr<WaterProps> m_waterProps;
//! Molecular weight of Water -> %Cantera assumption
double m_mw = 0.0;

View File

@@ -284,7 +284,7 @@ private:
double m_perm = -1.0;
//! Pointer to the transport object for the gas phase
std::unique_ptr<Transport> m_gastran;
unique_ptr<Transport> m_gastran;
};
}
#endif

View File

@@ -318,7 +318,7 @@ protected:
virtual int lastOrder() const;
vector<Reactor*> m_reactors;
std::unique_ptr<Integrator> m_integ;
unique_ptr<Integrator> m_integ;
//! The independent variable in the system. May be either time or space depending
//! on the type of reactors in the network.

View File

@@ -180,7 +180,7 @@ int main() {
// relative tolerance: 1.0e-9
// absolute tolerance: 1.0e-15
// max step size: +inf
std::unique_ptr<Integrator> integrator(newIntegrator("CVODE"));
unique_ptr<Integrator> integrator(newIntegrator("CVODE"));
// initialize the integrator, specifying the start time and the RHS evaluator object.
// internally, the integrator will apply settings, allocate needed memory, and populate

View File

@@ -29,8 +29,8 @@ void run()
// to have its own set of linked Cantera objects. Multiple threads accessing
// the same objects at the same time will cause errors.
vector<shared_ptr<Solution>> sols;
vector<std::unique_ptr<IdealGasConstPressureReactor>> reactors;
vector<std::unique_ptr<ReactorNet>> nets;
vector<unique_ptr<IdealGasConstPressureReactor>> reactors;
vector<unique_ptr<ReactorNet>> nets;
// Create and link the Cantera objects for each thread. This step should be
// done in serial

View File

@@ -156,7 +156,7 @@ protected:
vector<std::string> errorMessage;
//! Current pointer to the logwriter
std::unique_ptr<Logger> logwriter;
unique_ptr<Logger> logwriter;
};
//! Typedef for thread specific messages