Skip to content

Commit

Permalink
Use nullptr instead of 0L
Browse files Browse the repository at this point in the history
  • Loading branch information
davschneller committed Oct 3, 2024
1 parent a519914 commit 696bb8f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
23 changes: 12 additions & 11 deletions src/input/SimModSuite.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ class SimModSuite : public FullStorageMeshData {
bool m_log;

public:
SimModSuite(const char* modFile, int boundarySize, const char* cadFile = 0L,
const char* licenseFile = 0L, const char* meshCaseName = "mesh",
SimModSuite(const char* modFile, int boundarySize, const char* cadFile = nullptr,
const char* licenseFile = nullptr, const char* meshCaseName = "mesh",
const char* analysisCaseName = "analysis", int enforceSize = 0,
const char* xmlFile = 0L, const bool analyseAR = false, const char* logFile = 0L)
const char* xmlFile = nullptr, const bool analyseAR = false,
const char* logFile = nullptr)
: FullStorageMeshData(boundarySize) {
// Init SimModSuite
SimModel_start();
SimPartitionedMesh_start(0L, 0L);
SimPartitionedMesh_start(nullptr, nullptr);
if (logFile) {
m_log = true;
Sim_logOn(logFile);
Expand All @@ -103,7 +104,7 @@ class SimModSuite : public FullStorageMeshData {
logInfo(PMU_rank()) << "Loading model";

std::string smodFile = modFile;
if (cadFile != 0L) {
if (cadFile != nullptr) {
loadCAD(modFile, cadFile);
} else if (smodFile.substr(smodFile.find_last_of(".") + 1) == "smd") {
loadCAD(modFile, cadFile);
Expand Down Expand Up @@ -227,7 +228,7 @@ class SimModSuite : public FullStorageMeshData {
logInfo(PMU_rank()) << "Local vertices:" << vertexCount;
logInfo(PMU_rank()) << "Local vertices (with duplicates):" << vertexIDCount;

AttCase_associate(analysisCase, 0L);
AttCase_associate(analysisCase, nullptr);

ParallelVertexFilter vertexFilter;

Expand Down Expand Up @@ -465,7 +466,7 @@ class SimModSuite : public FullStorageMeshData {

analysisCase = extractCase(attMngr, analysisCaseName);
pPList children = AttNode_children(analysisCase);
void* iter = 0L;
void* iter = nullptr;
while (pANode child = static_cast<pANode>(PList_next(children, &iter)))
AttCase_setModel(static_cast<pACase>(child), m_model);
PList_delete(children);
Expand Down Expand Up @@ -695,12 +696,12 @@ class SimModSuite : public FullStorageMeshData {
sCadFile = modFile;
utils::StringUtils::replaceLast(sCadFile, ".smd", "_nat.x_t");
}
pNativeModel nativeModel = 0L;
pNativeModel nativeModel = nullptr;
#ifdef PARASOLID
if (utils::Path(sCadFile).exists())
nativeModel = ParasolidNM_createFromFile(sCadFile.c_str(), 0);
#endif
m_model = GM_load(modFile, nativeModel, 0L);
m_model = GM_load(modFile, nativeModel, nullptr);
nativeModel = GM_nativeModel(m_model);

if (nativeModel)
Expand All @@ -710,7 +711,7 @@ class SimModSuite : public FullStorageMeshData {
// check for model errors
pPList modelErrors = PList_new();
if (!GM_isValid(m_model, 1, modelErrors)) {
void* iter = 0L;
void* iter = nullptr;
while (pSimError err = static_cast<pSimError>(PList_next(modelErrors, &iter))) {
logInfo(PMU_rank()) << " Error code: " << SimError_code(err) << std::endl;
logInfo(PMU_rank()) << " Error string: " << SimError_toString(err) << std::endl;
Expand All @@ -722,7 +723,7 @@ class SimModSuite : public FullStorageMeshData {
// check for model infos
pPList modelInfos = PList_new();
if (!GM_isValid(m_model, 1, modelInfos)) {
void* iter = 0L;
void* iter = nullptr;
while (pSimInfo info = static_cast<pSimInfo>(PList_next(modelInfos, &iter))) {
logInfo(PMU_rank()) << " Info code: " << SimInfo_code(info) << std::endl;
logInfo(PMU_rank()) << " Info string: " << SimInfo_toString(info) << std::endl;
Expand Down
23 changes: 12 additions & 11 deletions src/input/SimModSuiteApf.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ class SimModSuiteApf : public ApfMeshInput {
bool m_log;

public:
SimModSuiteApf(const char* modFile, int boundarySize, const char* cadFile = 0L,
const char* licenseFile = 0L, const char* meshCaseName = "mesh",
SimModSuiteApf(const char* modFile, int boundarySize, const char* cadFile = nullptr,
const char* licenseFile = nullptr, const char* meshCaseName = "mesh",
const char* analysisCaseName = "analysis", int enforceSize = 0,
const char* xmlFile = 0L, const bool analyseAR = false, const char* logFile = 0L)
const char* xmlFile = nullptr, const bool analyseAR = false,
const char* logFile = nullptr)
: ApfMeshInput(boundarySize) {
// Init SimModSuite
SimModel_start();
SimPartitionedMesh_start(0L, 0L);
SimPartitionedMesh_start(nullptr, nullptr);
if (logFile) {
m_log = true;
Sim_logOn(logFile);
Expand All @@ -105,7 +106,7 @@ class SimModSuiteApf : public ApfMeshInput {
logInfo(PMU_rank()) << "Loading model";

std::string smodFile = modFile;
if (cadFile != 0L) {
if (cadFile != nullptr) {
loadCAD(modFile, cadFile);
} else if (smodFile.substr(smodFile.find_last_of(".") + 1) == "smd") {
loadCAD(modFile, cadFile);
Expand Down Expand Up @@ -182,7 +183,7 @@ class SimModSuiteApf : public ApfMeshInput {
apf::destroyMesh(tmpMesh);

// Set the boundary conditions from the geometric model
AttCase_associate(analysisCase, 0L);
AttCase_associate(analysisCase, nullptr);
apf::MeshTag* boundaryTag = m_mesh->createIntTag("boundary condition", 1);
apf::MeshIterator* it = m_mesh->begin(2);
while (apf::MeshEntity* face = m_mesh->iterate(it)) {
Expand Down Expand Up @@ -345,7 +346,7 @@ class SimModSuiteApf : public ApfMeshInput {

analysisCase = extractCase(attMngr, analysisCaseName);
pPList children = AttNode_children(analysisCase);
void* iter = 0L;
void* iter = nullptr;
while (pANode child = static_cast<pANode>(PList_next(children, &iter)))
AttCase_setModel(static_cast<pACase>(child), m_model);
PList_delete(children);
Expand Down Expand Up @@ -575,12 +576,12 @@ class SimModSuiteApf : public ApfMeshInput {
sCadFile = modFile;
utils::StringUtils::replaceLast(sCadFile, ".smd", "_nat.x_t");
}
pNativeModel nativeModel = 0L;
pNativeModel nativeModel = nullptr;
#ifdef PARASOLID
if (utils::Path(sCadFile).exists())
nativeModel = ParasolidNM_createFromFile(sCadFile.c_str(), 0);
#endif
m_model = GM_load(modFile, nativeModel, 0L);
m_model = GM_load(modFile, nativeModel, nullptr);
nativeModel = GM_nativeModel(m_model);

if (nativeModel)
Expand All @@ -590,7 +591,7 @@ class SimModSuiteApf : public ApfMeshInput {
// check for model errors
pPList modelErrors = PList_new();
if (!GM_isValid(m_model, 1, modelErrors)) {
void* iter = 0L;
void* iter = nullptr;
while (pSimError err = static_cast<pSimError>(PList_next(modelErrors, &iter))) {
logInfo(PMU_rank()) << " Error code: " << SimError_code(err) << std::endl;
logInfo(PMU_rank()) << " Error string: " << SimError_toString(err) << std::endl;
Expand All @@ -602,7 +603,7 @@ class SimModSuiteApf : public ApfMeshInput {
// check for model infos
pPList modelInfos = PList_new();
if (!GM_isValid(m_model, 1, modelInfos)) {
void* iter = 0L;
void* iter = nullptr;
while (pSimInfo info = static_cast<pSimInfo>(PList_next(modelInfos, &iter))) {
logInfo(PMU_rank()) << " Info code: " << SimInfo_code(info) << std::endl;
logInfo(PMU_rank()) << " Info string: " << SimInfo_toString(info) << std::endl;
Expand Down

0 comments on commit 696bb8f

Please sign in to comment.