Merge branch 'master' into symbolic-atom-constants

This commit is contained in:
Axel Kohlmeyer
2020-09-15 17:44:31 -04:00
1186 changed files with 8448 additions and 8360 deletions

View File

@ -30,26 +30,26 @@ namespace ATC {
useFeMdMassMatrix_(false),
trackCharge_(false),
temperatureDef_(NONE),
prescribedDataMgr_(NULL),
physicsModel_(NULL),
prescribedDataMgr_(nullptr),
physicsModel_(nullptr),
extrinsicModelManager_(this),
atomicRegulator_(NULL),
atomicRegulator_(nullptr),
atomQuadForInternal_(true),
elementMask_(NULL),
elementMaskMass_(NULL),
elementMaskMassMd_(NULL),
nodalAtomicMass_(NULL),
nodalAtomicCount_(NULL),
nodalAtomicHeatCapacity_(NULL),
internalToMask_(NULL),
internalElement_(NULL),
ghostElement_(NULL),
nodalGeometryType_(NULL),
elementMask_(nullptr),
elementMaskMass_(nullptr),
elementMaskMassMd_(nullptr),
nodalAtomicMass_(nullptr),
nodalAtomicCount_(nullptr),
nodalAtomicHeatCapacity_(nullptr),
internalToMask_(nullptr),
internalElement_(nullptr),
ghostElement_(nullptr),
nodalGeometryType_(nullptr),
bndyIntType_(NO_QUADRATURE),
bndyFaceSet_(NULL),
atomicWeightsMask_(NULL),
shpFcnMask_(NULL),
shpFcnDerivsMask_(NULL),
bndyFaceSet_(nullptr),
atomicWeightsMask_(nullptr),
shpFcnMask_(nullptr),
shpFcnDerivsMask_(nullptr),
sourceIntegration_(FULL_DOMAIN)
{
// size the field mask
@ -68,7 +68,7 @@ namespace ATC {
ATC_Coupling::~ATC_Coupling()
{
interscaleManager_.clear();
if (feEngine_) { delete feEngine_; feEngine_ = NULL; }
if (feEngine_) { delete feEngine_; feEngine_ = nullptr; }
if (physicsModel_) delete physicsModel_;
if (atomicRegulator_) delete atomicRegulator_;
if (prescribedDataMgr_) delete prescribedDataMgr_;
@ -127,7 +127,7 @@ namespace ATC {
argIdx++;
parse_field(arg,argIdx,thisField,thisIndex);
string nsetName(arg[argIdx++]);
XT_Function * f = NULL;
XT_Function * f = nullptr;
// parse constant
if (narg == argIdx+1) {
f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx]));
@ -164,7 +164,7 @@ namespace ATC {
argIdx++;
parse_field(arg,argIdx,thisField,thisIndex);
string nsetName(arg[argIdx++]);
XT_Function * f = NULL;
XT_Function * f = nullptr;
// fix current value
if (narg == argIdx) {
set<int> nodeSet = (feEngine_->fe_mesh())->nodeset(nsetName);
@ -258,7 +258,7 @@ namespace ATC {
argIdx++;
parse_field(arg,argIdx,thisField,thisIndex);
string esetName(arg[argIdx++]);
XT_Function * f = NULL;
XT_Function * f = nullptr;
// parse constant
if (narg == argIdx+1) {
string a(arg[argIdx]);
@ -367,7 +367,7 @@ namespace ATC {
argIdx++;
parse_field(arg,argIdx,thisField,thisIndex);
string fsetName(arg[argIdx++]);
XT_Function * f = NULL;
XT_Function * f = nullptr;
// parse constant
if (narg == argIdx+1) {
f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx]));
@ -529,7 +529,7 @@ namespace ATC {
argIdx++;
parse_field(arg,argIdx,thisField,thisIndex);
string fsetName(arg[argIdx++]);
UXT_Function * f = NULL;
UXT_Function * f = nullptr;
// parse linear
if (narg == argIdx+2) {
f = UXT_Function_Mgr::instance()->linear_function(atof(arg[argIdx]),atof(arg[argIdx+1]));
@ -760,7 +760,7 @@ namespace ATC {
WeakEquation::PDE_Type ATC_Coupling::pde_type(const FieldName fieldName) const
{
const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName);
if (weakEq == NULL) return WeakEquation::PROJECTION_PDE;
if (weakEq == nullptr) return WeakEquation::PROJECTION_PDE;
return weakEq->type();
}
//--------------------------------------------------
@ -768,7 +768,7 @@ namespace ATC {
bool ATC_Coupling::is_dynamic(const FieldName fieldName) const
{
const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName);
if (weakEq == NULL) return false;
if (weakEq == nullptr) return false;
return (physicsModel_->weak_equation(fieldName)->type() == WeakEquation::DYNAMIC_PDE);
}

View File

@ -114,10 +114,10 @@ namespace ATC {
FIELDS &rhs,
const Array< std::set <int> > atomMaterialGroups,
const VectorDependencyManager<SPAR_MAT * > * shpFcnDerivs,
const SPAR_MAN * shpFcn = NULL,
const DIAG_MAN * atomicWeights = NULL,
const MatrixDependencyManager<DenseMatrix, bool> * elementMask = NULL,
const SetDependencyManager<int> * nodeSet = NULL);
const SPAR_MAN * shpFcn = nullptr,
const DIAG_MAN * atomicWeights = nullptr,
const MatrixDependencyManager<DenseMatrix, bool> * elementMask = nullptr,
const SetDependencyManager<int> * nodeSet = nullptr);
/** access to full right hand side / forcing vector */
FIELDS &rhs() {return rhs_;};
Array2D <bool> rhs_mask() const {
@ -152,14 +152,14 @@ namespace ATC {
const FIELDS &fields,
FIELDS &rhs,
const IntegrationDomainType domain, // = FULL_DOMAIN
const PhysicsModel * physicsModel=NULL);
const PhysicsModel * physicsModel=nullptr);
/** wrapper for FE_Engine's compute_tangent_matrix */
void compute_rhs_tangent(const std::pair<FieldName,FieldName> row_col,
const RHS_MASK & rhsMask,
const FIELDS & fields,
SPAR_MAT & stiffness,
const IntegrationDomainType integrationType,
const PhysicsModel * physicsModel=NULL);
const PhysicsModel * physicsModel=nullptr);
void tangent_matrix(const std::pair<FieldName,FieldName> row_col,
const RHS_MASK & rhsMask,
const PhysicsModel * physicsModel,
@ -197,7 +197,7 @@ namespace ATC {
return & (it->second).quantity();
}
else {
return NULL;
return nullptr;
}
}
else {
@ -206,7 +206,7 @@ namespace ATC {
return & (it->second).quantity();
}
else {
return NULL;
return nullptr;
}
}
}
@ -233,7 +233,7 @@ namespace ATC {
/** access to time integrator */
const TimeIntegrator * time_integrator(const FieldName & field) const {
_ctiIt_ = timeIntegrators_.find(field);
if (_ctiIt_ == timeIntegrators_.end()) return NULL;
if (_ctiIt_ == timeIntegrators_.end()) return nullptr;
return _ctiIt_->second;
};
@ -322,7 +322,7 @@ namespace ATC {
void compute_flux(const Array2D<bool> & rhs_mask,
const FIELDS &fields,
GRAD_FIELD_MATS &flux,
const PhysicsModel * physicsModel=NULL,
const PhysicsModel * physicsModel=nullptr,
const bool normalize = false);
/** evaluate rhs on the atomic domain which is near the FE region */
void masked_atom_domain_rhs_integral(const Array2D<bool> & rhs_mask,
@ -334,7 +334,7 @@ namespace ATC {
const FIELDS &fields,
FIELDS &rhs,
const IntegrationDomainType domain,
const PhysicsModel * physicsModel=NULL);
const PhysicsModel * physicsModel=nullptr);
/** access to boundary fluxes */
DENS_MAT &get_boundary_flux(FieldName thisField){return boundaryFlux_[thisField].set_quantity();};
DENS_MAN &boundary_flux(FieldName thisField){return boundaryFlux_[thisField];};
@ -352,7 +352,7 @@ namespace ATC {
// mass matrix filtering
void delete_mass_mat_time_filter(FieldName thisField);
/** compute mass matrix for requested field */
void compute_mass_matrix(FieldName thisField, PhysicsModel * physicsModel = NULL);
void compute_mass_matrix(FieldName thisField, PhysicsModel * physicsModel = nullptr);
/** updates filtering of MD contributions */
void update_mass_matrix(FieldName thisField);
/** compute the mass matrix components coming from MD integration */

View File

@ -30,8 +30,8 @@ namespace ATC {
string matParamFile,
ExtrinsicModelType extrinsicModel)
: ATC_Coupling(groupName,perAtomArray,thisFix),
nodalAtomicKineticTemperature_(NULL),
nodalAtomicConfigurationalTemperature_(NULL)
nodalAtomicKineticTemperature_(nullptr),
nodalAtomicConfigurationalTemperature_(nullptr)
{
// Allocate PhysicsModel
create_physics_model(THERMAL, matParamFile);
@ -103,7 +103,7 @@ namespace ATC {
// always need kinetic energy
AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this);
AtomicEnergyForTemperature * atomEnergyForTemperature = NULL;
AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr;
// Appropriate per-atom quantity based on desired temperature definition
if (temperatureDef_==KINETIC) {

View File

@ -32,8 +32,8 @@ namespace ATC {
string matParamFile,
ExtrinsicModelType extrinsicModel)
: ATC_Coupling(groupName,perAtomArray,thisFix),
nodalAtomicKineticTemperature_(NULL),
nodalAtomicConfigurationalTemperature_(NULL),
nodalAtomicKineticTemperature_(nullptr),
nodalAtomicConfigurationalTemperature_(nullptr),
refPE_(0)
{
// Allocate PhysicsModel
@ -190,7 +190,7 @@ namespace ATC {
FieldManager fieldManager(this);
PerAtomQuantity<double> * fluctuatingAtomicVelocity = fieldManager.per_atom_quantity("AtomicFluctuatingVelocity"); // also creates ProlongedVelocity
AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this,fluctuatingAtomicVelocity);
AtomicEnergyForTemperature * atomEnergyForTemperature = NULL;
AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr;
// Appropriate per-atom quantity based on desired temperature definition
if (temperatureDef_==KINETIC) {

View File

@ -35,37 +35,37 @@ using std::pair;
namespace ATC {
ATC_Method::ATC_Method(string groupName, double ** & perAtomArray, LAMMPS_NS::Fix * thisFix) :
nodalAtomicVolume_(NULL),
nodalAtomicVolume_(nullptr),
needReset_(true),
lammpsInterface_(LammpsInterface::instance()),
interscaleManager_(this),
timeFilterManager_(this),
integrateInternalAtoms_(false),
atomTimeIntegrator_(NULL),
atomTimeIntegrator_(nullptr),
ghostManager_(this),
feEngine_(NULL),
feEngine_(nullptr),
initialized_(false),
meshDataInitialized_(false),
localStep_(0),
sizeComm_(8), // 3 positions + 1 material id * 2 for output
atomCoarseGrainingPositions_(NULL),
atomGhostCoarseGrainingPositions_(NULL),
atomProcGhostCoarseGrainingPositions_(NULL),
atomReferencePositions_(NULL),
atomCoarseGrainingPositions_(nullptr),
atomGhostCoarseGrainingPositions_(nullptr),
atomProcGhostCoarseGrainingPositions_(nullptr),
atomReferencePositions_(nullptr),
nNodes_(0),
nsd_(lammpsInterface_->dimension()),
xref_(NULL),
xref_(nullptr),
readXref_(false),
needXrefProcessorGhosts_(false),
trackDisplacement_(false),
needsAtomToElementMap_(true),
atomElement_(NULL),
atomGhostElement_(NULL),
atomElement_(nullptr),
atomGhostElement_(nullptr),
internalElementSet_(""),
atomMasses_(NULL),
atomPositions_(NULL),
atomVelocities_(NULL),
atomForces_(NULL),
atomMasses_(nullptr),
atomPositions_(nullptr),
atomVelocities_(nullptr),
atomForces_(nullptr),
parallelConsistency_(true),
outputNow_(false),
outputTime_(true),
@ -79,13 +79,13 @@ namespace ATC {
sizeVector_(0),
scalarVectorFreq_(0),
sizePerAtomCols_(4),
perAtomOutput_(NULL),
perAtomOutput_(nullptr),
perAtomArray_(perAtomArray),
extScalar_(0),
extVector_(0),
extList_(NULL),
extList_(nullptr),
thermoEnergyFlag_(0),
atomVolume_(NULL),
atomVolume_(nullptr),
atomicWeightsWriteFlag_(false),
atomicWeightsWriteFrequency_(0),
atomWeightType_(LATTICE),
@ -103,12 +103,12 @@ namespace ATC {
mdMassNormalization_(false),
kernelBased_(false),
kernelOnTheFly_(false),
kernelFunction_(NULL),
kernelFunction_(nullptr),
bondOnTheFly_(false),
accumulant_(NULL),
accumulantMol_(NULL),
accumulantMolGrad_(NULL),
accumulantWeights_(NULL),
accumulant_(nullptr),
accumulantMol_(nullptr),
accumulantMolGrad_(nullptr),
accumulantWeights_(nullptr),
accumulantInverseVolumes_(&invNodeVolumes_),
accumulantBandwidth_(0),
useRestart_(false),
@ -117,7 +117,7 @@ namespace ATC {
setRefPEvalue_(false),
refPEvalue_(0.),
readRefPE_(false),
nodalRefPotentialEnergy_(NULL),
nodalRefPotentialEnergy_(nullptr),
simTime_(0.0),
stepCounter_(0)
{
@ -1122,7 +1122,7 @@ pecified
FieldName & thisField, int & thisIndex)
{
string thisName = args[argIdx++];
if (args[argIdx] == NULL) {
if (args[argIdx] == nullptr) {
throw ATC_Error("Need to give field '"+thisName+"' more args");
}
thisField = string_to_field(thisName);
@ -1282,7 +1282,7 @@ pecified
if (this->reset_methods()) {
// clear memory manager
interscaleManager_.clear_temporary_data();
atomVolume_ = NULL;
atomVolume_ = nullptr;
// reference positions and energy
if (!initialized_) {
@ -1517,7 +1517,7 @@ pecified
}
else {
// set variables to compute atomic weights
DENS_MAN * nodalVolume(NULL);
DENS_MAN * nodalVolume(nullptr);
switch (atomWeightType_) {
case USER:
atomVolume_ = new AtomVolumeUser(this,Valpha_);

View File

@ -423,7 +423,7 @@ namespace ATC {
bool use_md_mass_normalization() const { return mdMassNormalization_;}
bool kernel_based() { return kernelBased_; }
bool kernel_on_the_fly() const { return kernelOnTheFly_;}
bool has_kernel_function() { return kernelFunction_ != NULL; }
bool has_kernel_function() { return kernelFunction_ != nullptr; }
KernelFunction * kernel_function() { return kernelFunction_; }
std::vector<int> & type_list() { return typeList_; }
std::vector<int> & group_list() { return groupList_; }

View File

@ -68,19 +68,19 @@ namespace ATC {
LAMMPS_NS::Fix * thisFix,
string matParamFile)
: ATC_Method(groupName,perAtomArray,thisFix),
xPointer_(NULL),
xPointer_(nullptr),
outputStepZero_(true),
neighborReset_(false),
pairMap_(NULL),
bondMatrix_(NULL),
pairVirial_(NULL),
pairHeatFlux_(NULL),
pairMap_(nullptr),
bondMatrix_(nullptr),
pairVirial_(nullptr),
pairHeatFlux_(nullptr),
nComputes_(0),
hasPairs_(true),
hasBonds_(false),
resetKernelFunction_(false),
dxaExactMode_(true),
cauchyBornStress_(NULL)
cauchyBornStress_(nullptr)
{
nTypes_ = lammpsInterface_->ntypes();
@ -114,7 +114,7 @@ namespace ATC {
rateFlags_ = false;
outputFields_.resize(NUM_TOTAL_FIELDS);
for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = NULL; }
for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = nullptr; }
// Hardy requires ref positions for processor ghosts for bond list
@ -491,7 +491,7 @@ namespace ATC {
ComputedAtomQuantity * c = new ComputedAtomQuantity(this, tag);
interscaleManager_.add_per_atom_quantity(c,tag);
int projection = iter->second;
DIAG_MAN * w = NULL;
DIAG_MAN * w = nullptr;
if (projection == VOLUME_NORMALIZATION )
{ w = accumulantInverseVolumes_; }
else if (projection == NUMBER_NORMALIZATION )
@ -976,7 +976,7 @@ namespace ATC {
DENS_MAT & H = hardyData_["displacement_gradient"].set_quantity();
DENS_MAT E(H.nRows(),1);
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity());
const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity());
//DENS_MAT & T = hardyData_["temperature"];
//cauchy_born_entropic_energy(H,E,T); E += hardyData_["internal_energy"];
cauchy_born_energy(H, E, temp);
@ -988,14 +988,14 @@ namespace ATC {
// compute: cauchy born stress
if (fieldFlags_(CAUCHY_BORN_STRESS)) {
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity());
const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity());
cauchy_born_stress(hardyData_["displacement_gradient"].quantity(),
hardyData_["cauchy_born_stress"].set_quantity(), temp);
}
// compute: cauchy born energy
if (fieldFlags_(CAUCHY_BORN_ENERGY)) {
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity());
const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity());
cauchy_born_energy(hardyData_["displacement_gradient"].quantity(),
hardyData_["cauchy_born_energy"].set_quantity(), temp);
}

View File

@ -78,7 +78,7 @@ protected:
template<typename T>
Array<T>::Array(void) {
len_ = 0;
data_ = NULL;
data_ = nullptr;
}
template<typename T>
@ -90,8 +90,8 @@ Array<T>::Array(int len) {
template<typename T>
Array<T>::Array(const Array<T>& A) {
len_ = A.len_;
if (A.data_==NULL)
data_ = NULL;
if (A.data_==nullptr)
data_ = nullptr;
else {
data_ = new T[len_];
for(int i=0;i<len_;i++)
@ -101,7 +101,7 @@ Array<T>::Array(const Array<T>& A) {
template<typename T>
Array<T>::~Array() {
if (data_ != NULL) delete[] data_;
if (data_ != nullptr) delete[] data_;
}
template<typename T>
@ -111,12 +111,12 @@ void Array<T>::reset(int len) {
}
else { // size change, realloc memory
len_ = len;
if (data_ != NULL)
if (data_ != nullptr)
delete[] data_;
if (len_ > 0)
data_ = new T[len_];
else {
data_ = NULL;
data_ = nullptr;
len_ = 0;
}
}
@ -130,7 +130,7 @@ void Array<T>::resize(int len, bool copy) {
else { // size change, realloc memory
len_ = len;
if (len_ > 0) {
if (copy && data_ != NULL) {
if (copy && data_ != nullptr) {
Array<T> temp(*this);
delete[] data_;
data_ = new T[len_];
@ -140,12 +140,12 @@ void Array<T>::resize(int len, bool copy) {
}
}
else {
if (data_ != NULL) delete[] data_;
if (data_ != nullptr) delete[] data_;
data_ = new T[len_];
}
}
else {
data_ = NULL;
data_ = nullptr;
len_ = 0;
}
}
@ -158,10 +158,10 @@ T& Array<T>::operator() (int i) {
template<typename T>
Array<T>& Array<T>::operator= (const Array<T> &other) {
if (data_ == NULL) { // initialize my internal storage to match LHS
if (data_ == nullptr) { // initialize my internal storage to match LHS
len_ = other.len_;
if (other.data_==NULL)
data_ = NULL;
if (other.data_==nullptr)
data_ = nullptr;
else
data_ = new T[len_];
}
@ -250,7 +250,7 @@ T* Array<T>::ptr() const {
template<typename T>
void Array<T>::print(std::string name) const {
std::cout << "------- Begin "<<name<<" -----------------\n";
if (data_ != NULL) {
if (data_ != nullptr) {
for(int i=0;i<len_;i++) std::cout << data_[i] << " ";
std::cout << "\n";
}
@ -283,7 +283,7 @@ AliasArray<T>::AliasArray(const Array<T>& A) {
template<typename T>
AliasArray<T>::~AliasArray(void) {
len_ = 0;
data_ = NULL; // trick base class into not deleting parent data
data_ = nullptr; // trick base class into not deleting parent data
}
template<typename T>

View File

@ -57,7 +57,7 @@ template<typename T>
Array2D<T>::Array2D() {
nrows_ = 0;
ncols_ = 0;
data_ = NULL;
data_ = nullptr;
}
template<typename T>
@ -71,8 +71,8 @@ template<typename T>
Array2D<T>::Array2D(const Array2D<T>& A) {
nrows_ = A.nrows_;
ncols_ = A.ncols_;
if (A.data_==NULL)
data_ = NULL;
if (A.data_==nullptr)
data_ = nullptr;
else {
data_ = new T[nrows_ * ncols_];
for(int i=0;i<nrows_*ncols_;i++)
@ -88,12 +88,12 @@ void Array2D<T>::reset(int nrows, int ncols) {
else { // size changed; realloc memory
nrows_ = nrows;
ncols_ = ncols;
if (data_ != NULL)
if (data_ != nullptr)
delete [] data_;
if (ncols_ > 0 && nrows_ > 0)
data_ = new T[nrows_ * ncols_];
else {
data_ = NULL;
data_ = nullptr;
nrows_ = 0;
ncols_ = 0;
}
@ -120,11 +120,11 @@ AliasArray<T> Array2D<T>::column(int col) const {
template<typename T>
Array2D<T>& Array2D<T>::operator= (const Array2D<T>& other) {
if (data_ == NULL) { // initialize my internal storage to match LHS
if (data_ == nullptr) { // initialize my internal storage to match LHS
nrows_ = other.nrows_;
ncols_ = other.ncols_;
if (other.data_==NULL)
data_ = NULL;
if (other.data_==nullptr)
data_ = nullptr;
else
data_ = new T[nrows_ * ncols_];
}
@ -170,14 +170,14 @@ void Array2D<T>::write_restart(FILE *f) const {
template<typename T>
Array2D<T>::~Array2D() {
if (data_ != NULL)
if (data_ != nullptr)
delete[] data_;
}
template<typename T>
void Array2D<T>::print(std::string name) const {
std::cout << "------- Begin "<<name<<" -----------------\n";
if (data_ != NULL) {
if (data_ != nullptr) {
for(int col=0;col<ncols_;col++) {
for(int row=0;row<nrows_;row++) {
std::cout << data_[col*nrows_ + row] << " ";

View File

@ -47,8 +47,8 @@ namespace ATC {
nLocal_(0),
useLocalizedLambda_(false),
useLumpedLambda_(false),
timeFilter_(NULL),
regulatorMethod_(NULL),
timeFilter_(nullptr),
regulatorMethod_(nullptr),
boundaryIntegrationType_(NO_QUADRATURE),
regulatorPrefix_(regulatorPrefix)
{
@ -97,7 +97,7 @@ namespace ATC {
//--------------------------------------------------------
DENS_MAN * AtomicRegulator::regulator_data(const string tag, int nCols)
{
DENS_MAN * data(NULL);
DENS_MAN * data(nullptr);
map<string, pair<bool,DENS_MAN * > >::iterator it = regulatorData_.find(tag);
if (it == regulatorData_.end()) {
data = new DENS_MAN(nNodes_,nCols);
@ -115,14 +115,14 @@ namespace ATC {
//--------------------------------------------------------
// get_regulator_data:
// gets a pointer to the requested data, or NULL if
// gets a pointer to the requested data, or nullptr if
// if doesn't exist
//--------------------------------------------------------
const DENS_MAN * AtomicRegulator::regulator_data(const string tag) const
{
map<string, pair<bool,DENS_MAN * > >::const_iterator it = regulatorData_.find(tag);
if (it == regulatorData_.end()) {
return NULL;
return nullptr;
}
else {
return const_cast<DENS_MAN * >((it->second).second);
@ -521,7 +521,7 @@ namespace ATC {
fieldMask_(NUM_FIELDS,NUM_FLUX),
nNodes_(atomicRegulator_->num_nodes()),
regulatorPrefix_(atomicRegulator->regulator_prefix()+regulatorPrefix),
shpFcnDerivs_(NULL)
shpFcnDerivs_(nullptr)
{
fieldMask_ = false;
}
@ -552,21 +552,21 @@ namespace ATC {
RegulatorShapeFunction::RegulatorShapeFunction(AtomicRegulator * atomicRegulator,
const string & regulatorPrefix) :
RegulatorMethod(atomicRegulator,regulatorPrefix),
lambda_(NULL),
atomLambdas_(NULL),
shapeFunctionMatrix_(NULL),
lambda_(nullptr),
atomLambdas_(nullptr),
shapeFunctionMatrix_(nullptr),
linearSolverType_(AtomicRegulator::NO_SOLVE),
maxIterations_(atomicRegulator->max_iterations()),
tolerance_(atomicRegulator->tolerance()),
matrixSolver_(NULL),
regulatedNodes_(NULL),
applicationNodes_(NULL),
boundaryNodes_(NULL),
shpFcn_(NULL),
atomicWeights_(NULL),
elementMask_(NULL),
lambdaAtomMap_(NULL),
weights_(NULL),
matrixSolver_(nullptr),
regulatedNodes_(nullptr),
applicationNodes_(nullptr),
boundaryNodes_(nullptr),
shpFcn_(nullptr),
atomicWeights_(nullptr),
elementMask_(nullptr),
lambdaAtomMap_(nullptr),
weights_(nullptr),
nsd_(atomicRegulator_->nsd()),
nLocal_(atomicRegulator_->nlocal())
{

View File

@ -143,7 +143,7 @@ namespace ATC {
/** can externally set regulator dynamic contributions */
virtual void reset_lambda_contribution(const DENS_MAT & /* target */, const FieldName /* field */) {};
virtual void reset_lambda_contribution(const DENS_MAT & target) { reset_lambda_contribution(target,NUM_TOTAL_FIELDS); }
/** returns a const pointer to the DENS_MAN associated with the tag, or NULL */
/** returns a const pointer to the DENS_MAN associated with the tag, or nullptr */
const DENS_MAN * regulator_data(const std::string tag) const;
/** return the maximum number of iterations */
int max_iterations() {return maxIterations_;};

View File

@ -426,7 +426,7 @@ namespace ATC {
for (INDEX j=i; j<3; j++)
s(i,j) += factor * dd(i,j);
// If f_W is not NULL then append thermal contribution.
// If f_W is not nullptr then append thermal contribution.
if (F_w) *F_w += 0.5*kb*T*log(detD);
}
//============================================================================

View File

@ -164,7 +164,7 @@ namespace ATC {
chargeRegulator_(chargeRegulator),
lammpsInterface_(LammpsInterface::instance()),
rC_(0), rCsq_(0),
targetValue_(NULL),
targetValue_(nullptr),
targetPhi_(p.value),
surface_(p.faceset),
atomGroupBit_(p.groupBit),

View File

@ -52,7 +52,7 @@ private:
//-----------------------------------------------------------------------------
template<typename T>
CloneVector<T>::CloneVector(const Vector<T> &c)
: Vector<T>(), _baseV(const_cast<Vector<T>*>(&c)), _baseM(NULL)
: Vector<T>(), _baseV(const_cast<Vector<T>*>(&c)), _baseM(nullptr)
{}
//-----------------------------------------------------------------------------
// Construct from a matrix, the const_cast isn't pretty
@ -65,7 +65,7 @@ CloneVector<T>::CloneVector(const Vector<T> &c)
//-----------------------------------------------------------------------------
template<typename T>
CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx)
: Vector<T>(), _baseV(NULL), _baseM(const_cast<Matrix<T>*>(&c))
: Vector<T>(), _baseV(nullptr), _baseM(const_cast<Matrix<T>*>(&c))
, _clone_type(dim), _idx(idx)
{}
//-----------------------------------------------------------------------------
@ -73,7 +73,7 @@ CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx)
//-----------------------------------------------------------------------------
template<typename T>
CloneVector<T>::CloneVector(const DiagonalMatrix<T> &c, INDEX /* idx */)
: Vector<T>(), _baseV(NULL), _baseM(const_cast<DiagonalMatrix<T>*>(&c))
: Vector<T>(), _baseV(nullptr), _baseM(const_cast<DiagonalMatrix<T>*>(&c))
, _clone_type(CLONE_DIAG), _idx(0)
{}
//-----------------------------------------------------------------------------

View File

@ -186,14 +186,14 @@ const double kMinScale_ = 10000.;
ConcentrationRegulator::ConcentrationRegulatorParameters & p)
: ConcentrationRegulatorMethod(concReg),
concentrationRegulator_(concReg),
interscaleManager_(NULL),
interscaleManager_(nullptr),
lammpsInterface_(LammpsInterface::instance()),
list_(NULL),
list_(nullptr),
targetConcentration_(p.value),
targetCount_(0),
elemset_(p.elemset),
p_(NULL),
randomNumberGenerator_(NULL),
p_(nullptr),
randomNumberGenerator_(nullptr),
q0_(0),
controlType_(p.type),
controlIndex_(0),

View File

@ -16,10 +16,10 @@ template <typename T>
class DenseMatrix : public Matrix<T>
{
public:
DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(NULL){ _create(rows, cols, z); }
DenseMatrix(const DenseMatrix<T>& c) : Matrix<T>(), _data(NULL){ _copy(c); }
DenseMatrix(const SparseMatrix<T>& c): Matrix<T>(), _data(NULL){ c.dense_copy(*this);}
DenseMatrix(const Matrix<T>& c) : Matrix<T>(), _data(NULL){ _copy(c); }
DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(nullptr){ _create(rows, cols, z); }
DenseMatrix(const DenseMatrix<T>& c) : Matrix<T>(), _data(nullptr){ _copy(c); }
DenseMatrix(const SparseMatrix<T>& c): Matrix<T>(), _data(nullptr){ c.dense_copy(*this);}
DenseMatrix(const Matrix<T>& c) : Matrix<T>(), _data(nullptr){ _copy(c); }
// const SparseMatrix<T> * p = sparse_cast(&c);
// (p) ? p->dense_copy(*this) : _copy(c); }
~DenseMatrix() { _delete();}
@ -261,7 +261,7 @@ void DenseMatrix<T>::_delete()
_nRows = _nCols = 0;
if (_data){
delete [] _data;
_data = NULL;
_data = nullptr;
}
}
//----------------------------------------------------------------------------
@ -273,7 +273,7 @@ void DenseMatrix<T>::_create(INDEX rows, INDEX cols, bool zero)
_nRows=rows;
_nCols=cols;
_data = (this->size() ? new T [_nCols*_nRows] : NULL);
_data = (this->size() ? new T [_nCols*_nRows] : nullptr);
if (zero) this->zero();
}
//----------------------------------------------------------------------------

View File

@ -16,9 +16,9 @@ class DenseVector : public Vector<T>
{
public:
explicit DenseVector(INDEX n=0, bool z=1) { _create(n,z); }
DenseVector(const DenseVector<T> &c) : Vector<T>(), _data(NULL) { _copy(c); }
DenseVector(const Vector<T> &c) : Vector<T>(), _data(NULL) { _copy(c); }
DenseVector(const T * ptr, INDEX nrows) : Vector<T>(), _data(NULL) { copy(ptr,nrows); }
DenseVector(const DenseVector<T> &c) : Vector<T>(), _data(nullptr) { _copy(c); }
DenseVector(const Vector<T> &c) : Vector<T>(), _data(nullptr) { _copy(c); }
DenseVector(const T * ptr, INDEX nrows) : Vector<T>(), _data(nullptr) { copy(ptr,nrows); }
virtual ~DenseVector() { _delete(); }
//* resizes the Vector, ignores nCols, optionally copys what fits
@ -123,7 +123,7 @@ template <typename T>
inline void DenseVector<T>::_create(INDEX n, bool zero)
{
_size=n;
_data = _size ? new T [_size] : NULL ;
_data = _size ? new T [_size] : nullptr ;
if (zero) this->zero();
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -205,7 +205,7 @@ DiagonalMatrix<T> operator-(const DiagonalMatrix<T> &A, const DiagonalMatrix<T>
//-----------------------------------------------------------------------------
template<typename T>
DiagonalMatrix<T>::DiagonalMatrix(INDEX rows, bool zero)
: _data(NULL)
: _data(nullptr)
{
reset(rows, zero);
}
@ -214,7 +214,7 @@ DiagonalMatrix<T>::DiagonalMatrix(INDEX rows, bool zero)
//-----------------------------------------------------------------------------
template<typename T>
DiagonalMatrix<T>::DiagonalMatrix(const DiagonalMatrix<T>& c)
: Matrix<T>(), _data(NULL)
: Matrix<T>(), _data(nullptr)
{
reset(c);
}
@ -223,7 +223,7 @@ DiagonalMatrix<T>::DiagonalMatrix(const DiagonalMatrix<T>& c)
//-----------------------------------------------------------------------------
template<typename T>
DiagonalMatrix<T>::DiagonalMatrix(const Vector<T>& v)
: Matrix<T>(), _data(NULL)
: Matrix<T>(), _data(nullptr)
{
reset(v);
}

View File

@ -197,7 +197,7 @@ protected:
a.pos.Y = atom->x[i][1];
a.pos.Z = atom->x[i][2];
a.flags = 0;
a.cluster = NULL;
a.cluster = nullptr;
a.numNeighbors = 0;
a.setFlag(ATOM_IS_LOCAL_ATOM);
}
@ -290,7 +290,7 @@ protected:
currentAtom->pos.Y = atom->x[i][1];
currentAtom->pos.Z = atom->x[i][2];
currentAtom->flags = 0;
currentAtom->cluster = NULL;
currentAtom->cluster = nullptr;
currentAtom->numNeighbors = 0;
currentAtom->setFlag(ATOM_IS_LOCAL_ATOM);
}
@ -302,7 +302,7 @@ protected:
// Receive atoms from other processors.
for(int iproc = 1; iproc < comm->nprocs; iproc++) {
MPI_Status status;
MPI_Recv(buffer.empty() ? NULL : &buffer.front(), nlocalatoms_max * 3, MPI_DOUBLE, iproc, 0, world, &status);
MPI_Recv(buffer.empty() ? nullptr : &buffer.front(), nlocalatoms_max * 3, MPI_DOUBLE, iproc, 0, world, &status);
int ndoubles;
MPI_Get_count(&status, MPI_DOUBLE, &ndoubles);
int nReceived = ndoubles / 3;
@ -314,7 +314,7 @@ protected:
currentAtom->pos.Y = *data++;
currentAtom->pos.Z = *data++;
currentAtom->flags = 0;
currentAtom->cluster = NULL;
currentAtom->cluster = nullptr;
currentAtom->numNeighbors = 0;
currentAtom->setFlag(ATOM_IS_LOCAL_ATOM);
}
@ -332,11 +332,11 @@ protected:
*data++ = atom->x[i][2];
}
// Send local atom coordinates to master proc.
MPI_Send(buffer.empty() ? NULL : &buffer.front(), buffer.size(), MPI_DOUBLE, 0, 0, world);
MPI_Send(buffer.empty() ? nullptr : &buffer.front(), buffer.size(), MPI_DOUBLE, 0, 0, world);
}
// Make sure all input atoms are wrapped at periodic boundary conditions.
wrapInputAtoms(NULL_VECTOR);
wrapInputAtoms(nullptr_VECTOR);
// Build nearest neighbor lists.
buildNearestNeighborLists();
@ -376,7 +376,7 @@ protected:
}
}
// Broadcast segments.
MPI_Bcast(segmentBuffer.empty() ? NULL : &segmentBuffer.front(), segmentBuffer.size() * sizeof(segmentBuffer[0]), MPI_CHAR, 0, world);
MPI_Bcast(segmentBuffer.empty() ? nullptr : &segmentBuffer.front(), segmentBuffer.size() * sizeof(segmentBuffer[0]), MPI_CHAR, 0, world);
if(processor != 0) {
// Extract segments from receive buffer.
@ -402,7 +402,7 @@ protected:
DISLOCATIONS_ASSERT(sendItem == pointBuffer.end());
}
// Broadcast segments.
MPI_Bcast(pointBuffer.empty() ? NULL : &pointBuffer.front(), pointBuffer.size() * sizeof(pointBuffer[0]), MPI_CHAR, 0, world);
MPI_Bcast(pointBuffer.empty() ? nullptr : &pointBuffer.front(), pointBuffer.size() * sizeof(pointBuffer[0]), MPI_CHAR, 0, world);
if(processor != 0) {
// Extract points from receive buffer.

View File

@ -184,8 +184,8 @@ namespace ATC {
displacement_(atc_->field(DISPLACEMENT)),
nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)),
nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()),
nodalAtomicDisplacement_(NULL),
nodalAtomicForce_(NULL)
nodalAtomicDisplacement_(nullptr),
nodalAtomicForce_(nullptr)
{
// do nothing
}
@ -410,9 +410,9 @@ namespace ATC {
displacement_(atc_->field(DISPLACEMENT)),
nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)),
nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()),
nodalAtomicMomentum_(NULL),
nodalAtomicMomentum_(nullptr),
nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()),
nodalAtomicDisplacement_(NULL),
nodalAtomicDisplacement_(nullptr),
nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()),
nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd())
{
@ -633,7 +633,7 @@ namespace ATC {
FluidsTimeIntegratorGear::FluidsTimeIntegratorGear(MomentumTimeIntegrator * momentumTimeIntegrator) :
MomentumIntegrationMethod(momentumTimeIntegrator),
nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()),
nodalAtomicMomentum_(NULL),
nodalAtomicMomentum_(nullptr),
nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()),
atomicVelocityDelta_(atc_->num_nodes(),atc_->nsd()),
nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()),

View File

@ -17,7 +17,7 @@ namespace ATC {
class ElectronHeatFlux
{
public:
ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL);
ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
virtual ~ElectronHeatFlux() {};
/** computes heat flux */
virtual void electron_heat_flux(const FIELD_MATS &fields,
@ -68,7 +68,7 @@ namespace ATC {
{
public:
ElectronHeatFluxLinear(std::fstream &matfile,std::map<std::string,double> & parameters,
/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL);
/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
virtual ~ElectronHeatFluxLinear() {};
virtual void electron_heat_flux(const FIELD_MATS & /* fields */,
const GRAD_FIELD_MATS &gradFields,
@ -95,7 +95,7 @@ namespace ATC {
{
public:
ElectronHeatFluxPowerLaw(std::fstream &matfile,std::map<std::string,double> &parameters,
/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL);
/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
virtual ~ElectronHeatFluxPowerLaw() {};
virtual void electron_heat_flux(const FIELD_MATS &fields,
const GRAD_FIELD_MATS &gradFields,
@ -134,8 +134,8 @@ ctivity proportional to the ratio of the electron and phonon temperatures with t
public:
ElectronHeatFluxThermopower(std::fstream &matfile,
std::map<std::string,double> & parameters,
/*const*/ ElectronFlux * electronFlux = NULL,
/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL);
/*const*/ ElectronFlux * electronFlux = nullptr,
/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
virtual ~ElectronHeatFluxThermopower() {};
virtual void electron_heat_flux(const FIELD_MATS &fields,
const GRAD_FIELD_MATS &gradFields,

View File

@ -114,7 +114,7 @@ namespace ATC {
ATC::LammpsInterface::instance()->print_msg_once(ss.str());
myModel = new ExtrinsicModelElectrostatic
(this,modelType,matFileName);
} else myModel = NULL;
} else myModel = nullptr;
extrinsicModels_.push_back(myModel);
// add new fields to fields data
@ -157,7 +157,7 @@ namespace ATC {
for(imodel=extrinsicModels_.begin(); imodel!=extrinsicModels_.end(); imodel++) {
if ((*imodel)->model_type()==type) return *imodel;
}
return NULL;
return nullptr;
}
@ -343,7 +343,7 @@ namespace ATC {
atc_(modelManager->atc()),
modelManager_(modelManager),
modelType_(modelType),
physicsModel_(NULL)
physicsModel_(nullptr)
{
rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX);
rhsMaskIntrinsic_ = false;

View File

@ -38,17 +38,17 @@ namespace ATC {
ExtrinsicModelType modelType,
string matFileName) :
ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName),
continuityIntegrator_(NULL),
continuityIntegrator_(nullptr),
poissonSolverType_(DIRECT), // ITERATIVE | DIRECT
poissonSolver_(NULL),
poissonSolver_(nullptr),
baseSize_(0),
electronDensityEqn_(ELECTRON_CONTINUITY),
fluxUpdateFreq_(1),
schrodingerSolverType_(DIRECT), // ITERATIVE | DIRECT
schrodingerSolver_(NULL),
schrodingerSolver_(nullptr),
schrodingerPoissonMgr_(),
schrodingerPoissonSolver_(NULL),
schrodingerPoissonSolver_(nullptr),
maxConsistencyIter_(0), maxConstraintIter_(1),
safe_dEf_(0.1), Ef_shift_(0.0),
oneD_(false), oneDcoor_(0), oneDconserve_(0)
@ -351,7 +351,7 @@ namespace ATC {
ExtrinsicModelType modelType,
string matFileName) :
ExtrinsicModelDriftDiffusion(modelManager,modelType,matFileName),
cddmPoissonSolver_(NULL),
cddmPoissonSolver_(nullptr),
baseSize_(0)
{
// delete base class's version of the physics model

View File

@ -38,15 +38,15 @@ namespace ATC {
poissonSolverType_(DIRECT), // ITERATIVE | DIRECT
poissonSolverTol_(0),
poissonSolverMaxIter_(0),
poissonSolver_(NULL),
poissonSolver_(nullptr),
maxSolves_(0),
baseSize_(0),
chargeRegulator_(NULL),
chargeRegulator_(nullptr),
useSlab_(false),
includeShortRange_(true),
atomForces_(NULL),
nodalAtomicCharge_(NULL),
nodalAtomicGhostCharge_(NULL)
atomForces_(nullptr),
nodalAtomicCharge_(nullptr),
nodalAtomicGhostCharge_(nullptr)
{
physicsModel_ = new PhysicsModelSpeciesElectrostatic(matFileName);
// set up correct masks for coupling

View File

@ -26,7 +26,7 @@ namespace ATC {
string matFileName) :
ExtrinsicModel(modelManager,modelType,matFileName),
electronTimeIntegration_(TimeIntegrator::IMPLICIT),
temperatureIntegrator_(NULL),
temperatureIntegrator_(nullptr),
nsubcycle_(1),
exchangeFlag_(true),
baseSize_(0)
@ -164,7 +164,7 @@ namespace ATC {
rhsMask(ELECTRON_TEMPERATURE,i) = atc_->fieldMask_(ELECTRON_TEMPERATURE,i);
}
if (electronTimeIntegration_ == TimeIntegrator::NONE) {
temperatureIntegrator_ = NULL;
temperatureIntegrator_ = nullptr;
return;
}
if (temperatureIntegrator_) delete temperatureIntegrator_;

View File

@ -36,7 +36,7 @@ static const double localCoordinatesTolerance = 1.e-09;
tolerance_(localCoordinatesTolerance),
projectionGuess_(COORDINATE_ALIGNED)
{
feInterpolate_ = NULL;
feInterpolate_ = nullptr;
}
FE_Element::~FE_Element()

View File

@ -32,7 +32,7 @@ namespace ATC{
//-----------------------------------------------------------------
FE_Engine::FE_Engine(MPI_Comm comm)
: communicator_(comm),
feMesh_(NULL),
feMesh_(nullptr),
initialized_(false),
outputManager_()
{

View File

@ -90,7 +90,7 @@ namespace ATC {
/** write data: data is arrayed over _unique_ nodes
and then mapped by the engine */
void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=NULL);
void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=nullptr);
void write_data(double time, OUTPUT_LIST *data);
void write_restart_file(std::string fileName, RESTART_LIST *data)
@ -150,7 +150,7 @@ namespace ATC {
const PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
SPAR_MAT &tangent,
const DenseMatrix<bool> *elementMask=NULL) const;
const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute tangent matrix for a pair of fields - given quadrature */
void compute_tangent_matrix(const RHS_MASK &rhsMask,
@ -162,7 +162,7 @@ namespace ATC {
const SPAR_MAT &N,
const SPAR_MAT_VEC &dN,
SPAR_MAT &tangent,
const DenseMatrix<bool> *elementMask=NULL) const;
const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute a consistent mass matrix for a field */
void compute_mass_matrix(
@ -171,7 +171,7 @@ namespace ATC {
const PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
CON_MASS_MATS &mass_matrix,
const DenseMatrix<bool> *elementMask=NULL) const;
const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute a dimensionless mass matrix */
void compute_mass_matrix(SPAR_MAT &mass_matrix) const;
@ -191,7 +191,7 @@ namespace ATC {
const PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
MASS_MATS &mass_matrix,
const DenseMatrix<bool> *elementMask=NULL) const;
const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute dimensional lumped mass matrix using given quadrature */
void compute_lumped_mass_matrix(
@ -212,7 +212,7 @@ namespace ATC {
const PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
FIELD_MATS &energy,
const DenseMatrix<bool> *elementMask=NULL,
const DenseMatrix<bool> *elementMask=nullptr,
const IntegrationDomainType domain=FULL_DOMAIN) const;
/** compute residual or RHS of the dynamic weak eqn */
@ -223,7 +223,7 @@ namespace ATC {
const Array<int> &elementMaterials,
FIELDS &rhs,
bool freeOnly=false,
const DenseMatrix<bool> *elementMask=NULL) const;
const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute RHS for given quadrature */
void compute_rhs_vector(const RHS_MASK &rhsMask,
@ -251,7 +251,7 @@ namespace ATC {
const PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
GRAD_FIELD_MATS &flux,
const DenseMatrix<bool> *elementMask=NULL) const;
const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute the flux on the MD/FE boundary */
void compute_boundary_flux(const RHS_MASK &rhsMask,
@ -272,8 +272,8 @@ namespace ATC {
const SPAR_MAT_VEC &dN,
const DIAG_MAT &flux_mask,
FIELDS &rhs,
const DenseMatrix<bool> *elementMask=NULL,
const std::set<int> *nodeSet=NULL) const;
const DenseMatrix<bool> *elementMask=nullptr,
const std::set<int> *nodeSet=nullptr) const;
/** compute prescribed flux given an array of functions of x & t */
void add_fluxes(const Array<bool> &fieldMask,
@ -465,7 +465,7 @@ namespace ATC {
int nsd() const { return feMesh_->num_spatial_dimensions(); }
/** return if the FE mesh has been created */
int has_mesh() const { return feMesh_!=NULL; }
int has_mesh() const { return feMesh_!=nullptr; }
/** get nodal coordinates for a given element */
void element_coordinates(const int eltIdx, DENS_MAT &coords)

View File

@ -46,7 +46,7 @@ namespace ATC {
partitioned_(false),
nNodes_(0),
nNodesUnique_(0),
feElement_(NULL),
feElement_(nullptr),
twoDimensional_(false),
hasPlanarFaces_(false)
@ -1708,7 +1708,7 @@ namespace ATC {
const Array< pair< string, set<int> > > *nodeSets):
FE_Mesh(),
minEltSize_(0),
tree_(NULL)
tree_(nullptr)
{
// Pick which element class to make
if (elementType == "HEX8") {
@ -1774,7 +1774,7 @@ namespace ATC {
}
// Insert nodes and elements into KD-tree for PIE search.
if (tree_ == NULL) {
if (tree_ == nullptr) {
tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), nNodes_,
&nodalCoords_, nElts_, connectivity_);
}
@ -2107,7 +2107,7 @@ namespace ATC {
// use the KD tree for partitioning, getting more blocks than
// processors
if (tree_ == NULL) {
if (tree_ == nullptr) {
tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(),
nNodes_, &nodalCoords_,
nElts_, connectivity_);
@ -2519,7 +2519,7 @@ namespace ATC {
const double zscale)
: hx_(hx), hy_(hy), hz_(hz)
{
tree_ = NULL;
tree_ = nullptr;
hasPlanarFaces_ = true;
xscale_ = xscale;
yscale_ = yscale;
@ -2820,7 +2820,7 @@ namespace ATC {
const double zscale)
{
hasPlanarFaces_ = true;
tree_ = NULL;
tree_ = nullptr;
xscale_ = xscale;
yscale_ = yscale;
zscale_ = zscale;

View File

@ -112,7 +112,7 @@ FieldImplicitDirectEulerIntegrator::FieldImplicitDirectEulerIntegrator(
const Array2D< bool > & rhsMask, // copy
const double alpha
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask),
alpha_(alpha),solver_(NULL)
alpha_(alpha),solver_(nullptr)
{
rhsMask_(fieldName_,FLUX) = false; // handle laplacian term with stiffness
const BC_SET & bcs = (atc_->prescribed_data_manager()->bcs(fieldName_))[0];

View File

@ -271,7 +271,7 @@ typedef PerAtomQuantity<double> PAQ;
u = new AtfShapeFunctionMdProjection(atc_,restricted,VELOCITY);
}
else {
DENS_MAN * q = NULL;
DENS_MAN * q = nullptr;
if (atc_->kernel_on_the_fly()) {
if (atc_->kernel_based()) {
q = new OnTheFlyKernelAccumulationNormalized(atc_, atomic,

View File

@ -47,7 +47,7 @@ namespace ATC {
case SPECIES_FLUX: return species_flux(name);
case INTERNAL_ENERGY: return internal_energy(name);
case ENERGY: return energy(name);
default: throw ATC_Error("FieldManager:: unknown field"); return NULL;
default: throw ATC_Error("FieldManager:: unknown field"); return nullptr;
}
}
CanonicalName string_to_canonical_name(std::string name){
@ -83,11 +83,11 @@ namespace ATC {
case PROLONGED_VELOCITY:
return prolonged_field(VELOCITY);
default:
throw ATC_Error("FieldManager:: unknown PAQ"); return NULL;
throw ATC_Error("FieldManager:: unknown PAQ"); return nullptr;
}
}
/** this function returns a restriction of atomic data */
DENS_MAN * restricted_atom_quantity(FieldName field, std::string name = "default", PAQ * atomi = NULL);
DENS_MAN * restricted_atom_quantity(FieldName field, std::string name = "default", PAQ * atomi = nullptr);
protected:
ATC_Method * atc_;
InterscaleManager & interscaleManager_;
@ -120,10 +120,10 @@ namespace ATC {
PAQ * atomic_species_vector();
// internal functions
DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = NULL);
DENS_MAN * scaled_projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, double scale, DIAG_MAN * normalization = NULL);
DENS_MAN * referenced_projected_atom_quantity(FieldName field, std::string name, PAQ * atomic, DENS_MAN * reference, DIAG_MAN * normalization = NULL);
DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return NULL;};
DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = nullptr);
DENS_MAN * scaled_projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, double scale, DIAG_MAN * normalization = nullptr);
DENS_MAN * referenced_projected_atom_quantity(FieldName field, std::string name, PAQ * atomic, DENS_MAN * reference, DIAG_MAN * normalization = nullptr);
DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return nullptr;};
PAQ * prolonged_field(FieldName field);
private:
FieldManager(void);

View File

@ -26,13 +26,13 @@ namespace ATC {
//====================================================================
// UXT_Function_Mgr
//====================================================================
UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = NULL;
UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = nullptr;
// -----------------------------------------------------------------
// instance()
// -----------------------------------------------------------------
UXT_Function_Mgr * UXT_Function_Mgr::instance()
{
if (myInstance_ == NULL) {
if (myInstance_ == nullptr) {
myInstance_ = new UXT_Function_Mgr();
}
return myInstance_;
@ -90,7 +90,7 @@ namespace ATC {
{
string tag = other->tag();
UXT_Function * returnFunction = NULL;
UXT_Function * returnFunction = nullptr;
if (tag=="linear") {
ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other;
returnFunction = new ScalarLinearFunction(*other_cast);
@ -144,14 +144,14 @@ namespace ATC {
// XT_Function_Mgr
//--------------------------------------------------------------------
//--------------------------------------------------------------------
XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL;
XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// -----------------------------------------------------------------
// instance()
// -----------------------------------------------------------------
XT_Function_Mgr * XT_Function_Mgr::instance()
{
if (myInstance_ == NULL) {
if (myInstance_ == nullptr) {
myInstance_ = new XT_Function_Mgr();
}
return myInstance_;
@ -227,7 +227,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL;
{
string tag = other->tag();
XT_Function * returnFunction = NULL;
XT_Function * returnFunction = nullptr;
if (tag=="linear") {
LinearFunction * other_cast = (LinearFunction*) other;
returnFunction = new LinearFunction(*other_cast);

View File

@ -126,7 +126,7 @@ namespace ATC {
double unitsConversion,
AtomType atomType) :
ShallowAtomQuantity<double>(atc,0,atomType),
computePointer_(NULL),
computePointer_(nullptr),
computeTag_(tag),
unitsConversion_(unitsConversion)
{

View File

@ -131,11 +131,11 @@ namespace ATC {
/** gets appropriate pointer for lammps data */
virtual double * lammps_scalar() const
{return NULL;};
{return nullptr;};
/** gets appropriate pointer for lammps data */
virtual double ** lammps_vector() const
{return NULL;};
{return nullptr;};
private:

View File

@ -23,7 +23,7 @@ namespace ATC {
// Constructor
//--------------------------------------------------------
GhostManager::GhostManager(ATC_Method * atc) :
ghostModifier_(NULL),
ghostModifier_(nullptr),
atc_(atc),
boundaryDynamics_(NO_BOUNDARY_DYNAMICS),
needReset_(true)
@ -116,7 +116,7 @@ namespace ATC {
{
if (ghostModifier_) {
delete ghostModifier_;
ghostModifier_ = NULL;
ghostModifier_ = nullptr;
}
if (!atc_->groupbit_ghost()) {
@ -252,7 +252,7 @@ namespace ATC {
//--------------------------------------------------------
GhostModifier::GhostModifier(GhostManager * ghostManager) :
ghostManager_(ghostManager),
atomTimeIntegrator_(NULL),
atomTimeIntegrator_(nullptr),
integrateAtoms_(false)
{
// do nothing
@ -321,9 +321,9 @@ namespace ATC {
//--------------------------------------------------------
GhostModifierPrescribed::GhostModifierPrescribed(GhostManager * ghostManager) :
GhostModifier(ghostManager),
atomPositions_(NULL),
atomFeDisplacement_(NULL),
atomRefPositions_(NULL)
atomPositions_(nullptr),
atomFeDisplacement_(nullptr),
atomRefPositions_(nullptr)
{
// do nothing
}
@ -382,9 +382,9 @@ namespace ATC {
const vector<double> & gamma,
const vector<double> & mu) :
GhostModifierPrescribed(ghostManager),
atomVelocities_(NULL),
atomFeVelocity_(NULL),
atomForces_(NULL),
atomVelocities_(nullptr),
atomFeVelocity_(nullptr),
atomForces_(nullptr),
kappa_(kappa),
gamma_(gamma),
mu_(mu)
@ -486,8 +486,8 @@ namespace ATC {
const vector<double> & gamma,
const vector<double> & mu) :
GhostModifierDampedHarmonic(ghostManager,kappa,gamma,mu),
ghostToBoundaryDistance_(NULL),
layerId_(NULL)
ghostToBoundaryDistance_(nullptr),
layerId_(nullptr)
{
// do nothing
@ -731,8 +731,8 @@ namespace ATC {
GhostModifier(ghostManager),
lammpsInterface_(LammpsInterface::instance()),
elementSet_((((ghostManager_->atc())->fe_engine())->fe_mesh())->elementset((ghostManager_->atc())->internal_element_set())),
atomElement_(NULL),
atomGhostElement_(NULL),
atomElement_(nullptr),
atomGhostElement_(nullptr),
internalToAtom_((ghostManager_->atc())->internal_to_atom_map()),
ghostToAtom_((ghostManager_->atc())->ghost_to_atom_map()),
groupbit_((ghostManager_->atc())->groupbit()),

View File

@ -30,7 +30,7 @@ namespace ATC{
for (unsigned int i = 0; i < NUM_ATOM_TYPES; i++) {
fundamentalAtomQuantities_[i].resize(LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES);
for (unsigned int j = 0; j < LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES; j++)
fundamentalAtomQuantities_[i][j] = NULL;
fundamentalAtomQuantities_[i][j] = nullptr;
}
}
@ -126,7 +126,7 @@ namespace ATC{
if (fundamentalAtomQuantities_[i][j]) {
index = dfs_visit(fundamentalAtomQuantities_[i][j],index);
if ((fundamentalAtomQuantities_[i][j])->memory_type()==TEMPORARY) {
fundamentalAtomQuantities_[i][j] = NULL;
fundamentalAtomQuantities_[i][j] = nullptr;
}
}
}
@ -453,7 +453,7 @@ namespace ATC{
DependencyManager * InterscaleManager::find(const string & tag)
{
// REFACTOR add check for duplicate entries
DependencyManager * quantity = NULL;
DependencyManager * quantity = nullptr;
quantity = find_in_list(perAtomQuantities_,tag);
if (quantity) return quantity;
@ -482,7 +482,7 @@ namespace ATC{
quantity = find_in_list(smallMoleculeSets_,tag);
if (quantity) return quantity;
return NULL;
return nullptr;
}
//--------------------------------------------------------

View File

@ -277,7 +277,7 @@ namespace ATC {
data * return_quantity(std::map<std::string,data * > & list, const std::string & tag)
{
typename std::map<std::string,data * >::iterator it = list.find(tag);
if (it==list.end()) return NULL;
if (it==list.end()) return nullptr;
return it->second;
}
@ -310,7 +310,7 @@ namespace ATC {
{
typename std::map<std::string,data * >::iterator it = list.find(tag);
if (it!=list.end()) return it->second;
return NULL;
return nullptr;
}
/** helper function to force the reset of all data in a list */

View File

@ -83,17 +83,17 @@ KD_Tree::KD_Tree(vector<Node> *points, vector<Elem> *elements,
if (foundElemRight) rightElems->push_back(*elit);
}
// Create child tree, or NULL if there's nothing to create
// Create child tree, or nullptr if there's nothing to create
if (candElems_->size() - leftElems->size() < 4 || leftElems->size() == 0) {
leftChild_ = NULL;
leftChild_ = nullptr;
delete leftPts;
delete leftElems;
} else {
leftChild_ = new KD_Tree(leftPts, leftElems, (dimension+1) % 3);
}
// Create child tree, or NULL if there's nothing to create
// Create child tree, or nullptr if there's nothing to create
if (candElems_->size() - rightElems->size() < 4 || rightElems->size() == 0) {
rightChild_ = NULL;
rightChild_ = nullptr;
delete rightPts;
delete rightElems;
} else {
@ -109,7 +109,7 @@ vector<int> KD_Tree::find_nearest_elements(Node query, int dimension) {
// tree, either recurse to the left or return this node's elements
// if there is no left child.
if (query.lessThanInDimension(value_, dimension)) {
if (leftChild_ == NULL) {
if (leftChild_ == nullptr) {
vector<int> result = vector<int>();
for (vector<Elem>::iterator elem = candElems_->begin();
elem != candElems_->end(); elem++) {
@ -119,7 +119,7 @@ vector<int> KD_Tree::find_nearest_elements(Node query, int dimension) {
}
return leftChild_->find_nearest_elements(query, (dimension+1) % 3);
} else {
if (rightChild_ == NULL) {
if (rightChild_ == nullptr) {
vector<int> result = vector<int>();
for (vector<Elem>::iterator elem = candElems_->begin();
elem != candElems_->end(); elem++) {
@ -147,7 +147,7 @@ vector<vector<int> > KD_Tree::getElemIDs(int depth) {
sort(candElemIDs.begin(), candElemIDs.end());
result.push_back(candElemIDs);
} else if (leftChild_ == NULL || rightChild_ == NULL) {
} else if (leftChild_ == nullptr || rightChild_ == nullptr) {
// Insert all nodes at this level once,
// then insert a bunch of empty vectors.
temp = this->getElemIDs(0);

View File

@ -20,13 +20,13 @@ namespace ATC {
//========================================================================
// KernelFunctionMgr
//========================================================================
KernelFunctionMgr * KernelFunctionMgr::myInstance_ = NULL;
KernelFunctionMgr * KernelFunctionMgr::myInstance_ = nullptr;
//------------------------------------------------------------------------
// instance
//------------------------------------------------------------------------
KernelFunctionMgr * KernelFunctionMgr::instance()
{
if (myInstance_ == NULL) {
if (myInstance_ == nullptr) {
myInstance_ = new KernelFunctionMgr();
}
return myInstance_;
@ -65,7 +65,7 @@ namespace ATC {
No default
*/
int argIdx = 0;
KernelFunction * ptr = NULL;
KernelFunction * ptr = nullptr;
char* type = arg[argIdx++];
if (strcmp(type,"step")==0) {
double parameters[1] = {atof(arg[argIdx])}; // cutoff radius

View File

@ -151,7 +151,7 @@ namespace ATC {
VelocityRescaleCombined::VelocityRescaleCombined(AtomicRegulator * kinetostat) :
VelocityGlc(kinetostat),
velocity_(atc_->field(VELOCITY)),
thermostatCorrection_(NULL)
thermostatCorrection_(nullptr)
{
// do nothing
}
@ -188,7 +188,7 @@ namespace ATC {
//--------------------------------------------------------
ThermostatRescaleCombined::ThermostatRescaleCombined(AtomicRegulator * thermostat) :
ThermostatRescale(thermostat),
kinetostatCorrection_(NULL)
kinetostatCorrection_(nullptr)
{
// do nothing
}
@ -226,14 +226,14 @@ namespace ATC {
KinetoThermostatRescale::KinetoThermostatRescale(AtomicRegulator * kinetoThermostat,
int couplingMaxIterations) :
KinetoThermostatShapeFunction(kinetoThermostat,couplingMaxIterations),
atomVelocities_(NULL),
atomVelocities_(nullptr),
nodalVelocities_(atc_->field(VELOCITY)),
lambdaMomentum_(NULL),
lambdaEnergy_(NULL),
atomicFluctuatingVelocityRescaled_(NULL),
atomicStreamingVelocity_(NULL),
thermostat_(NULL),
kinetostat_(NULL)
lambdaMomentum_(nullptr),
lambdaEnergy_(nullptr),
atomicFluctuatingVelocityRescaled_(nullptr),
atomicStreamingVelocity_(nullptr),
thermostat_(nullptr),
kinetostat_(nullptr)
{
thermostat_ = this->construct_rescale_thermostat();
kinetostat_ = new VelocityRescaleCombined(kinetoThermostat);
@ -389,7 +389,7 @@ namespace ATC {
//--------------------------------------------------------
ThermostatRescaleMixedKePeCombined::ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat) :
ThermostatRescaleMixedKePe(thermostat),
kinetostatCorrection_(NULL)
kinetostatCorrection_(nullptr)
{
// do nothing
}
@ -458,21 +458,21 @@ namespace ATC {
velocity_(atc_->field(VELOCITY)),
temperature_(atc_->field(TEMPERATURE)),
timeFilter_(atomicRegulator_->time_filter()),
nodalAtomicLambdaForce_(NULL),
lambdaForceFiltered_(NULL),
nodalAtomicLambdaPower_(NULL),
lambdaPowerFiltered_(NULL),
atomRegulatorForces_(NULL),
atomThermostatForces_(NULL),
atomMasses_(NULL),
atomVelocities_(NULL),
nodalAtomicLambdaForce_(nullptr),
lambdaForceFiltered_(nullptr),
nodalAtomicLambdaPower_(nullptr),
lambdaPowerFiltered_(nullptr),
atomRegulatorForces_(nullptr),
atomThermostatForces_(nullptr),
atomMasses_(nullptr),
atomVelocities_(nullptr),
isFirstTimestep_(true),
nodalAtomicMomentum_(NULL),
nodalAtomicEnergy_(NULL),
atomPredictedVelocities_(NULL),
nodalAtomicPredictedMomentum_(NULL),
nodalAtomicPredictedEnergy_(NULL),
firstHalfAtomForces_(NULL),
nodalAtomicMomentum_(nullptr),
nodalAtomicEnergy_(nullptr),
atomPredictedVelocities_(nullptr),
nodalAtomicPredictedMomentum_(nullptr),
nodalAtomicPredictedEnergy_(nullptr),
firstHalfAtomForces_(nullptr),
dtFactor_(0.)
{
// construct/obtain data corresponding to stage 3 of ATC_Method::initialize

View File

@ -307,11 +307,11 @@ namespace ATC {
RegulatorShapeFunction(kinetostat,regulatorPrefix),
mdMassMatrix_(atc_->set_mass_mat_md(VELOCITY)),
timeFilter_(atomicRegulator_->time_filter()),
nodalAtomicLambdaForce_(NULL),
lambdaForceFiltered_(NULL),
atomKinetostatForce_(NULL),
atomVelocities_(NULL),
atomMasses_(NULL)
nodalAtomicLambdaForce_(nullptr),
lambdaForceFiltered_(nullptr),
atomKinetostatForce_(nullptr),
atomVelocities_(nullptr),
atomMasses_(nullptr)
{
// data associated with stage 3 in ATC_Method::initialize
lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaMomentum",nsd_);
@ -376,7 +376,7 @@ namespace ATC {
//--------------------------------------------------------
GlcKinetostat::GlcKinetostat(AtomicRegulator *kinetostat) :
KinetostatShapeFunction(kinetostat),
atomPositions_(NULL)
atomPositions_(nullptr)
{
// do nothing
}
@ -462,7 +462,7 @@ namespace ATC {
//--------------------------------------------------------
DisplacementGlc::DisplacementGlc(AtomicRegulator * kinetostat) :
GlcKinetostat(kinetostat),
nodalAtomicMassWeightedDisplacement_(NULL),
nodalAtomicMassWeightedDisplacement_(nullptr),
nodalDisplacements_(atc_->field(DISPLACEMENT))
{
// do nothing
@ -763,7 +763,7 @@ namespace ATC {
//--------------------------------------------------------
VelocityGlc::VelocityGlc(AtomicRegulator * kinetostat) :
GlcKinetostat(kinetostat),
nodalAtomicMomentum_(NULL),
nodalAtomicMomentum_(nullptr),
nodalVelocities_(atc_->field(VELOCITY))
{
// do nothing
@ -1095,8 +1095,8 @@ namespace ATC {
StressFlux::StressFlux(AtomicRegulator * kinetostat) :
GlcKinetostat(kinetostat),
nodalForce_(atc_->field_rhs(VELOCITY)),
nodalAtomicForce_(NULL),
nodalGhostForce_(NULL),
nodalAtomicForce_(nullptr),
nodalGhostForce_(nullptr),
momentumSource_(atc_->atomic_source(VELOCITY))
{
// flag for performing boundary flux calculation
@ -1540,14 +1540,14 @@ namespace ATC {
KinetostatShapeFunction(kinetostat,regulatorPrefix),
velocity_(atc_->field(VELOCITY)),
//timeFilter_(atomicRegulator_->time_filter()),
//nodalAtomicLambdaForce_(NULL),
//lambdaPowerFiltered_(NULL),
//atomKinetostatForces_(NULL),
//atomMasses_(NULL),
nodalAtomicMomentum_(NULL),
//nodalAtomicLambdaForce_(nullptr),
//lambdaPowerFiltered_(nullptr),
//atomKinetostatForces_(nullptr),
//atomMasses_(nullptr),
nodalAtomicMomentum_(nullptr),
isFirstTimestep_(true),
atomPredictedVelocities_(NULL),
nodalAtomicPredictedMomentum_(NULL),
atomPredictedVelocities_(nullptr),
nodalAtomicPredictedMomentum_(nullptr),
dtFactor_(0.)
{
// constuct/obtain data corresponding to stage 3 of ATC_Method::initialize
@ -1796,8 +1796,8 @@ namespace ATC {
const string & regulatorPrefix) :
KinetostatGlcFs(kinetostat,regulatorPrefix),
momentumSource_(atc_->atomic_source(VELOCITY)),
nodalGhostForce_(NULL),
nodalGhostForceFiltered_(NULL)
nodalGhostForce_(nullptr),
nodalGhostForceFiltered_(nullptr)
{
// flag for performing boundary flux calculation
fieldMask_(VELOCITY,FLUX) = true;
@ -2403,9 +2403,9 @@ namespace ATC {
KinetostatFluxFixed::KinetostatFluxFixed(AtomicRegulator * kinetostat,
bool constructKinetostats) :
RegulatorMethod(kinetostat),
kinetostatFlux_(NULL),
kinetostatFixed_(NULL),
kinetostatBcs_(NULL)
kinetostatFlux_(nullptr),
kinetostatFixed_(nullptr),
kinetostatBcs_(nullptr)
{
if (constructKinetostats) {
if (kinetostat->coupling_mode(VELOCITY) == AtomicRegulator::GHOST_FLUX) {

View File

@ -58,14 +58,14 @@ const static int MAX_GROUP_BIT = 2147483647; //4294967295; // pow(2,31)-1;
double norm(double * v) {return sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]); }
LammpsInterface * LammpsInterface::myInstance_ = NULL;
LammpsInterface * LammpsInterface::myInstance_ = nullptr;
// -----------------------------------------------------------------
// instance()
// -----------------------------------------------------------------
LammpsInterface * LammpsInterface::instance()
{
if (myInstance_ == NULL) {
if (myInstance_ == nullptr) {
myInstance_ = new LammpsInterface();
}
return myInstance_;
@ -77,7 +77,7 @@ LammpsInterface * LammpsInterface::instance()
void LammpsInterface::Destroy()
{
if (myInstance_) delete myInstance_;
myInstance_ = NULL;
myInstance_ = nullptr;
}
@ -85,13 +85,13 @@ void LammpsInterface::Destroy()
// constructor
// -----------------------------------------------------------------
LammpsInterface::LammpsInterface()
: lammps_(NULL),
fixPointer_(NULL),
: lammps_(nullptr),
fixPointer_(nullptr),
commRank_(0),
atomPE_(NULL),
atomPE_(nullptr),
refBoxIsSet_(false),
random_(NULL),
globalrandom_(NULL)
random_(nullptr),
globalrandom_(nullptr)
{
}
@ -225,7 +225,7 @@ void LammpsInterface::sparse_allsum(SparseMatrix<double> &toShare) const
std::string LammpsInterface::read_file(std::string filename) const
{
FILE *fp = NULL;
FILE *fp = nullptr;
if (! comm_rank()) {
fp = fopen(filename.c_str(),"r");
if (!fp) throw ATC_Error("can't open file: "+filename);
@ -343,7 +343,7 @@ double * LammpsInterface::atom_scalar(FundamentalAtomQuantity quantityType) cons
}
else
throw ATC_Error("BAD type requested in atom_scalar");
return NULL;
return nullptr;
}
double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) const
@ -356,7 +356,7 @@ double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) con
return fatom();
else
throw ATC_Error("BAD type requested in atom_vector");
return NULL;
return nullptr;
}
int LammpsInterface::atom_quantity_ndof(FundamentalAtomQuantity quantityType) const
@ -948,10 +948,10 @@ POTENTIAL LammpsInterface::potential() const
"lj/cut/coul/long",
"lj/cut/coul/cut",
"lj/charmm/coul/long"};
LAMMPS_NS::Pair *pair = NULL;
LAMMPS_NS::Pair *pair = nullptr;
for (int i = 0; i < nStyles; i++){
pair = lammps_->force->pair_match(pairStyles[i].c_str(),1);
if (pair != NULL) break;
if (pair != nullptr) break;
}
return pair;
}
@ -979,8 +979,8 @@ bool LammpsInterface::epsilons(int itype, POTENTIAL pair, double * epsilon0) con
int dim = 2; // a return value for extract
double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) );
delete [] pair_parameter;
if (epsilons == NULL) return false;
//if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported");
if (epsilons == nullptr) return false;
//if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported");
int i1,i2;
for (int i=1; i < ntypes()+1; i++) {
if (i < itype) { i1 = i; i2 = itype; }
@ -998,8 +998,8 @@ bool LammpsInterface::set_epsilons(int itype, POTENTIAL pair, double * epsilon)
int dim = 2; // a return value for extract
double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) );
delete [] pair_parameter;
if (epsilons == NULL) return false;
//if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported");
if (epsilons == nullptr) return false;
//if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported");
// scale interactions
int i1,i2;
for (int i = 1; i < ntypes()+1; i++) {
@ -1498,7 +1498,7 @@ double * LammpsInterface::compute_pe_peratom(void) const
return atomPE_->vector_atom;
}
else {
return NULL;
return nullptr;
}
}
@ -1542,7 +1542,7 @@ LAMMPS_NS::PairEAM* LammpsInterface::pair_eam() const
// return lammps_->force->pair;
//}
LAMMPS_NS::PairEAM* pair_eam = dynamic_cast<LAMMPS_NS::PairEAM*> (lammps_->force->pair);
if (pair_eam != NULL) {
if (pair_eam != nullptr) {
return pair_eam;
}
else {

View File

@ -534,7 +534,7 @@ class LammpsInterface {
/** Dulong-Petit heat capacity per volume in M,L,T,t units */
double heat_capacity(void) const;
/** mass per volume in reference configuraturation in M,L units */
double mass_density(int* numPerType=NULL) const;
double mass_density(int* numPerType=nullptr) const;
/** permittivity of free space, converts from LAMMPS potential units implied by the electric field units to LAMMPS charge units/LAMMPS length units (e.g., V to elemental charge/A) */
double epsilon0(void) const;
double coulomb_constant(void) const;

View File

@ -35,9 +35,9 @@ LinearSolver::LinearSolver(
allowReinitialization_(false),
homogeneousBCs_(false),
bcs_(&bcs),
rhs_(NULL),
rhs_(nullptr),
rhsDense_(),
b_(NULL),
b_(nullptr),
matrix_(A),
matrixDense_(),
matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(),
@ -65,9 +65,9 @@ LinearSolver::LinearSolver(
matrixModified_(false),
allowReinitialization_(false),
homogeneousBCs_(false),
bcs_(NULL), // null implies no constraints will be added later
rhs_(NULL),
rhsDense_(), b_(NULL),
bcs_(nullptr), // null implies no constraints will be added later
rhs_(nullptr),
rhsDense_(), b_(nullptr),
matrix_(A),
matrixDense_(),
matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(),
@ -343,7 +343,7 @@ void LinearSolver::set_fixed_values(VECTOR & X)
void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, const DENS_MAT * M) /* const */
{
initialize_matrix(); // no inverse needed
const DENS_MAT * Kp = NULL;
const DENS_MAT * Kp = nullptr;
const DENS_MAT * Mp =M;
DENS_MAT MM;
DENS_MAT KM;
@ -388,7 +388,7 @@ void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors
bool LinearSolver::solve(VECTOR & x, const VECTOR & b)
{
SPAR_MAT * A = NULL;
SPAR_MAT * A = nullptr;
rhs_ = &b;
initialized_ = false;
@ -479,7 +479,7 @@ bool LinearSolver::solve(VECTOR & x, const VECTOR & b)
void LinearSolver::greens_function(int I, VECTOR & G_I)
{
SPAR_MAT * A = NULL;
SPAR_MAT * A = nullptr;

View File

@ -64,7 +64,7 @@ class LinearSolver {
allow_reinitialization must be called before first solve, etc */
void allow_reinitialization(void); // depending on method save a copy of A
void set_homogeneous_bcs(void) { homogeneousBCs_ = true;} // for nonlinear solver, solve for increment
void initialize(const BC_SET * bcs = NULL);
void initialize(const BC_SET * bcs = nullptr);
/** solve
- solves A x = b
@ -80,7 +80,7 @@ class LinearSolver {
- returns the e-values & e-vectors for constrained system Ax + v x = 0
- if M is provided the eval problem : ( A + v M ) x = 0 is solved*/
void eigen_system(DENS_MAT & eigenvalues, DENS_MAT & eigenvectors,
const DENS_MAT * M = NULL);
const DENS_MAT * M = nullptr);
/** access to penalty coefficient
- if a penalty method is not being used this returns zero */

View File

@ -28,21 +28,21 @@ namespace ATC {
Material::Material()
: rhoCp_(0),
heatCapacity_(0),
electronHeatCapacity_(NULL),
electronHeatCapacity_(nullptr),
massDensity_(0),
heatConductivity_(0),
electronHeatFlux_(NULL),
stress_(NULL),
viscousStress_(NULL),
bodyForce_(NULL),
electronPhononExchange_(NULL),
electronDragPower_(NULL),
electronFlux_(NULL),
electronHeatFlux_(nullptr),
stress_(nullptr),
viscousStress_(nullptr),
bodyForce_(nullptr),
electronPhononExchange_(nullptr),
electronDragPower_(nullptr),
electronFlux_(nullptr),
permittivity_(1.),
invEffectiveMass_(1.),
electronEquilibriumDensity_(0),
electronRecombinationInvTau_(0),
electronChargeDensity_(NULL)
electronChargeDensity_(nullptr)
{
}
//--------------------------------------------------------------
@ -70,21 +70,21 @@ namespace ATC {
: tag_(tag),
rhoCp_(0),
heatCapacity_(0),
electronHeatCapacity_(NULL),
electronHeatCapacity_(nullptr),
massDensity_(0),
heatConductivity_(0),
electronHeatFlux_(NULL),
stress_(NULL),
viscousStress_(NULL),
bodyForce_(NULL),
electronPhononExchange_(NULL),
electronDragPower_(NULL),
electronFlux_(NULL),
electronHeatFlux_(nullptr),
stress_(nullptr),
viscousStress_(nullptr),
bodyForce_(nullptr),
electronPhononExchange_(nullptr),
electronDragPower_(nullptr),
electronFlux_(nullptr),
permittivity_(1.),
invEffectiveMass_(1.),
electronEquilibriumDensity_(0),
electronRecombinationInvTau_(0),
electronChargeDensity_(NULL)
electronChargeDensity_(nullptr)
{
/*! \page man_material material
\section syntax

View File

@ -33,7 +33,7 @@ namespace ATC {
virtual void clear();
/** initialize global data */
virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = NULL);
virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = nullptr);
/** reset the number of atoms/molecules on this processor */
void reset_nlocal() {this->set_reset();};
@ -108,8 +108,8 @@ namespace ATC {
public:
SmallMoleculeSet(ATC_Method * atc, int groupBit,
PerAtomQuantity<int> * bondList = NULL,
PerAtomQuantity<int> * numBond = NULL);
PerAtomQuantity<int> * bondList = nullptr,
PerAtomQuantity<int> * numBond = nullptr);
virtual ~SmallMoleculeSet();
@ -117,7 +117,7 @@ namespace ATC {
virtual void clear();
/** initialize global data */
virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = NULL);
virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = nullptr);
/** access molecule atoms by lammps id */
std::set<int> atoms_by_global_molecule(int id) const;

View File

@ -43,7 +43,7 @@ class NonLinearSolver {
/** Constructor */
NonLinearSolver(
TangentOperator * f, // provides f and f' at x, pointer for polymorphism
const BC_SET * bcs = NULL,
const BC_SET * bcs = nullptr,
const int dof = 0,
bool parallel = false
);

View File

@ -48,8 +48,8 @@ OutputManager::OutputManager(string outputPrefix, set<int> & otypes)
firstStep_(true),
firstGlobalsWrite_(true),
writeGlobalsHeader_(true),
coordinates_(NULL),
connectivities_(NULL),
coordinates_(nullptr),
connectivities_(nullptr),
dataType_(POINT),
outputPrefix_(outputPrefix),
ensightOutput_(otypes.count(ENSIGHT)),
@ -68,8 +68,8 @@ OutputManager::OutputManager()
firstStep_(true),
firstGlobalsWrite_(true),
writeGlobalsHeader_(true),
coordinates_(NULL),
connectivities_(NULL),
coordinates_(nullptr),
connectivities_(nullptr),
dataType_(POINT),
outputPrefix_("NULL"),
ensightOutput_(true),
@ -132,7 +132,7 @@ void OutputManager::print_custom_names() {
// Dump text-based fields to disk for later restart
void OutputManager::write_restart_file(string fileName, RESTART_LIST *data)
{
FILE * fp=NULL;
FILE * fp=nullptr;
fp=fopen(fileName.c_str(),"wb"); // open
RESTART_LIST::iterator iter;
for (iter = data->begin(); iter != data->end(); iter++) {
@ -153,7 +153,7 @@ void OutputManager::write_restart_file(string fileName, RESTART_LIST *data)
void OutputManager::read_restart_file(string fileName, RESTART_LIST *data)
{
FILE * fp=NULL;
FILE * fp=nullptr;
fp=fopen(fileName.c_str(),"rb"); // open
RESTART_LIST::iterator iter;
for (iter = data->begin(); iter != data->end(); iter++) {
@ -230,7 +230,7 @@ void OutputManager::write_geometry_ensight(void)
string geom_file_name = outputPrefix_ + ".geo";
// open file
FILE * fp=NULL;
FILE * fp=nullptr;
char buffer[80];
if ( ! initialized_ ) {
fp=fopen(geom_file_name.c_str(),"wb"); // open
@ -240,7 +240,7 @@ void OutputManager::write_geometry_ensight(void)
else {
fp=fopen(geom_file_name.c_str(),"ab"); // append
}
if (fp == NULL) {
if (fp == nullptr) {
throw ATC_Error("can not create Ensight geometry file");
}
@ -491,14 +491,14 @@ void OutputManager::write_data_ensight(string field_name, const MATRIX *field_da
// open or append data file
string data_file_name = filenames[ifile];
FILE * fp=NULL;
FILE * fp=nullptr;
if ( outputTimes_.size() == 1 ) {
fp=fopen(data_file_name.c_str(),"wb"); // open
}
else {
fp=fopen(data_file_name.c_str(),"ab"); // append
}
if (fp == NULL) {
if (fp == nullptr) {
throw ATC_Error("can not create Ensight data file: "+data_file_name);
}
@ -799,8 +799,8 @@ void OutputManager::write_dictionary(double /* time */, OUTPUT_LIST *data)
string geom_file_name = outputPrefix_ + ".geo";
// open file
FILE * fp=NULL;
if ((fp=fopen(dict_file_name.c_str(),"w")) == NULL)
FILE * fp=nullptr;
if ((fp=fopen(dict_file_name.c_str(),"w")) == nullptr)
{
throw ATC_Error("can not create Ensight case file");
}

View File

@ -52,13 +52,13 @@ namespace ATC {
coordinates : num _total_ points/nodes X num spatial dim
connectivities : num elements X num nodes per element*/
void write_geometry(const MATRIX *coordinates,
const Array2D<int> *connectivity=NULL);
const Array2D<int> *connectivity=nullptr);
/** write data from a time step
specify node_map to handle periodic soln & data */
void write_data(double time, OUTPUT_LIST *data, const int *node_map=NULL);
void write_data(double time, OUTPUT_LIST *data, const int *node_map=nullptr);
void write_data(double time, FIELDS *soln, OUTPUT_LIST *data,
const int *node_map=NULL);
const int *node_map=nullptr);
/** add custom names for any field */
void add_field_names(const std::string& name, const std::vector<std::string>& list) {

View File

@ -18,7 +18,7 @@ namespace ATC {
AtomType atomType) :
atc_(atc),
atomType_(atomType),
myNlocal(NULL)
myNlocal(nullptr)
{
switch (atomType_) {
case ALL:

View File

@ -148,7 +148,7 @@ namespace ATC_matrix {
#endif
// Clear out the local matrix's pointer so we don't double-free
A_local._data = NULL;
A_local._data = nullptr;
delete [] majorCounts;
delete [] offsets;

View File

@ -233,8 +233,8 @@ DenseMatrix<double> ParSparseMatrix<double>::transMat(
SparseMatrix<double> C_local = ((SparseMatrix<double>)A_local) * B;
// destroy newA intelligently
A_local._val = NULL;
A_local._ja = NULL;
A_local._val = nullptr;
A_local._ja = nullptr;
// Add all the result vectors together on each processor.
sumSparse(C_local, C);
@ -285,8 +285,8 @@ void ParSparseMatrix<double>::partition(
// Prepare an A_local matrix for deletion after it has been loaded with
// data members from another matrix.
void ParSparseMatrix<double>::finalize() {
_val = NULL;
_ja = NULL;
_val = nullptr;
_ja = nullptr;
}
void ParSparseMatrix<double>::operator=(const SparseMatrix<double> &source)

View File

@ -135,9 +135,9 @@ namespace ATC_matrix {
Avar.hasTemplate_ = Ap.hasTemplate_;
// Avoid catastrophe
Ap._val = NULL;
Ap._ja = NULL;
Ap._ia = NULL;
Ap._val = nullptr;
Ap._ja = nullptr;
Ap._ia = nullptr;
}

View File

@ -24,8 +24,8 @@ namespace ATC {
atomType_(atomType),
nCols_(nCols),
quantityToLammps_(atc_.atc_to_lammps_map()),
lammpsScalar_(NULL),
lammpsVector_(NULL)
lammpsScalar_(nullptr),
lammpsVector_(nullptr)
{
// do nothing
}
@ -452,7 +452,7 @@ namespace ATC {
lammpsInterface_(LammpsInterface::instance()),
atomType_(atomType),
quantityToLammps_(atc_.atc_to_lammps_map()),
lammpsScalar_(NULL)
lammpsScalar_(nullptr)
{
// do nothing
}
@ -610,8 +610,8 @@ namespace ATC {
nCols_(nCols),
maxEntriesPerRow_(maxEntriesPerRow),
quantityToLammps_(atc_.atc_to_lammps_map()),
lammpsVector_(NULL),
lammpsColIndices_(NULL)
lammpsVector_(nullptr),
lammpsColIndices_(nullptr)
{
// do nothing
}

View File

@ -441,10 +441,10 @@ namespace ATC {
virtual void set_lammps_to_quantity() const {};
/** gets appropriate pointer for lammps data */
virtual T * lammps_scalar() const {return NULL;};
virtual T * lammps_scalar() const {return nullptr;};
/** gets appropriate pointer for lammps data */
virtual T ** lammps_vector() const {return NULL;};
virtual T ** lammps_vector() const {return nullptr;};
private:
@ -1452,10 +1452,10 @@ namespace ATC {
virtual void set_quantity_to_lammps() const {};
/** gets appropriate data for lammps pointer */
virtual T ** lammps_vector() const {return NULL;};
virtual T ** lammps_vector() const {return nullptr;};
/** gets appropriate data for lammps pointer to column indices */
virtual int ** lammps_column_indices() const {return NULL;};
virtual int ** lammps_column_indices() const {return nullptr;};
private:

View File

@ -125,7 +125,7 @@ namespace ATC {
// constructor
AtomToElementMap(ATC_Method * atc,
PerAtomQuantity<double> * atomPositions = NULL,
PerAtomQuantity<double> * atomPositions = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -304,7 +304,7 @@ namespace ATC {
// constructor
AtomVolumeElement(ATC_Method * atc,
PerAtomQuantity<int> * atomElement = NULL,
PerAtomQuantity<int> * atomElement = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -349,7 +349,7 @@ namespace ATC {
// constructor
AtomVolumeRegion(ATC_Method * atc,
DENS_MAN * atomCoarseGrainingPositions = NULL,
DENS_MAN * atomCoarseGrainingPositions = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -422,9 +422,9 @@ namespace ATC {
// constructor
AtomicMassWeightedDisplacement(ATC_Method * atc,
PerAtomQuantity<double> * atomPositions = NULL,
PerAtomQuantity<double> * atomMasses = NULL,
PerAtomQuantity<double> * atomReferencePositions = NULL,
PerAtomQuantity<double> * atomPositions = nullptr,
PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomReferencePositions = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -462,8 +462,8 @@ namespace ATC {
// constructor
FluctuatingVelocity(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomMeanVelocities = NULL,
PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMeanVelocities = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -497,8 +497,8 @@ namespace ATC {
// constructor
ChargeVelocity(ATC_Method * atc,
PerAtomQuantity<double> * fluctuatingVelocities = NULL,
FundamentalAtomQuantity * atomCharges = NULL,
PerAtomQuantity<double> * fluctuatingVelocities = nullptr,
FundamentalAtomQuantity * atomCharges = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -532,8 +532,8 @@ namespace ATC {
// constructor
SpeciesVelocity(ATC_Method * atc,
PerAtomQuantity<double> * fluctuatingVelocities = NULL,
PerAtomQuantity<double> * atomTypeVector = NULL,
PerAtomQuantity<double> * fluctuatingVelocities = nullptr,
PerAtomQuantity<double> * atomTypeVector = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -567,8 +567,8 @@ namespace ATC {
// constructor
AtomicMomentum(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomMasses = NULL,
PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -631,8 +631,8 @@ namespace ATC {
// constructor
TwiceKineticEnergy(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomMasses = NULL,
PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -670,8 +670,8 @@ namespace ATC {
// constructor
KineticTensor(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomMasses = NULL,
PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -707,9 +707,9 @@ namespace ATC {
// constructor
FluctuatingKineticTensor(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomMasses = NULL,
PerAtomQuantity<double> * atomMeanVelocities = NULL,
PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomMeanVelocities = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -747,9 +747,9 @@ namespace ATC {
// constructor
TwiceFluctuatingKineticEnergy(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomMasses = NULL,
PerAtomQuantity<double> * atomMeanVelocities = NULL,
PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomMeanVelocities = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -793,8 +793,8 @@ namespace ATC {
MixedKePeEnergy(ATC_Method * atc,
double keMultiplier,
double peMultiplier,
PerAtomQuantity<double> * twiceKineticEnergy = NULL,
PerAtomQuantity<double> * potentialEnergy = NULL,
PerAtomQuantity<double> * twiceKineticEnergy = nullptr,
PerAtomQuantity<double> * potentialEnergy = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -838,8 +838,8 @@ namespace ATC {
// constructor
TotalEnergy(ATC_Method * atc,
PerAtomQuantity<double> * twiceKineticEnergy = NULL,
PerAtomQuantity<double> * potentialEnergy = NULL,
PerAtomQuantity<double> * twiceKineticEnergy = nullptr,
PerAtomQuantity<double> * potentialEnergy = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -871,8 +871,8 @@ namespace ATC {
// constructor
FluctuatingPotentialEnergy(ATC_Method * atc,
PerAtomQuantity<double> * potentialEnergy = NULL,
PerAtomQuantity<double> * referencePotential = NULL,
PerAtomQuantity<double> * potentialEnergy = nullptr,
PerAtomQuantity<double> * referencePotential = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -911,8 +911,8 @@ namespace ATC {
// constructor
DotTwiceKineticEnergy(ATC_Method * atc,
PerAtomQuantity<double> * atomForces = NULL,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomForces = nullptr,
PerAtomQuantity<double> * atomVelocities = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -948,7 +948,7 @@ namespace ATC {
// constructor
VelocitySquared(ATC_Method *atc,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomVelocities = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -981,9 +981,9 @@ namespace ATC {
// constructor
LambdaSquared(ATC_Method *atc,
PerAtomQuantity<double> * atomMasses = NULL,
PerAtomQuantity<double> * atomVelocitiesSquared = NULL,
PerAtomQuantity<double> * atomLambdas = NULL,
PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomVelocitiesSquared = nullptr,
PerAtomQuantity<double> * atomLambdas = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1149,7 +1149,7 @@ namespace ATC {
// constructor
AtomToNodeset(ATC_Method * atc,
SetDependencyManager<int> * subsetNodes,
PerAtomQuantity<int> * atomElement = NULL,
PerAtomQuantity<int> * atomElement = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1194,7 +1194,7 @@ namespace ATC {
// constructor
AtomToElementset(ATC_Method * atc,
MatrixDependencyManager<DenseMatrix, bool> * elementMask,
PerAtomQuantity<int> * atomElement = NULL,
PerAtomQuantity<int> * atomElement = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1273,7 +1273,7 @@ namespace ATC {
// constructor
VelocitySquaredMapped(ATC_Method *atc,
MatrixDependencyManager<DenseMatrix, int> * atomMap,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomVelocities = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1307,9 +1307,9 @@ namespace ATC {
// constructor
LambdaSquaredMapped(ATC_Method *atc,
MatrixDependencyManager<DenseMatrix, int> * atomMap,
PerAtomQuantity<double> * atomMasses = NULL,
PerAtomQuantity<double> * atomVelocitiesSquared = NULL,
PerAtomQuantity<double> * atomLambdas = NULL,
PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomVelocitiesSquared = nullptr,
PerAtomQuantity<double> * atomLambdas = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1371,7 +1371,7 @@ namespace ATC {
// constructor
AtomicVelocityRescaleFactor(ATC_Method * atc,
PerAtomQuantity<double> * atomLambdas = NULL,
PerAtomQuantity<double> * atomLambdas = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1403,8 +1403,8 @@ namespace ATC {
// constructor
AtomicFluctuatingVelocityRescaled(ATC_Method * atc,
PerAtomQuantity<double> * atomRescaleFactor = NULL,
PerAtomQuantity<double> * atomFluctuatingVelocity = NULL,
PerAtomQuantity<double> * atomRescaleFactor = nullptr,
PerAtomQuantity<double> * atomFluctuatingVelocity = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1439,10 +1439,10 @@ namespace ATC {
// constructor
AtomicCombinedRescaleThermostatError(ATC_Method * atc,
PerAtomQuantity<double> * atomFluctuatingMomentumRescaled = NULL,
PerAtomQuantity<double> * atomMeanVelocity = NULL,
PerAtomQuantity<double> * atomStreamingVelocity = NULL,
PerAtomQuantity<double> * atomMass = NULL,
PerAtomQuantity<double> * atomFluctuatingMomentumRescaled = nullptr,
PerAtomQuantity<double> * atomMeanVelocity = nullptr,
PerAtomQuantity<double> * atomStreamingVelocity = nullptr,
PerAtomQuantity<double> * atomMass = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1483,8 +1483,8 @@ namespace ATC {
// constructor
AtomicThermostatForce(ATC_Method * atc,
PerAtomQuantity<double> * atomLambdas = NULL,
PerAtomQuantity<double> * atomVelocities = NULL,
PerAtomQuantity<double> * atomLambdas = nullptr,
PerAtomQuantity<double> * atomVelocities = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1519,8 +1519,8 @@ namespace ATC {
// constructor
AtomicKinetostatForceDisplacement(ATC_Method * atc,
PerAtomQuantity<double> * atomLambda = NULL,
PerAtomQuantity<double> * atomMass = NULL,
PerAtomQuantity<double> * atomLambda = nullptr,
PerAtomQuantity<double> * atomMass = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1558,8 +1558,8 @@ namespace ATC {
// constructor
AtomicKinetostatForceVelocity(ATC_Method * atc,
PerAtomQuantity<double> * atomLambda = NULL,
PerAtomQuantity<double> * atomMass = NULL,
PerAtomQuantity<double> * atomLambda = nullptr,
PerAtomQuantity<double> * atomMass = nullptr,
AtomType atomType = INTERNAL) :
AtomicKinetostatForceDisplacement(atc,atomLambda,atomMass,atomType) {};
@ -1589,7 +1589,7 @@ namespace ATC {
// constructor
AtomicKinetostatForceStress(ATC_Method * atc,
PerAtomQuantity<double> * atomLambda = NULL,
PerAtomQuantity<double> * atomLambda = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1621,7 +1621,7 @@ namespace ATC {
// constructor
PerAtomKernelFunction(ATC_Method * atc,
PerAtomQuantity<double> * atomPositions = NULL,
PerAtomQuantity<double> * atomPositions = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1656,8 +1656,8 @@ namespace ATC {
// constructor
PerAtomShapeFunction(ATC_Method * atc,
PerAtomQuantity<double> * atomPositions = NULL,
PerAtomQuantity<int> * atomElements = NULL,
PerAtomQuantity<double> * atomPositions = nullptr,
PerAtomQuantity<int> * atomElements = nullptr,
AtomType atomType = INTERNAL);
// destructor
@ -1695,8 +1695,8 @@ namespace ATC {
// constructor
LambdaCouplingMatrix(ATC_Method * atc,
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = NULL,
SPAR_MAN * shapeFunction = NULL);
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = nullptr,
SPAR_MAN * shapeFunction = nullptr);
// destructor
virtual ~LambdaCouplingMatrix() {
@ -1734,9 +1734,9 @@ namespace ATC {
// constructor
LocalLambdaCouplingMatrix(ATC_Method * atc,
MatrixDependencyManager<DenseMatrix, int> * lambdaAtomMap = NULL,
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = NULL,
SPAR_MAN * shapeFunction = NULL);
MatrixDependencyManager<DenseMatrix, int> * lambdaAtomMap = nullptr,
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = nullptr,
SPAR_MAN * shapeFunction = nullptr);
// destructor
virtual ~LocalLambdaCouplingMatrix() {
@ -1771,7 +1771,7 @@ namespace ATC {
GhostCouplingMatrix(ATC_Method * atc,
SPAR_MAN * shapeFunction,
SetDependencyManager<int> * subsetNodes,
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = NULL);
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = nullptr);
// destructor
virtual ~GhostCouplingMatrix() {

View File

@ -272,7 +272,7 @@ BondMatrixKernel::BondMatrixKernel(LammpsInterface * lammpsInterface,
BondMatrix(lammpsInterface,pairMap,x,feMesh),
kernelFunction_(kernelFunction)
{
if (kernelFunction_ == NULL)
if (kernelFunction_ == nullptr)
throw ATC_Error("No AtC kernel function initialized");
};
void BondMatrixKernel::reset(void) const

View File

@ -105,7 +105,7 @@ namespace ATC
const WeakEquation * weak_equation(FieldName field) const
{
std::map<FieldName,WeakEquation *>::const_iterator itr = weakEqns_.find(field);
if (itr == weakEqns_.end()) return NULL;
if (itr == weakEqns_.end()) return nullptr;
return (weakEqns_.find(field))->second;
}

View File

@ -33,9 +33,9 @@ PoissonSolver::PoissonSolver(
fieldName_(fieldName),
rhsMask_(rhsMask),
linear_(false),
solver_(NULL),
solverNL_(NULL),
tangent_(NULL),
solver_(nullptr),
solverNL_(nullptr),
tangent_(nullptr),
solverType_(solverType),
solverTol_(0),
solverMaxIter_(0),

View File

@ -34,8 +34,8 @@ namespace ATC {
bcs_[thisField].reset(nNodes_,thisSize);
for (int inode = 0; inode < nNodes_ ; ++inode) {
for (int idof = 0; idof < thisSize ; ++idof) {
ics_[thisField](inode,idof) = NULL;
bcs_[thisField](inode,idof) = NULL;
ics_[thisField](inode,idof) = nullptr;
bcs_[thisField](inode,idof) = nullptr;
}
}
// compact inode, value lists
@ -44,7 +44,7 @@ namespace ATC {
elementSources_[thisField].reset(nElems_,thisSize);
for (int ielem = 0; ielem < nElems_ ; ++ielem) {
for (int idof = 0; idof < thisSize ; ++idof) {
elementSources_[thisField](ielem,idof) = NULL;
elementSources_[thisField](ielem,idof) = nullptr;
}
}
// node based sources
@ -76,8 +76,8 @@ namespace ATC {
bcs_[fieldName].reset(nNodes_,size);
for (int inode = 0; inode < nNodes_ ; ++inode) {
for (int idof = 0; idof < size ; ++idof) {
ics_[fieldName](inode,idof) = NULL;
bcs_[fieldName](inode,idof) = NULL;
ics_[fieldName](inode,idof) = nullptr;
bcs_[fieldName](inode,idof) = nullptr;
}
}
@ -85,7 +85,7 @@ namespace ATC {
elementSources_[fieldName].reset(nElems_,size);
for (int ielem = 0; ielem < nElems_ ; ++ielem) {
for (int idof = 0; idof < size ; ++idof) {
elementSources_[fieldName](ielem,idof) = NULL;
elementSources_[fieldName](ielem,idof) = nullptr;
}
}
}
@ -159,7 +159,7 @@ namespace ATC {
set<int>::const_iterator iset;
for (iset = nodeSet.begin(); iset != nodeSet.end(); iset++) {
int inode = *iset;
bcs_[thisField](inode,thisIndex) = NULL;
bcs_[thisField](inode,thisIndex) = nullptr;
}
}
@ -182,7 +182,7 @@ namespace ATC {
const FieldName thisField,
const int thisIndex)
{
bcs_[thisField](nodeId,thisIndex) = NULL;
bcs_[thisField](nodeId,thisIndex) = nullptr;
}
//-------------------------------------------------------------------------
// fix_flux
@ -203,7 +203,7 @@ namespace ATC {
if (dof.size() == 0) {
int ndof = (fieldSizes_.find(thisField))->second;
dof.reset(ndof);
for(int i = 0; i < ndof; i++) dof(i) = NULL;
for(int i = 0; i < ndof; i++) dof(i) = nullptr;
}
dof(thisIndex) = (XT_Function*) f;
}
@ -222,7 +222,7 @@ namespace ATC {
for (iset = fset->begin(); iset != fset->end(); iset++) {
pair<int,int> face = *iset;
Array < XT_Function * > & dof = faceSources_[thisField][face];
dof(thisIndex) = NULL;
dof(thisIndex) = nullptr;
}
}
//-------------------------------------------------------------------------
@ -244,7 +244,7 @@ namespace ATC {
if (dof.size() == 0) {
int ndof = (fieldSizes_.find(thisField))->second;
dof.reset(ndof);
for(int i = 0; i < ndof; i++) dof(i) = NULL;
for(int i = 0; i < ndof; i++) dof(i) = nullptr;
}
dof(thisIndex) = (UXT_Function*) f;
}
@ -263,7 +263,7 @@ namespace ATC {
for (iset = fset->begin(); iset != fset->end(); iset++) {
pair<int,int> face = *iset;
Array < UXT_Function * > & dof = faceSourcesRobin_[thisField][face];
dof(thisIndex) = NULL;
dof(thisIndex) = nullptr;
}
}
//-------------------------------------------------------------------------
@ -342,7 +342,7 @@ namespace ATC {
set<int>::const_iterator iset;
for (iset = elemSet.begin(); iset != elemSet.end(); iset++) {
int ielem = *iset;
elementSources_[thisField](ielem,thisIndex) = NULL;
elementSources_[thisField](ielem,thisIndex) = nullptr;
}
}
//-------------------------------------------------------------------------

View File

@ -5,14 +5,14 @@
using namespace std;
namespace ATC {
Quadrature * Quadrature::myInstance_ = NULL;
Quadrature * Quadrature::myInstance_ = nullptr;
// -----------------------------------------------------------------
// instance()
// -----------------------------------------------------------------
Quadrature * Quadrature::instance()
{
if (myInstance_ == NULL) {
if (myInstance_ == nullptr) {
myInstance_ = new Quadrature();
}
return myInstance_;
@ -24,7 +24,7 @@ Quadrature * Quadrature::instance()
void Quadrature::Destroy()
{
if (myInstance_) delete myInstance_;
myInstance_ = NULL;
myInstance_ = nullptr;
}

View File

@ -646,7 +646,7 @@ double fermi_dirac(const double E, const double T)
double mu, double D
) :
SliceSchrodingerPoissonSolver(atc,schrodingerSolver,poissonSolver,physicsModel,maxConsistencyIter,maxConstraintIter,oneDconserve,0,0),
solver_(NULL),
solver_(nullptr),
mobility_(mu),diffusivity_(D)
{
Ef0_ = Ef0;

View File

@ -17,14 +17,14 @@ TRI_COORD<T>::TRI_COORD(INDEX row, INDEX col, T val, bool add_to)
//-----------------------------------------------------------------------------
template<typename T>
SparseMatrix<T>::SparseMatrix(INDEX rows, INDEX cols)
: _val(NULL), _ia(NULL), _ja(NULL), _size(0), _nRowsCRS(0), hasTemplate_(false),
: _val(nullptr), _ia(nullptr), _ja(nullptr), _size(0), _nRowsCRS(0), hasTemplate_(false),
_nRows(rows),_nCols(cols) {}
//-----------------------------------------------------------------------------
// copy constructor
//-----------------------------------------------------------------------------
template<typename T>
SparseMatrix<T>::SparseMatrix(const SparseMatrix<T>& C)
: Matrix<T>(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false)
: Matrix<T>(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false)
{
_copy(C);
}
@ -33,7 +33,7 @@ SparseMatrix<T>::SparseMatrix(const SparseMatrix<T>& C)
//-----------------------------------------------------------------------------
template<typename T>
SparseMatrix<T>::SparseMatrix(const DenseMatrix<T>& C)
: Matrix<T>(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false)
: Matrix<T>(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false)
{
reset(C);
}
@ -67,9 +67,9 @@ void SparseMatrix<T>::_create(INDEX size, INDEX nrows)
// assign memory to hold matrix
try
{
_val = (_size && nrows) ? new T [_size] : NULL;
_ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : NULL;
_ja = (_size && nrows) ? new INDEX [_size] : NULL;
_val = (_size && nrows) ? new T [_size] : nullptr;
_ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : nullptr;
_ja = (_size && nrows) ? new INDEX [_size] : nullptr;
}
catch (std::exception &e)
{
@ -94,8 +94,8 @@ void SparseMatrix<T>::_delete()
if (_ia) delete [] _ia;
if (_ja) delete [] _ja;
_size = _nRowsCRS = 0;
_val = NULL;
_ia = _ja = NULL;
_val = nullptr;
_ia = _ja = nullptr;
}
//-----------------------------------------------------------------------------
// full memory copy of C into this

View File

@ -88,7 +88,7 @@ protected:
//@{
SparseVector(const Matrix<T> &c);
SparseVector<T>& operator=(Matrix<T> &c);
T* ptr() const {return NULL; }
T* ptr() const {return nullptr; }
//@}
STORE data_; //*> sparse data structure

View File

@ -108,9 +108,9 @@ namespace ATC {
timeFilter_(speciesTimeIntegrator->time_filter()),
massDensity_(atc_->field(MASS_DENSITY)),
nodalAtomicMassDensityOut_(atc_->nodal_atomic_field(MASS_DENSITY)),
nodalAtomicMassDensity_(NULL),
nodalAtomicMassDensity_(nullptr),
speciesConcentration_(atc_->field(SPECIES_CONCENTRATION)),
nodalAtomicSpeciesConcentration_(NULL),
nodalAtomicSpeciesConcentration_(nullptr),
nodalAtomicSpeciesConcentrationFiltered_(speciesTimeIntegrator->nodal_atomic_species_concentration_filtered()),
moleculeIds_(moleculeIds)
{

View File

@ -71,7 +71,7 @@ namespace ATC {
const std::map<std::string,std::pair<MolSize,int> > & moleculeIds);
// destructor
virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=NULL;};
virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=nullptr;};
/** create and get necessary transfer operators */
virtual void construct_transfers();

View File

@ -299,10 +299,10 @@ void StressCubicElasticDamped::stress(const FIELD_MATS &fields,
// cauchy born model
//==============================================================================
StressCauchyBorn::StressCauchyBorn(fstream &fileId, CbData &cb)
: cblattice_(NULL),
potential_(NULL),
: cblattice_(nullptr),
potential_(nullptr),
makeLinear_(false),
cubicMat_(NULL),
cubicMat_(nullptr),
initialized_(false),
fixed_temperature_(0.),
cbdata_(cb)

View File

@ -149,7 +149,7 @@ namespace ATC {
DENS_VEC elasticity_tensor(const VECTOR &Fv, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const;
DENS_VEC elasticity_tensor(const MATRIX &F, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const;
protected:
void linearize(MATRIX *F=NULL);
void linearize(MATRIX *F=nullptr);
CBLattice *cblattice_; //*> CbLattice -> makes atom clusters.
CbPotential *potential_; //*> CbPotential -> interatomic forces.
bool makeLinear_;

View File

@ -150,7 +150,7 @@ namespace ATC {
temperatureRoc_(atc_->field_roc(TEMPERATURE)),
temperature2Roc_(atc_->field_2roc(TEMPERATURE)),
nodalAtomicTemperatureOut_(atc_->nodal_atomic_field(TEMPERATURE)),
nodalAtomicTemperature_(NULL),
nodalAtomicTemperature_(nullptr),
temperatureRhs_(atc_->field_rhs(TEMPERATURE)),
nodalAtomicPowerOut_(atc_->nodal_atomic_field_roc(TEMPERATURE))
{
@ -384,7 +384,7 @@ namespace ATC {
nodalAtomicEnergyFiltered_(thermalTimeIntegrator->nodal_atomic_energy_filtered()),
nodalAtomicPowerFiltered_(thermalTimeIntegrator->nodal_atomic_power_filtered()),
atomicTemperatureDelta_(atc_->num_nodes(),1),
nodalAtomicEnergy_(NULL),
nodalAtomicEnergy_(nullptr),
nodalAtomicEnergyOld_(atc_->num_nodes(),1),
nodalAtomicTemperatureOld_(atc_->num_nodes(),1)
{

View File

@ -367,7 +367,7 @@ namespace ATC {
const string & regulatorPrefix) :
RegulatorShapeFunction(thermostat,regulatorPrefix),
mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)),
atomVelocities_(NULL)
atomVelocities_(nullptr)
{
fieldMask_(TEMPERATURE,FLUX) = true;
lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaEnergy",1); // data associated with stage 3 in ATC_Method::initialize
@ -425,7 +425,7 @@ namespace ATC {
ThermostatRescale::ThermostatRescale(AtomicRegulator * thermostat) :
ThermostatShapeFunction(thermostat),
nodalTemperature_(atc_->field(TEMPERATURE)),
atomVelocityRescalings_(NULL)
atomVelocityRescalings_(nullptr)
{
// do nothing
}
@ -535,7 +535,7 @@ namespace ATC {
//--------------------------------------------------------
ThermostatRescaleMixedKePe::ThermostatRescaleMixedKePe(AtomicRegulator * thermostat) :
ThermostatRescale(thermostat),
nodalAtomicFluctuatingPotentialEnergy_(NULL)
nodalAtomicFluctuatingPotentialEnergy_(nullptr)
{
// do nothing
}
@ -607,7 +607,7 @@ namespace ATC {
const string & regulatorPrefix) :
RegulatorShapeFunction(thermostat,regulatorPrefix),
lambdaMaxIterations_(lambdaMaxIterations),
rhsLambdaSquared_(NULL),
rhsLambdaSquared_(nullptr),
dtFactor_(1.)
{
fieldMask_(TEMPERATURE,FLUX) = true;
@ -741,21 +741,21 @@ namespace ATC {
int /* lambdaMaxIterations */,
const string & regulatorPrefix) :
RegulatorMethod(thermostat,regulatorPrefix),
lambdaSolver_(NULL),
lambdaSolver_(nullptr),
mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)),
atomVelocities_(NULL),
atomVelocities_(nullptr),
temperature_(atc_->field(TEMPERATURE)),
timeFilter_(atomicRegulator_->time_filter()),
nodalAtomicLambdaPower_(NULL),
lambdaPowerFiltered_(NULL),
atomLambdas_(NULL),
atomThermostatForces_(NULL),
atomMasses_(NULL),
nodalAtomicLambdaPower_(nullptr),
lambdaPowerFiltered_(nullptr),
atomLambdas_(nullptr),
atomThermostatForces_(nullptr),
atomMasses_(nullptr),
isFirstTimestep_(true),
nodalAtomicEnergy_(NULL),
atomPredictedVelocities_(NULL),
nodalAtomicPredictedEnergy_(NULL),
firstHalfAtomForces_(NULL)
nodalAtomicEnergy_(nullptr),
atomPredictedVelocities_(nullptr),
nodalAtomicPredictedEnergy_(nullptr),
firstHalfAtomForces_(nullptr)
{
// construct/obtain data corresponding to stage 3 of ATC_Method::initialize
nodalAtomicLambdaPower_ = thermostat->regulator_data(regulatorPrefix_+"NodalAtomicLambdaPower",1);
@ -1389,7 +1389,7 @@ namespace ATC {
int lambdaMaxIterations,
const string & regulatorPrefix) :
ThermostatGlcFs(thermostat,lambdaMaxIterations,regulatorPrefix),
atomThermostatForcesPredVel_(NULL),
atomThermostatForcesPredVel_(nullptr),
filterCoefficient_(1.)
{
lambdaSolver_ = new ThermostatSolverFixed(thermostat,
@ -1887,9 +1887,9 @@ namespace ATC {
int lambdaMaxIterations,
bool constructThermostats) :
RegulatorMethod(thermostat),
thermostatFlux_(NULL),
thermostatFixed_(NULL),
thermostatBcs_(NULL)
thermostatFlux_(nullptr),
thermostatFixed_(nullptr),
thermostatBcs_(nullptr)
{
if (constructThermostats) {
thermostatFlux_ = new ThermostatIntegratorFlux(thermostat,lambdaMaxIterations,regulatorPrefix_+"Flux");
@ -2022,10 +2022,10 @@ namespace ATC {
ThermostatGlc::ThermostatGlc(AtomicRegulator * thermostat) :
ThermostatShapeFunction(thermostat),
timeFilter_(atomicRegulator_->time_filter()),
lambdaPowerFiltered_(NULL),
atomThermostatForces_(NULL),
lambdaPowerFiltered_(nullptr),
atomThermostatForces_(nullptr),
prescribedDataMgr_(atc_->prescribed_data_manager()),
atomMasses_(NULL)
atomMasses_(nullptr)
{
// consistent with stage 3 of ATC_Method::initialize
lambdaPowerFiltered_= atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaPowerFiltered",1);
@ -2080,8 +2080,8 @@ namespace ATC {
ThermostatGlc(thermostat),
nodalTemperatureRoc_(atc_->field_roc(TEMPERATURE)),
heatSource_(atc_->atomic_source(TEMPERATURE)),
nodalAtomicPower_(NULL),
nodalAtomicLambdaPower_(NULL)
nodalAtomicPower_(nullptr),
nodalAtomicLambdaPower_(nullptr)
{
// do nothing
}
@ -2287,8 +2287,8 @@ namespace ATC {
//--------------------------------------------------------
ThermostatHooverVerlet::ThermostatHooverVerlet(AtomicRegulator * thermostat) :
ThermostatPowerVerlet(thermostat),
lambdaHoover_(NULL),
nodalAtomicHooverLambdaPower_(NULL)
lambdaHoover_(nullptr),
nodalAtomicHooverLambdaPower_(nullptr)
{
// set up data consistent with stage 3 of ATC_Method::initialize
lambdaHoover_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaHoover",1);
@ -2505,8 +2505,8 @@ namespace ATC {
//--------------------------------------------------------
ThermostatHooverVerletFiltered::ThermostatHooverVerletFiltered(AtomicRegulator * thermostat) :
ThermostatPowerVerletFiltered(thermostat),
lambdaHoover_(NULL),
nodalAtomicHooverLambdaPower_(NULL)
lambdaHoover_(nullptr),
nodalAtomicHooverLambdaPower_(nullptr)
{
// consistent with stage 3 of ATC_Method::initialize
lambdaHoover_ = atomicRegulator_->regulator_data("LambdaHoover",1);

View File

@ -210,7 +210,7 @@ namespace ATC {
}
else if (filterType_ == STEP_FILTER) {
newTimeFilter = new TimeFilterStep(*this);
} else newTimeFilter = NULL;
} else newTimeFilter = nullptr;
}
else { // default to return base class
newTimeFilter = new TimeFilter(*this);

View File

@ -17,10 +17,10 @@ namespace ATC {
AtomTimeIntegratorType::AtomTimeIntegratorType(ATC_Method * atc, AtomType atomType) :
atc_(atc),
atomType_(atomType),
mass_(NULL),
position_(NULL),
velocity_(NULL),
force_(NULL)
mass_(nullptr),
position_(nullptr),
velocity_(nullptr),
force_(nullptr)
{
// do nothing
}
@ -90,9 +90,9 @@ namespace ATC {
//--------------------------------------------------------
TimeIntegrator::TimeIntegrator(ATC_Coupling * atc,
TimeIntegrationType timeIntegrationType) :
timeIntegrationMethod_(NULL),
timeIntegrationMethod_(nullptr),
atc_(atc),
timeFilter_(NULL),
timeFilter_(nullptr),
timeFilterManager_(atc_->time_filter_manager()),
timeIntegrationType_(timeIntegrationType),
needReset_(true)

View File

@ -816,7 +816,7 @@ namespace ATC {
for (unsigned i = 0; i < quantity_.size(); ++i) {
if (quantity_[i]) delete quantity_[i];
}
quantity_.resize(source.size(),NULL);
quantity_.resize(source.size(),nullptr);
for (unsigned i = 0; i < source.size(); i++) {
quantity_[i] = new SPAR_MAT(map_->size(),source[i]->nCols());
}
@ -1363,7 +1363,7 @@ namespace ATC {
{
pointToElementMap_->register_dependence(this);
pointPositions_->register_dependence(this);
quantity_.resize(atc->nsd(),NULL);
quantity_.resize(atc->nsd(),nullptr);
for (int i = 0; i < atc->nsd(); ++i) {
quantity_[i] = new SPAR_MAT();
}
@ -1428,7 +1428,7 @@ namespace ATC {
atomPositions_->register_dependence(this);
// storage container
matrices_.resize(atc->nsd(),NULL);
matrices_.resize(atc->nsd(),nullptr);
for (int i = 0; i < atc->nsd(); ++i) {
matrices_[i] = new AtcAtomSparseMatrix<double>(atc,feEngine_->num_nodes(),
feEngine_->num_nodes_per_element(),
@ -1440,7 +1440,7 @@ namespace ATC {
matrices_[i]->register_dependence(this);
}
quantity_.resize(atc->nsd(),NULL);
quantity_.resize(atc->nsd(),nullptr);
}
//--------------------------------------------------------
@ -1926,7 +1926,7 @@ namespace ATC {
VectorTransfer<SPAR_MAT * >(),
feEngine_(atc->fe_engine())
{
quantity_.resize(atc->nsd(),NULL);
quantity_.resize(atc->nsd(),nullptr);
for (int i = 0; i < atc->nsd(); ++i) {
quantity_[i] = new SPAR_MAT();
}

View File

@ -115,7 +115,7 @@ namespace ATC {
// constructor
NodalAtomVolumeElement(ATC_Method * atc, SPAR_MAN * shapeFunction,
PerAtomQuantity<int> * atomElement=NULL);
PerAtomQuantity<int> * atomElement=nullptr);
// destructor
virtual ~NodalAtomVolumeElement() {
@ -173,7 +173,7 @@ namespace ATC {
// constructor
AtomTypeElement(ATC_Coupling * atc,
PerAtomQuantity<int> * atomElement = NULL);
PerAtomQuantity<int> * atomElement = nullptr);
// destructor
virtual ~AtomTypeElement() {
@ -211,8 +211,8 @@ namespace ATC {
// constructor
ElementMask(ATC_Coupling * atc,
MatrixDependencyManager<DenseMatrix, int> * hasInternal = NULL,
MatrixDependencyManager<DenseMatrix, int> * hasGhost = NULL);
MatrixDependencyManager<DenseMatrix, int> * hasInternal = nullptr,
MatrixDependencyManager<DenseMatrix, int> * hasGhost = nullptr);
// destructor
virtual ~ElementMask() {
@ -251,7 +251,7 @@ namespace ATC {
// constructor
AtomElementMask(ATC_Coupling * atc,
MatrixDependencyManager<DenseMatrix, int> * hasAtoms = NULL);
MatrixDependencyManager<DenseMatrix, int> * hasAtoms = nullptr);
// destructor
virtual ~AtomElementMask() {
@ -287,8 +287,8 @@ namespace ATC {
// constructor
NodalGeometryType(ATC_Coupling * atc,
MatrixDependencyManager<DenseMatrix, int> * hasInternal = NULL,
MatrixDependencyManager<DenseMatrix, int> * hasGhost = NULL);
MatrixDependencyManager<DenseMatrix, int> * hasInternal = nullptr,
MatrixDependencyManager<DenseMatrix, int> * hasGhost = nullptr);
// destructor
virtual ~NodalGeometryType() {
@ -338,7 +338,7 @@ namespace ATC {
// constructor
NodalGeometryTypeElementSet(ATC_Coupling * atc,
MatrixDependencyManager<DenseMatrix, int> * hasInternal = NULL);
MatrixDependencyManager<DenseMatrix, int> * hasInternal = nullptr);
// destructor
virtual ~NodalGeometryTypeElementSet() {
@ -659,7 +659,7 @@ namespace ATC {
// constructor
RegulatedNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL);
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr);
// destructor
virtual ~RegulatedNodes() {
@ -721,7 +721,7 @@ namespace ATC {
// constructor
FluxNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) :
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
RegulatedNodes(atc,fieldName,nodalGeometryType) {};
// destructor
@ -751,7 +751,7 @@ namespace ATC {
// constructor
BoundaryNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) :
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
RegulatedNodes(atc,fieldName,nodalGeometryType) {};
// destructor
@ -781,7 +781,7 @@ namespace ATC {
// constructor
FluxBoundaryNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) :
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
FluxNodes(atc,fieldName,nodalGeometryType) {};
// destructor
@ -811,7 +811,7 @@ namespace ATC {
// constructor
AllRegulatedNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) :
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
FluxBoundaryNodes(atc,fieldName,nodalGeometryType) {};
// destructor
@ -841,7 +841,7 @@ namespace ATC {
// constructor
FixedNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) :
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
RegulatedNodes(atc,fieldName,nodalGeometryType) {};
// destructor
@ -871,7 +871,7 @@ namespace ATC {
// constructor
FixedBoundaryNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) :
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
FixedNodes(atc,fieldName,nodalGeometryType) {};
// destructor
@ -1052,8 +1052,8 @@ namespace ATC {
// constructor
PerAtomShapeFunctionGradient(ATC_Method * atc,
MatrixDependencyManager<DenseMatrix, int>* atomToElementMap = NULL,
DENS_MAN* atomPositions = NULL,
MatrixDependencyManager<DenseMatrix, int>* atomToElementMap = nullptr,
DENS_MAN* atomPositions = nullptr,
const std::string & tag = "AtomicShapeFunctionGradient",
AtomType atomType = INTERNAL);

View File

@ -542,7 +542,7 @@ namespace ATC {
AtfProjection(ATC_Method * atc,
PerAtomQuantity<double> * source,
SPAR_MAN * accumulant,
DIAG_MAN * weights = NULL);
DIAG_MAN * weights = nullptr);
// destructor
virtual ~AtfProjection();
@ -587,7 +587,7 @@ namespace ATC {
PerAtomQuantity<double> * source,
SPAR_MAN * accumulant,
const double scale,
DIAG_MAN * weights = NULL);
DIAG_MAN * weights = nullptr);
// destructor
virtual ~AtfProjectionScaled();
@ -620,7 +620,7 @@ namespace ATC {
PerAtomQuantity<double> * source,
SPAR_MAN * accumulant,
DENS_MAN * reference,
DIAG_MAN * weights = NULL);
DIAG_MAN * weights = nullptr);
// destructor
virtual ~AtfProjectionReferenced();

View File

@ -226,7 +226,7 @@ namespace ATC_Utility
{
char *endptr;
strtod(s.c_str(), &endptr);
if(endptr != NULL && *endptr == '\0') return true;
if(endptr != nullptr && *endptr == '\0') return true;
return false;
}

View File

@ -129,7 +129,7 @@ public:
message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1,
int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0)
:descriptor(descriptor_),prev(NULL),next(NULL){
:descriptor(descriptor_),prev(nullptr),next(nullptr){
set_throw(throw_exceptions);
set_levels(out_level,stop_level);
extra_levels(0,0);
@ -157,8 +157,8 @@ public:
return -1;
glogp=prev;
if(glogp)
glogp->next=NULL;
prev=NULL;
glogp->next=nullptr;
prev=nullptr;
}
return 1;
}
@ -244,7 +244,7 @@ public:
FILE *out=stdout, FILE *err=stderr,
int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL,
int use_globally=0)
: message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){
: message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){
set_out(out);
set_err(err);
}

View File

@ -146,7 +146,7 @@ public:
public:
iterator(const iterator &other):ptr(other.ptr),incr(other.incr){
}
iterator():ptr(NULL),incr(0){}
iterator():ptr(nullptr),incr(0){}
iterator &operator++(){ // prefix
ptr+=incr;
return *this;
@ -173,13 +173,13 @@ public:
size_t sizex, sizey;
//e default constructor
recmatrix(): parr(NULL,1) {
recmatrix(): parr(nullptr,1) {
sizey=sizex=0;
arr=NULL;
arr=nullptr;
}
//e copy constructor: makes a managed copy
recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){
recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){
*this=other;
}
@ -222,7 +222,7 @@ public:
virtual int init(size_t nx, size_t ny, int smanaged=-1){
int managed=parr.managed();
if(managed && (sizex!=nx || sizey!=ny)){
parr.reset(NULL,0);
parr.reset(nullptr,0);
}
if(smanaged>=0){ // for changing the managed flag?
parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 );
@ -355,7 +355,7 @@ public:
public:
iterator(const iterator &other):ptr(other.ptr),incr(other.incr){
}
iterator():ptr(NULL),incr(0){}
iterator():ptr(nullptr),incr(0){}
iterator &operator++(){ // prefix
ptr+=incr;
return *this;
@ -382,13 +382,13 @@ public:
size_t size;
//e default constructor
sqmatrix(): parr(NULL,1) {
sqmatrix(): parr(nullptr,1) {
size=0;
arr=NULL;
arr=nullptr;
}
//e copy constructor: makes a managed copy
sqmatrix(const sqmatrix &other):size(0),arr(NULL){
sqmatrix(const sqmatrix &other):size(0),arr(nullptr){
*this=other;
}
@ -430,7 +430,7 @@ public:
virtual int init(size_t n, int smanaged=-1){
int managed=parr.managed();
if(managed && size!=n){
parr.reset(NULL,0);
parr.reset(nullptr,0);
}
if(smanaged>=0){ // for changing the managed flag?
parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 );
@ -600,9 +600,9 @@ class PairHash{
public:
//e find the value with indexes i, j
//e @return 0 if not found, 1 otherwise
//e if retval is not NULL, puts the found value there
virtual int Find(long i, long j, T *retval=NULL)=0;
virtual int Find(long i, long j, T **retval=NULL)=0;
//e if retval is not a null pointer, puts the found value there
virtual int Find(long i, long j, T *retval=nullptr)=0;
virtual int Find(long i, long j, T **retval=nullptr)=0;
virtual int Del(long i, long j)=0;
virtual int Put(long i, long j, const T *value)=0;
virtual int Put(long i, long j, const T& value)=0;
@ -621,7 +621,7 @@ public:
indm.Set(-1);
arr= new T[n*(n+1)/2];
}
int Find(long i, long j, T *retval=NULL){
int Find(long i, long j, T *retval=nullptr){
long ind=indm(i,j);
if(ind>=0){
if(retval){

View File

@ -158,7 +158,7 @@ public:
using base_t::second;
using base_t::first;
mngptr(T* ptr=NULL, int managed=0): pair<T*,int>(ptr,managed){
mngptr(T* ptr=nullptr, int managed=0): pair<T*,int>(ptr,managed){
//if(managed==2)ptr= new T(*ptr);
}
mngptr(const mngarg<T> &arg): pair<T*,int>(arg.first,arg.second){}
@ -166,7 +166,7 @@ public:
reset(arg.first,arg.second);
return *this;
}
void reset(T* ptr=NULL, int managed=0){
void reset(T* ptr=nullptr, int managed=0){
if(second && first && first!=ptr){
if(second&0x8)delete [] first;
else delete first;
@ -313,7 +313,7 @@ template<class T, class delete_t=delete_ptr<T> >
class shptr{
template<class Y, class Z> friend class shptr;
T *p;
int *num; //if num==NULL than p is not managed (as in mngptr)
int *num; //if num==nullptr than p is not managed (as in mngptr)
void set(T *p_, int managed){
p=p_;
@ -321,7 +321,7 @@ class shptr{
num=new int;
*num=1;
}
else num=NULL;
else num=nullptr;
}
template<class Y>
void set(const Y &other){
@ -330,7 +330,7 @@ class shptr{
num=other.num;
if(num)(*num)++;
}
else num=NULL;
else num=nullptr;
}
void set(const shptr &other){
p=other.p;
@ -338,11 +338,11 @@ class shptr{
num=other.num;
if(num)(*num)++;
}
else num=NULL;
else num=nullptr;
}
public:
shptr(T* p=NULL, int managed=1){
shptr(T* p=nullptr, int managed=1){
set(p,managed);
}
shptr(const mngarg<T> &arg){
@ -398,14 +398,14 @@ public:
delete_t()(p);
delete num;
}
num=NULL;
num=nullptr;
}
p=NULL;
p=nullptr;
}
}
bool valid() const {
return p!=NULL;
return p!=nullptr;
}
T* ptr() const {

View File

@ -374,7 +374,7 @@ struct Vector_Nt {
}
T maxcoord(int *ind=NULL) const {
T maxcoord(int *ind=nullptr) const {
int im=0;
T vv=v[0];
for (int i=1; i<N; i++) {
@ -389,7 +389,7 @@ struct Vector_Nt {
//e returns the corrd having maximal absolute value
T maxabscoord(int *ind=NULL) const {
T maxabscoord(int *ind=nullptr) const {
int im=0;
T vv=fabs(v[0]);
for (int i=1; i<N; i++) {
@ -403,7 +403,7 @@ struct Vector_Nt {
}
//e returns the corrd having minimal absolute value
T minabscoord(int *ind=NULL) const {
T minabscoord(int *ind=nullptr) const {
int im=0;
T vv=fabs(v[0]);
for (int i=1; i<N; i++) {
@ -417,7 +417,7 @@ struct Vector_Nt {
}
T mincoord(int *ind=NULL) const {
T mincoord(int *ind=nullptr) const {
int im=0;
T vv=v[0];
for (int i=1; i<N; i++) {
@ -485,7 +485,7 @@ vec_type dist_av(Vector_3 *va1,Vector_3 *va2,int n);
//e finds the average difference norm between two vector sets of the same length
/*e optionally gives the indexes for maximal and minimal difference
va2 can be NULL, then the norm of va1 is used */
va2 can be nullptr, then the norm of va1 is used */
vec_type diff_av(Vector_3 *va1,Vector_3 *va2,int n, int *minind=0, int *maxind=0);
@ -615,9 +615,9 @@ inline Vector_3 randdir(){
///\en Calculates extent of the vector container.
/// \return the center of the vector set, optionally
/// (if arguments are not NULL) fills the bounding box in \a box_min, \a box_max.
/// (if arguments are not null pointers) fills the bounding box in \a box_min, \a box_max.
template<class vec_inp_it>
Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){
Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){
if(beg==end)
return Vector_3();
Vector_3 center(*beg++);

View File

@ -13,7 +13,7 @@ message_logger &message_logger::global(){
return *glogp;
}
message_logger *message_logger::glogp=NULL;
message_logger *message_logger::glogp=nullptr;
stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1);
const char *logfmt(const char *format,...){

View File

@ -255,7 +255,7 @@ public:
}
//e Create NormDeriv object and calculate the derivatived for the given WP
void set2(const WavePacket& w2_, const cdouble *I0_=NULL){
void set2(const WavePacket& w2_, const cdouble *I0_=nullptr){
w2=w2_;
d2.set(w2);
w12=conj(w1)*w2;
@ -558,13 +558,13 @@ public:
//e if PBCs are used, the corresponding coordinates of electrons and ions
//e in periodic directions must be within the range [0, cell[per_dir])
//e @returns 1 if OK
int set_pbc(const Vector_3P pcell=NULL, int pbc_=0x7);
int set_pbc(const Vector_3P pcell=nullptr, int pbc_=0x7);
///\en Setup electrons: forms internal wave packet representations.
/// If PBCs are used the coords must be within a range [0, cell).
/// Default electron mass is AWPMD::me.
/// Default (q=NULL )electron charges are -1.
int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=NULL);
/// Default (q=nullptr )electron charges are -1.
int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=nullptr);
//e setup ion charges and coordinates
//e if PBCs are used the coords must be within a range [0, cell)
@ -593,16 +593,16 @@ public:
// 0x2 -- add ion forces to the existing set
// 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED)
//e if PBCs are used the coords must be within a range [0, cell)
virtual int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL,
Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL);
virtual int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr,
Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr);
//e same as interaction, but using Hartee factorization (no antisymmetrization)
virtual int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL,
Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL);
virtual int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr,
Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr);
///\en Calculates ion-ion interactions and updates Eii and ion forces if requested. This function
/// is called form intaraction() and interaction_hartree if calc_ii is set.
virtual int interaction_ii(int flag,Vector_3P fi=NULL);
virtual int interaction_ii(int flag,Vector_3P fi=nullptr);
//e Calculates Norm matrix
//e The result is saved in AWPMD::Norm[s]
@ -643,7 +643,7 @@ public:
///\en Prepares force arrays according to \a flag setting for interaction()
virtual void clear_forces(int flagi,Vector_3P fi, Vector_3P fe_x,
Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=NULL);
Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=nullptr);
///\en Creates wave packet according to the given physical parameters.

View File

@ -312,7 +312,7 @@ void AWPMD_split::clear_forces(int flag,Vector_3P fi, Vector_3P fe_x,
void AWPMD_split::get_el_forces(int flag, Vector_3P fe_x,
Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){
if(flag&0x4) //need to replace the forces
clear_forces(0x4,NULL,fe_x,fe_p,fe_w,fe_pw,fe_c);
clear_forces(0x4,nullptr,fe_x,fe_p,fe_w,fe_pw,fe_c);
// recalculating derivatives
if(flag&(0x8|0x4)){ //electron forces needed
@ -622,7 +622,7 @@ void AWPMD_split::y_deriv(cdouble v,int s,int c2, int c1){
/// 0x4 -- calculate electronic forces \n
/// 0x8 -- add electronic forces to the existing arrays \n
/// 0x10 -- calculate internal electronic derivatives only: \n
/// will not update electronic force arrays, which may be NULL, \n
/// will not update electronic force arrays, which may be null pointers, \n
/// the forces may be obtained then using \ref get_el_forces() for all WPs \n
/// or separately for each WP using \ref get_wp_force()
/// if PBCs are used the coords must be within a range [0, cell)

View File

@ -116,8 +116,8 @@ public:
/// \a n is the number of electrons of a given spin component
/// Electron velocity v is multiplied by mass to obtain momentum.
/// Default mass (-1) means me.
/// Electronic charges q are -1 by default (when q=NULL), otherwise the charges are assigned for each split
int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=NULL);
/// Electronic charges q are -1 by default (when q=nullptr), otherwise the charges are assigned for each split
int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=nullptr);
///\en Starts adding new electron: continue with \ref add_split functions.
@ -141,7 +141,7 @@ public:
///\en gets current electronic coordinates, and (optionally) number of wave packets for each electron
int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=NULL, double mass=-1);
int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=nullptr, double mass=-1);
void eterm_deriv(int ic1,int s1, int c1,int k1,int ic2,int s2, int c2,int j2,cdouble pref,
@ -164,8 +164,8 @@ public:
cdouble overlap(int ic1, int s1, int c1,int ic2, int s2, int c2);
//e same as interaction, but using Hartee factorization (no antisymmetrization)
int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL,
Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL);
int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr,
Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr);
///\en Calculates interaction in the system of ni ions + electrons
/// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions
@ -174,12 +174,12 @@ public:
/// 0x4 -- calculate electronic forces \n
/// 0x8 -- add electronic forces to the existing arrays \n
/// 0x10 -- calculate internal electronic derivatives only: \n
/// will not update electronic force arrays, which may be NULL, \n
/// will not update electronic force arrays, which may be null pointers, \n
/// the forces may be obtained then using \ref get_el_forces() for all WPs \n
/// or separately for each WP using \ref get_wp_force()
/// if PBCs are used the coords must be within a range [0, cell)
int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL,
Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL);
int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr,
Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr);
///\en Get electronic forcess in the arrays provided, using calculated internal representation
/// Valid flag settings are:\n

View File

@ -95,7 +95,7 @@ CUDPPResult cudppScan(CUDPPHandle planHandle,
size_t numElements)
{
CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppScanDispatch(d_out, d_in, numElements, 1, plan);
return CUDPP_SUCCESS;
@ -159,7 +159,7 @@ CUDPPResult cudppSegmentedScan(CUDPPHandle planHandle,
{
CUDPPSegmentedScanPlan *plan =
(CUDPPSegmentedScanPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppSegmentedScanDispatch(d_out, d_idata, d_iflags, numElements, plan);
return CUDPP_SUCCESS;
@ -200,7 +200,7 @@ CUDPPResult cudppMultiScan(CUDPPHandle planHandle,
size_t numRows)
{
CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppScanDispatch(d_out, d_in, numElements, numRows, plan);
return CUDPP_SUCCESS;
@ -255,7 +255,7 @@ CUDPPResult cudppCompact(CUDPPHandle planHandle,
size_t numElements)
{
CUDPPCompactPlan *plan = (CUDPPCompactPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppCompactDispatch(d_out, d_numValidElements, d_in, d_isValid,
numElements, plan);
@ -300,7 +300,7 @@ CUDPPResult cudppSort(CUDPPHandle planHandle,
size_t numElements)
{
CUDPPRadixSortPlan *plan = (CUDPPRadixSortPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppRadixSortDispatch(d_keys, d_values, numElements, keyBits, plan);
return CUDPP_SUCCESS;
@ -331,7 +331,7 @@ CUDPPResult cudppSparseMatrixVectorMultiply(CUDPPHandle sparseMatrixHandl
CUDPPSparseMatrixVectorMultiplyPlan *plan =
(CUDPPSparseMatrixVectorMultiplyPlan*)CUDPPPlanManager::GetPlan(sparseMatrixHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppSparseMatrixVectorMultiplyDispatch(d_y, d_x, plan);
return CUDPP_SUCCESS;
@ -366,7 +366,7 @@ CUDPP_DLL
CUDPPResult cudppRand(CUDPPHandle planHandle,void * d_out, size_t numElements)
{
CUDPPRandPlan * plan = (CUDPPRandPlan *) CUDPPPlanManager::GetPlan(planHandle);
if(plan != NULL)
if(plan != nullptr)
{
//dispatch the rand algorithm here
cudppRandDispatch(d_out, numElements, plan);

View File

@ -18,7 +18,7 @@
#include <cassert>
CUDPPPlanManager* CUDPPPlanManager::m_instance = NULL;
CUDPPPlanManager* CUDPPPlanManager::m_instance = nullptr;
CUDPPResult validateOptions(CUDPPConfiguration config, size_t /*numElements*/, size_t numRows, size_t /*rowPitch*/)
{

View File

@ -26,17 +26,17 @@ extern "C" void compNumCTAs(KernelPointer kernel, size_t bytesDynamicSharedMem,
//! @internal Instantiate the plan manager singleton object
void CUDPPPlanManager::Instantiate()
{
if (NULL == m_instance)
if (nullptr == m_instance)
m_instance = new CUDPPPlanManager;
}
//! @internal Destroy the plan manager singleton object
void CUDPPPlanManager::Destroy()
{
if (NULL != m_instance)
if (nullptr != m_instance)
{
delete m_instance;
m_instance = NULL;
m_instance = nullptr;
}
}
@ -51,7 +51,7 @@ CUDPPPlanManager::~CUDPPPlanManager()
{
CUDPPPlan* plan = it->second;
delete plan;
plan = NULL;
plan = nullptr;
}
m_instance->plans.clear();
@ -85,7 +85,7 @@ CUDPPHandle CUDPPPlanManager::AddPlan(CUDPPPlan* plan)
*/
bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle)
{
if (m_instance == NULL)
if (m_instance == nullptr)
{
return false;
}
@ -97,7 +97,7 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle)
{
CUDPPPlan* plan = it->second;
delete plan;
plan = NULL;
plan = nullptr;
m_instance->plans.erase(it);
if (0 == m_instance->plans.size())
@ -115,14 +115,14 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle)
/** @brief Get a plan from the plan manager by handle
*
* @returns A pointer to the plan if found, or NULL otherwise
* @returns A pointer to the plan if found, or nullptr otherwise
* @param handle The handle to the requested plan
*/
CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle)
{
if (m_instance == NULL)
if (m_instance == nullptr)
{
return NULL;
return nullptr;
}
std::map<CUDPPHandle, CUDPPPlan*>::iterator it;
@ -133,13 +133,13 @@ CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle)
}
else
{
return NULL;
return nullptr;
}
}
size_t CUDPPPlanManager::numCTAs(KernelPointer kernel)
{
if (m_instance == NULL)
if (m_instance == nullptr)
{
return 0;
}

View File

@ -136,7 +136,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -152,7 +152,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -168,7 +168,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -183,7 +183,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -199,7 +199,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -215,7 +215,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -307,7 +307,7 @@ extern "C" {
//! @param data handle to the data read
//! @param w width of the image
//! @param h height of the image
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -350,7 +350,7 @@ extern "C" {
//! @param data handle to the data read
//! @param w width of the image
//! @param h height of the image
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -366,7 +366,7 @@ extern "C" {
//! @param data handle to the data read
//! @param w width of the image
//! @param h height of the image
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -381,7 +381,7 @@ extern "C" {
//! @param data handle to the data read
//! @param w width of the image
//! @param h height of the image
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////

View File

@ -261,7 +261,7 @@ class UCL_Device {
/// Select the platform that has accelerators (for compatibility with OpenCL)
inline int set_platform_accelerator(int pid=-1) { return UCL_SUCCESS; }
inline int load_module(const void* program, hipModule_t& module, std::string *log=NULL){
inline int load_module(const void* program, hipModule_t& module, std::string *log=nullptr){
auto it = _loaded_modules.emplace(program, hipModule_t());
if(!it.second){
module = it.first->second;
@ -281,7 +281,7 @@ class UCL_Device {
hipError_t err=hipModuleLoadDataEx(&module,program,num_opts, options,(void **)values);
if (log!=NULL)
if (log!=nullptr)
*log=std::string(clog);
if (err != hipSuccess) {

View File

@ -30,7 +30,7 @@ class UCL_Program {
public:
inline UCL_Program(UCL_Device &device) { _device_ptr = &device; _cq=device.cq(); }
inline UCL_Program(UCL_Device &device, const void *program,
const char *flags="", std::string *log=NULL) {
const char *flags="", std::string *log=nullptr) {
_device_ptr = &device; _cq=device.cq();
init(device);
load_string(program,flags,log);
@ -46,7 +46,7 @@ class UCL_Program {
inline void clear() { }
/// Load a program from a file and compile with flags
inline int load(const char *filename, const char *flags="", std::string *log=NULL) {
inline int load(const char *filename, const char *flags="", std::string *log=nullptr) {
std::ifstream in(filename);
if (!in || in.is_open()==false) {
#ifndef UCL_NO_EXIT
@ -64,7 +64,7 @@ class UCL_Program {
}
/// Load a program from a string and compile with flags
inline int load_string(const void *program, const char *flags="", std::string *log=NULL) {
inline int load_string(const void *program, const char *flags="", std::string *log=nullptr) {
return _device_ptr->load_module(program, _module, log);
}
@ -263,7 +263,7 @@ class UCL_Kernel {
};
const auto res = hipModuleLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1],
_num_blocks[2],_block_size[0],_block_size[1],
_block_size[2],0,_cq, NULL, config);
_block_size[2],0,_cq, nullptr, config);
CU_SAFE_CALL(res);
//#endif
}

View File

@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n,
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined);
else
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault);
if (err!=hipSuccess || *(mat.host_ptr())==NULL)
if (err!=hipSuccess || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
mat.cq()=cm.cq();
return UCL_SUCCESS;
@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n,
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined);
else
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault);
if (err!=hipSuccess || *(mat.host_ptr())==NULL)
if (err!=hipSuccess || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
mat.cq()=dev.cq();
return UCL_SUCCESS;
@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) {
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined);
else
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault);
if (err!=hipSuccess || *(mat.host_ptr())==NULL)
if (err!=hipSuccess || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
return UCL_SUCCESS;
}

View File

@ -99,7 +99,7 @@ class UCL_Texture {
else
CU_SAFE_CALL(hipTexRefSetFormat(_tex,HIP_AD_FORMAT_SIGNED_INT32,numel*2));
}
CU_SAFE_CALL(hipTexRefSetAddress(NULL, _tex, vec.cbegin(), vec.numel()*vec.element_size()));
CU_SAFE_CALL(hipTexRefSetAddress(nullptr, _tex, vec.cbegin(), vec.numel()*vec.element_size()));
#else
void* data_ptr = (void*)vec.cbegin();
CU_SAFE_CALL(hipMemcpyHtoD(hipDeviceptr_t(_device_ptr_to_global_var), &data_ptr, sizeof(void*)));

View File

@ -41,7 +41,7 @@ class UCL_Program {
public:
inline UCL_Program(UCL_Device &device) { _cq=device.cq(); }
inline UCL_Program(UCL_Device &device, const void *program,
const char *flags="", std::string *log=NULL) {
const char *flags="", std::string *log=nullptr) {
_cq=device.cq();
init(device);
load_string(program,flags,log);
@ -58,7 +58,7 @@ class UCL_Program {
/// Load a program from a file and compile with flags
inline int load(const char *filename, const char *flags="",
std::string *log=NULL) {
std::string *log=nullptr) {
std::ifstream in(filename);
if (!in || in.is_open()==false) {
#ifndef UCL_NO_EXIT
@ -77,7 +77,7 @@ class UCL_Program {
/// Load a program from a string and compile with flags
inline int load_string(const void *program, const char *flags="",
std::string *log=NULL) {
std::string *log=nullptr) {
if (std::string(flags)=="BINARY")
return load_binary((const char *)program);
const unsigned int num_opts=2;
@ -95,7 +95,7 @@ class UCL_Program {
CUresult err=cuModuleLoadDataEx(&_module,program,num_opts,
options,(void **)values);
if (log!=NULL)
if (log!=nullptr)
*log=std::string(clog);
if (err != CUDA_SUCCESS) {
@ -361,7 +361,7 @@ class UCL_Kernel {
#if CUDA_VERSION >= 4000
CU_SAFE_CALL(cuLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1],
_num_blocks[2],_block_size[0],_block_size[1],
_block_size[2],0,_cq,_kernel_args,NULL));
_block_size[2],0,_cq,_kernel_args,nullptr));
#else
CU_SAFE_CALL(cuParamSetSize(_kernel,_param_size));
CU_SAFE_CALL(cuLaunchGridAsync(_kernel,_num_blocks[0],_num_blocks[1],_cq));

View File

@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n,
err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED);
else
err=cuMemAllocHost((void **)mat.host_ptr(),n);
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL)
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
mat.cq()=cm.cq();
return UCL_SUCCESS;
@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n,
err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED);
else
err=cuMemAllocHost((void **)mat.host_ptr(),n);
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL)
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
mat.cq()=dev.cq();
return UCL_SUCCESS;
@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) {
err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED);
else
err=cuMemAllocHost((void **)mat.host_ptr(),n);
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL)
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
return UCL_SUCCESS;
}

View File

@ -80,7 +80,7 @@ class UCL_Texture {
#ifdef UCL_DEBUG
assert(numel!=0 && numel<5);
#endif
CU_SAFE_CALL(cuTexRefSetAddress(NULL, _tex, vec.cbegin(),
CU_SAFE_CALL(cuTexRefSetAddress(nullptr, _tex, vec.cbegin(),
vec.numel()*vec.element_size()));
if (vec.element_size()==sizeof(float))
CU_SAFE_CALL(cuTexRefSetFormat(_tex, CU_AD_FORMAT_FLOAT, numel));

View File

@ -360,7 +360,7 @@ int UCL_Device::set_platform(int pid) {
// --- Get Number of Devices
cl_uint n;
errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,NULL,&n);
errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,nullptr,&n);
_num_devices=n;
if (errorv!=CL_SUCCESS || _num_devices==0) {
_num_devices=0;
@ -385,7 +385,7 @@ int UCL_Device::create_context() {
props[0]=CL_CONTEXT_PLATFORM;
props[1]=_platform;
props[2]=0;
_context=clCreateContext(0,1,&_cl_device,NULL,NULL,&errorv);
_context=clCreateContext(0,1,&_cl_device,nullptr,nullptr,&errorv);
if (errorv!=CL_SUCCESS) {
#ifndef UCL_NO_EXIT
std::cerr << "UCL Error: Could not access accelerator number " << _device
@ -404,36 +404,36 @@ void UCL_Device::add_properties(cl_device_id device_list) {
char buffer[1024];
cl_bool ans_bool;
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,NULL));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,nullptr));
op.name=buffer;
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_GLOBAL_MEM_SIZE,
sizeof(op.global_mem),&op.global_mem,NULL));
sizeof(op.global_mem),&op.global_mem,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_LOCAL_MEM_SIZE,
sizeof(op.shared_mem),&op.shared_mem,NULL));
sizeof(op.shared_mem),&op.shared_mem,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE,
sizeof(op.const_mem),&op.const_mem,NULL));
sizeof(op.const_mem),&op.const_mem,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_TYPE,
sizeof(op.device_type),&op.device_type,NULL));
sizeof(op.device_type),&op.device_type,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_COMPUTE_UNITS,
sizeof(op.compute_units),&op.compute_units,
NULL));
nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CLOCK_FREQUENCY,
sizeof(op.clock),&op.clock,NULL));
sizeof(op.clock),&op.clock,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_GROUP_SIZE,
sizeof(op.work_group_size),&op.work_group_size,
NULL));
nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_ITEM_SIZES,
3*sizeof(op.work_item_size[0]),op.work_item_size,
NULL));
nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MEM_BASE_ADDR_ALIGN,
sizeof(cl_uint),&op.alignment,NULL));
sizeof(cl_uint),&op.alignment,nullptr));
op.alignment/=8;
// Determine if double precision is supported
cl_uint double_width;
CL_SAFE_CALL(clGetDeviceInfo(device_list,
CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
sizeof(double_width),&double_width,NULL));
sizeof(double_width),&double_width,nullptr));
if (double_width==0)
op.double_precision=false;
else
@ -441,13 +441,13 @@ void UCL_Device::add_properties(cl_device_id device_list) {
CL_SAFE_CALL(clGetDeviceInfo(device_list,
CL_DEVICE_PROFILING_TIMER_RESOLUTION,
sizeof(size_t),&op.timer_resolution,NULL));
sizeof(size_t),&op.timer_resolution,nullptr));
op.ecc_support=false;
CL_SAFE_CALL(clGetDeviceInfo(device_list,
CL_DEVICE_ERROR_CORRECTION_SUPPORT,
sizeof(ans_bool),&ans_bool,NULL));
sizeof(ans_bool),&ans_bool,nullptr));
if (ans_bool==CL_TRUE)
op.ecc_support=true;
@ -459,7 +459,7 @@ void UCL_Device::add_properties(cl_device_id device_list) {
#ifdef CL_VERSION_1_2
size_t return_bytes;
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_OPENCL_C_VERSION,1024,
buffer,NULL));
buffer,nullptr));
op.c_version=buffer;
cl_device_partition_property pinfo[4];
@ -479,7 +479,7 @@ void UCL_Device::add_properties(cl_device_id device_list) {
CL_SAFE_CALL(clGetDeviceInfo(device_list,
CL_DEVICE_PARTITION_MAX_SUB_DEVICES,
sizeof(cl_uint),&op.max_sub_devices,NULL));
sizeof(cl_uint),&op.max_sub_devices,nullptr));
#endif
_properties.push_back(op);
@ -489,15 +489,15 @@ std::string UCL_Device::platform_name() {
char info[1024];
CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VENDOR,1024,info,
NULL));
nullptr));
std::string ans=std::string(info)+' ';
CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_NAME,1024,info,
NULL));
nullptr));
ans+=std::string(info)+' ';
CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VERSION,1024,info,
NULL));
nullptr));
ans+=std::string(info);
return ans;

View File

@ -42,7 +42,7 @@ class UCL_Program {
inline UCL_Program() : _init_done(false) {}
inline UCL_Program(UCL_Device &device) : _init_done(false) { init(device); }
inline UCL_Program(UCL_Device &device, const void *program,
const char *flags="", std::string *log=NULL) :
const char *flags="", std::string *log=nullptr) :
_init_done(false) {
init(device);
load_string(program,flags,log);
@ -74,7 +74,7 @@ class UCL_Program {
/// Load a program from a file and compile with flags
inline int load(const char *filename, const char *flags="",
std::string *log=NULL) {
std::string *log=nullptr) {
std::ifstream in(filename);
if (!in || in.is_open()==false) {
#ifndef UCL_NO_EXIT
@ -93,29 +93,29 @@ class UCL_Program {
/// Load a program from a string and compile with flags
inline int load_string(const void *program, const char *flags="",
std::string *log=NULL) {
std::string *log=nullptr) {
cl_int error_flag;
const char *prog=(const char *)program;
_program=clCreateProgramWithSource(_context,1,&prog,NULL,&error_flag);
_program=clCreateProgramWithSource(_context,1,&prog,nullptr,&error_flag);
CL_CHECK_ERR(error_flag);
error_flag = clBuildProgram(_program,1,&_device,flags,NULL,NULL);
error_flag = clBuildProgram(_program,1,&_device,flags,nullptr,nullptr);
if (error_flag!=-11)
CL_CHECK_ERR(error_flag);
cl_build_status build_status;
CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,
CL_PROGRAM_BUILD_STATUS,
sizeof(cl_build_status),&build_status,
NULL));
nullptr));
if (build_status != CL_SUCCESS || log!=NULL) {
if (build_status != CL_SUCCESS || log!=nullptr) {
size_t ms;
CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,0,
NULL, &ms));
nullptr, &ms));
char *build_log = new char[ms];
CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,ms,
build_log, NULL));
build_log, nullptr));
if (log!=NULL)
if (log!=nullptr)
*log=std::string(build_log);
if (build_status != CL_SUCCESS) {
@ -363,7 +363,7 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function)
_kernel_info_name=function;
cl_uint nargs;
CL_SAFE_CALL(clGetKernelInfo(_kernel,CL_KERNEL_NUM_ARGS,sizeof(cl_uint),
&nargs,NULL));
&nargs,nullptr));
_kernel_info_nargs=nargs;
#ifdef NOT_TEST_CL_VERSION_1_2
char tname[256];
@ -380,8 +380,8 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function)
}
void UCL_Kernel::run() {
CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,NULL,
_num_blocks,_block_size,0,NULL,NULL));
CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,nullptr,
_num_blocks,_block_size,0,nullptr,nullptr));
}
} // namespace

View File

@ -58,7 +58,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n,
cl_int error_flag;
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_mem_flags buffer_perm;
cl_map_flags map_perm;
@ -103,12 +103,12 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n,
map_perm=CL_MAP_READ | CL_MAP_WRITE;
}
mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
*mat.host_ptr() = (typename mat_type::data_type*)
clEnqueueMapBuffer(cm.cq(),mat.cbegin(),CL_TRUE,
map_perm,0,n,0,NULL,NULL,NULL);
map_perm,0,n,0,nullptr,nullptr,nullptr);
mat.cq()=cm.cq();
CL_SAFE_CALL(clRetainCommandQueue(mat.cq()));
@ -120,10 +120,10 @@ inline int _host_view(mat_type &mat, copy_type &cm, const size_t n) {
cl_int error_flag;
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_mem_flags orig_flags;
CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_FLAGS,sizeof(orig_flags),
&orig_flags,NULL));
&orig_flags,nullptr));
orig_flags=orig_flags & ~CL_MEM_ALLOC_HOST_PTR;
mat.cbegin()=clCreateBuffer(context, CL_MEM_USE_HOST_PTR | orig_flags, n,
@ -159,13 +159,13 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n,
}
cl_int error_flag;
mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
*mat.host_ptr() = (typename mat_type::data_type*)
clEnqueueMapBuffer(dev.cq(),mat.cbegin(),CL_TRUE,
map_perm,0,n,0,NULL,NULL,NULL);
map_perm,0,n,0,nullptr,nullptr,nullptr);
mat.cq()=dev.cq();
CL_SAFE_CALL(clRetainCommandQueue(mat.cq()));
return UCL_SUCCESS;
@ -194,10 +194,10 @@ inline int _host_resize(mat_type &mat, const size_t n) {
cl_int error_flag;
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_mem_flags buffer_perm;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_FLAGS,sizeof(buffer_perm),
&buffer_perm,NULL));
&buffer_perm,nullptr));
CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin()));
@ -209,12 +209,12 @@ inline int _host_resize(mat_type &mat, const size_t n) {
else
map_perm=CL_MAP_READ | CL_MAP_WRITE;
mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
*mat.host_ptr() = (typename mat_type::data_type*)
clEnqueueMapBuffer(mat.cq(),mat.cbegin(),CL_TRUE,
map_perm,0,n,0,NULL,NULL,NULL);
map_perm,0,n,0,nullptr,nullptr,nullptr);
return UCL_SUCCESS;
}
@ -229,7 +229,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n,
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_mem_flags flag;
if (kind==UCL_READ_WRITE)
flag=CL_MEM_READ_WRITE;
@ -247,7 +247,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n,
#endif
else
assert(0==1);
mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
mat.cq()=cm.cq();
@ -276,7 +276,7 @@ inline int _device_alloc(mat_type &mat, UCL_Device &dev, const size_t n,
#endif
else
assert(0==1);
mat.cbegin()=clCreateBuffer(dev.context(),flag,n,NULL,
mat.cbegin()=clCreateBuffer(dev.context(),flag,n,nullptr,
&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
@ -321,7 +321,7 @@ inline int _device_resize(mat_type &mat, const size_t n) {
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin()));
cl_mem_flags flag;
@ -341,7 +341,7 @@ inline int _device_resize(mat_type &mat, const size_t n) {
#endif
else
assert(0==1);
mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
return UCL_SUCCESS;
@ -359,7 +359,7 @@ inline int _device_resize(mat_type &mat, const size_t rows,
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin()));
cl_mem_flags flag;
@ -379,7 +379,7 @@ inline int _device_resize(mat_type &mat, const size_t rows,
#endif
else
assert(0==1);
mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
return UCL_SUCCESS;
@ -395,21 +395,21 @@ inline void _host_zero(void *ptr, const size_t n) {
inline void _ocl_build(cl_program &program, cl_device_id &device,
const char* options = "") {
clBuildProgram(program,1,&device,options,NULL,NULL);
clBuildProgram(program,1,&device,options,nullptr,nullptr);
cl_build_status build_status;
CL_SAFE_CALL(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_STATUS,
sizeof(cl_build_status),&build_status,
NULL));
nullptr));
if (build_status == CL_SUCCESS)
return;
size_t ms;
CL_SAFE_CALL(clGetProgramBuildInfo(program, device,CL_PROGRAM_BUILD_LOG, 0,
NULL, &ms));
nullptr, &ms));
char *build_log = new char[ms];
CL_SAFE_CALL(clGetProgramBuildInfo(program,device,CL_PROGRAM_BUILD_LOG,ms,
build_log, NULL));
build_log, nullptr));
std::cerr << std::endl
<< "----------------------------------------------------------\n"
@ -426,7 +426,7 @@ inline void _ocl_kernel_from_source(cl_context &context, cl_device_id &device,
cl_int error_flag;
cl_program program=clCreateProgramWithSource(context,lines,source,
NULL,&error_flag);
nullptr,&error_flag);
CL_CHECK_ERR(error_flag);
_ocl_build(program,device,options);
kernel=clCreateKernel(program,function,&error_flag);
@ -444,15 +444,15 @@ inline void _device_zero(mat_type &mat, const size_t n, command_queue &cq) {
#ifdef UCL_CL_ZERO
cl_int zeroint=0;
CL_SAFE_CALL(clEnqueueFillBuffer(cq,mat.begin(),&zeroint,sizeof(cl_int),
mat.byteoff(),n,0,NULL,NULL));
mat.byteoff(),n,0,nullptr,nullptr));
#else
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_device_id device;
CL_SAFE_CALL(clGetContextInfo(context,CL_CONTEXT_DEVICES,
sizeof(cl_device_id),&device,NULL));
sizeof(cl_device_id),&device,nullptr));
const char * szero[3]={
"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n",
@ -585,7 +585,7 @@ template <> struct _ucl_memcpy<1,0> {
std::cerr << "UCL_COPY 1NS\n";
#endif
CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,n,
dst.begin(),0,NULL,NULL));
dst.begin(),0,nullptr,nullptr));
}
template <class p1, class p2>
static inline void mc(p1 &dst, const size_t dpitch, const p2 &src,
@ -607,13 +607,13 @@ template <> struct _ucl_memcpy<1,0> {
src.cols()==cols/src.element_size())
CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,
spitch*rows,
(char *)dst.begin()+dst_offset,0,NULL,
NULL));
(char *)dst.begin()+dst_offset,0,nullptr,
nullptr));
else
for (size_t i=0; i<rows; i++) {
CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,cols,
(char *)dst.begin()+dst_offset,0,NULL,
NULL));
(char *)dst.begin()+dst_offset,0,nullptr,
nullptr));
src_offset+=spitch;
dst_offset+=dpitch;
}
@ -637,7 +637,7 @@ template <> struct _ucl_memcpy<0,1> {
std::cerr << "UCL_COPY 3NS\n";
#endif
CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,n,
src.begin(),0,NULL,NULL));
src.begin(),0,nullptr,nullptr));
}
template <class p1, class p2>
static inline void mc(p1 &dst, const size_t dpitch, const p2 &src,
@ -659,13 +659,13 @@ template <> struct _ucl_memcpy<0,1> {
src.cols()==cols/src.element_size())
CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,
spitch*rows,
(char *)src.begin()+src_offset,0,NULL,
NULL));
(char *)src.begin()+src_offset,0,nullptr,
nullptr));
else
for (size_t i=0; i<rows; i++) {
CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,cols,
(char *)src.begin()+src_offset,0,NULL,
NULL));
(char *)src.begin()+src_offset,0,nullptr,
nullptr));
src_offset+=spitch;
dst_offset+=dpitch;
}
@ -680,7 +680,7 @@ template <int mem1, int mem2> struct _ucl_memcpy {
const size_t dst_offset, const size_t src_offset) {
if (src.cbegin()!=dst.cbegin() || src_offset!=dst_offset) {
CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset,
dst_offset,n,0,NULL,NULL));
dst_offset,n,0,nullptr,nullptr));
#ifdef UCL_DBG_MEM_TRACE
std::cerr << "UCL_COPY 6NS\n";
#endif
@ -704,13 +704,13 @@ template <int mem1, int mem2> struct _ucl_memcpy {
if (spitch==dpitch && dst.cols()==src.cols() &&
src.cols()==cols/src.element_size())
CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset,
dst_offset,spitch*rows,0,NULL,NULL));
dst_offset,spitch*rows,0,nullptr,nullptr));
else
for (size_t i=0; i<rows; i++) {
CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),
src_offset,dst_offset,cols,0,
NULL,NULL));
nullptr,nullptr));
src_offset+=spitch;
dst_offset+=dpitch;
}

Some files were not shown because too many files have changed in this diff Show More