Skip to content

Commit

Permalink
Using std::unique_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl authored and speth committed Aug 5, 2023
1 parent e482e13 commit 3dae4d4
Show file tree
Hide file tree
Showing 19 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion include/cantera/base/AnyMap.h
Expand Up @@ -585,7 +585,7 @@ class AnyMap : public AnyBase
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
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/base/Storage.h
Expand Up @@ -117,7 +117,7 @@ class Storage
//! 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
Expand Down
4 changes: 2 additions & 2 deletions include/cantera/equil/vcs_solve.h
Expand Up @@ -1392,7 +1392,7 @@ class VCS_SOLVE
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
/*!
Expand Down Expand Up @@ -1459,7 +1459,7 @@ class VCS_SOLVE
/*!
* 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
/*!
Expand Down
4 changes: 2 additions & 2 deletions include/cantera/kinetics/ImplicitSurfChem.h
Expand Up @@ -260,7 +260,7 @@ class ImplicitSurfChem : public FuncEval

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
Expand Down Expand Up @@ -293,7 +293,7 @@ class ImplicitSurfChem : public FuncEval
/**
* 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
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/numerics/BandMatrix.h
Expand Up @@ -284,7 +284,7 @@ class BandMatrix : public GeneralMatrix
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;
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/oneD/Domain1D.h
Expand Up @@ -601,7 +601,7 @@ class Domain1D

//! 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;
Expand Down
4 changes: 2 additions & 2 deletions include/cantera/oneD/OneDim.h
Expand Up @@ -343,8 +343,8 @@ class OneDim

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

Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/DebyeHuckel.h
Expand Up @@ -911,7 +911,7 @@ class DebyeHuckel : public MolalityVPSSTP
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;
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/HMWSoln.h
Expand Up @@ -1457,7 +1457,7 @@ class HMWSoln : public MolalityVPSSTP
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;
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/Nasa9PolyMultiTempRegion.h
Expand Up @@ -123,7 +123,7 @@ class Nasa9PolyMultiTempRegion : public SpeciesThermoInterpType
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;
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/PDSS_HKFT.h
Expand Up @@ -268,7 +268,7 @@ class PDSS_HKFT : public PDSS_Molar
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)
/*!
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/PureFluidPhase.h
Expand Up @@ -204,7 +204,7 @@ class PureFluidPhase : public ThermoPhase

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;
Expand Down
4 changes: 2 additions & 2 deletions include/cantera/thermo/VPStandardStateTP.h
Expand Up @@ -245,7 +245,7 @@ class VPStandardStateTP : public ThermoPhase
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);
Expand Down Expand Up @@ -282,7 +282,7 @@ class VPStandardStateTP : public ThermoPhase
* 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.
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/WaterSSTP.h
Expand Up @@ -198,7 +198,7 @@ class WaterSSTP : public SingleSpeciesTP
* 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;
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/DustyGasTransport.h
Expand Up @@ -284,7 +284,7 @@ class DustyGasTransport : public Transport
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
2 changes: 1 addition & 1 deletion include/cantera/zeroD/ReactorNet.h
Expand Up @@ -318,7 +318,7 @@ class ReactorNet : public FuncEval
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.
Expand Down
2 changes: 1 addition & 1 deletion samples/cxx/custom/custom.cpp
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions samples/cxx/openmp_ignition/openmp_ignition.cpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/base/application.h
Expand Up @@ -156,7 +156,7 @@ class Application
vector<std::string> errorMessage;

//! Current pointer to the logwriter
std::unique_ptr<Logger> logwriter;
unique_ptr<Logger> logwriter;
};

//! Typedef for thread specific messages
Expand Down

0 comments on commit 3dae4d4

Please sign in to comment.