reorganize ifdef'ery to avoid static analyzer errors
This commit is contained in:
@@ -311,6 +311,7 @@ std::vector<IntVec> DomainDecomposition::calcSubdomains3D(size_t nel1, size_t ne
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_MPI
|
||||
void DomainDecomposition::setupNodeNumbers(int basis, IntVec& lNodes,
|
||||
std::set<int>& cbasis,
|
||||
const ASMbase* pch,
|
||||
@@ -356,6 +357,7 @@ void DomainDecomposition::setupNodeNumbers(int basis, IntVec& lNodes,
|
||||
} else
|
||||
pch->getBoundaryNodes(lidx, lNodes, it2, thick, orient, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool DomainDecomposition::calcGlobalNodeNumbers(const ProcessAdm& adm,
|
||||
@@ -492,6 +494,7 @@ bool DomainDecomposition::calcGlobalNodeNumbers(const ProcessAdm& adm,
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_MPI
|
||||
std::vector<int> DomainDecomposition::setupEquationNumbers(const SIMbase& sim,
|
||||
int pidx, int lidx,
|
||||
const std::set<int>& cbasis,
|
||||
@@ -543,6 +546,7 @@ std::vector<int> DomainDecomposition::setupEquationNumbers(const SIMbase& sim,
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool DomainDecomposition::calcGlobalEqNumbers(const ProcessAdm& adm,
|
||||
@@ -918,7 +922,9 @@ bool DomainDecomposition::setup(const ProcessAdm& adm, const SIMbase& sim)
|
||||
if (!sanityCheckCorners(sim))
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_MPI
|
||||
ok = 1;
|
||||
#endif
|
||||
|
||||
// Establish local equation mappings for each block.
|
||||
if (sim.getSolParams() && sim.getSolParams()->getNoBlocks() > 1) {
|
||||
@@ -968,7 +974,11 @@ bool DomainDecomposition::setup(const ProcessAdm& adm, const SIMbase& sim)
|
||||
|
||||
// Establish global equation numbers for all blocks.
|
||||
if (!calcGlobalEqNumbers(adm, sim))
|
||||
#ifdef HAVE_MPI
|
||||
ok = 0;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MPI
|
||||
if (!adm.isParallel())
|
||||
|
||||
@@ -173,6 +173,7 @@ private:
|
||||
size_t g1, size_t g2, size_t g3, size_t overlap);
|
||||
|
||||
|
||||
#ifdef HAVE_MPI
|
||||
//! \brief Setup equation numbers for all blocks on a boundary.
|
||||
//! \param sim Simulator with patches and linear solver block information
|
||||
//! \param pidx Patch index
|
||||
@@ -199,6 +200,7 @@ private:
|
||||
std::set<int>& cbasis,
|
||||
const ASMbase* pch,
|
||||
int dim, int lidx, int thick, int orient = 0);
|
||||
#endif
|
||||
|
||||
//! \brief Calculate the global node numbers for given finite element model.
|
||||
bool calcGlobalNodeNumbers(const ProcessAdm& adm, const SIMbase& sim);
|
||||
|
||||
@@ -664,11 +664,11 @@ void ASMu3D::constrainNode (double xi, double eta, double zeta,
|
||||
{
|
||||
std::cerr << "ASMu3D::constrainNode not implemented properly yet" << std::endl;
|
||||
exit(776654);
|
||||
#if 0
|
||||
if (xi < 0.0 || xi > 1.0) return;
|
||||
if (eta < 0.0 || eta > 1.0) return;
|
||||
if (zeta < 0.0 || zeta > 1.0) return;
|
||||
|
||||
#if 0
|
||||
int n1, n2, n3;
|
||||
if (!this->getSize(n1,n2,n3,1)) return;
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ Real SAMpatchPETSc::normInf(const Vector& x, size_t& comp, char dofType) const
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_MPI
|
||||
void SAMpatchPETSc::setupIS(char dofType) const
|
||||
{
|
||||
PetscIntVec ldofs;
|
||||
@@ -169,6 +170,7 @@ void SAMpatchPETSc::setupIS(char dofType) const
|
||||
|
||||
dofIS[dofType].nDofs = gdof - gdofs.front();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool SAMpatchPETSc::expandSolution(const SystemVector& solVec,
|
||||
|
||||
@@ -89,8 +89,10 @@ public:
|
||||
Real scaleSD = 1.0) const;
|
||||
|
||||
private:
|
||||
#ifdef HAVE_MPI
|
||||
//! \brief Setup a parallel index set for a given dofType
|
||||
void setupIS(char dofType) const;
|
||||
#endif
|
||||
|
||||
// Parameters for parallel computing
|
||||
int nProc; //!< Number of processes
|
||||
|
||||
@@ -91,9 +91,10 @@ EvalFunc::EvalFunc (const char* function, const char* x, Real eps)
|
||||
: gradient(nullptr), dx(eps)
|
||||
{
|
||||
try {
|
||||
size_t nalloc = 1;
|
||||
#ifdef USE_OPENMP
|
||||
nalloc = omp_get_max_threads();
|
||||
size_t nalloc = omp_get_max_threads();
|
||||
#else
|
||||
size_t nalloc = 1;
|
||||
#endif
|
||||
expr.resize(nalloc);
|
||||
f.resize(nalloc);
|
||||
@@ -183,9 +184,10 @@ Real EvalFunc::deriv (Real x) const
|
||||
EvalFunction::EvalFunction (const char* function) : gradient{}, dgradient{}
|
||||
{
|
||||
try {
|
||||
size_t nalloc = 1;
|
||||
#ifdef USE_OPENMP
|
||||
nalloc = omp_get_max_threads();
|
||||
size_t nalloc = omp_get_max_threads();
|
||||
#else
|
||||
size_t nalloc = 1;
|
||||
#endif
|
||||
expr.resize(nalloc);
|
||||
f.resize(nalloc);
|
||||
|
||||
@@ -69,11 +69,12 @@ int HDF5Writer::getLastTimeLevel ()
|
||||
if (m_flag == H5F_ACC_TRUNC)
|
||||
return -1;
|
||||
|
||||
hid_t acc_tpl = H5P_DEFAULT;
|
||||
#ifdef HAVE_MPI
|
||||
MPI_Info info = MPI_INFO_NULL;
|
||||
acc_tpl = H5Pcreate(H5P_FILE_ACCESS);
|
||||
hid_t acc_tpl = H5Pcreate(H5P_FILE_ACCESS);
|
||||
H5Pset_fapl_mpio(acc_tpl, MPI_COMM_SELF, info);
|
||||
#else
|
||||
hid_t acc_tpl = H5P_DEFAULT;
|
||||
#endif
|
||||
|
||||
m_file = H5Fopen(m_name.c_str(),m_flag,acc_tpl);
|
||||
@@ -101,11 +102,12 @@ void HDF5Writer::openFile(int level, bool restart)
|
||||
return;
|
||||
int file = 0;
|
||||
#ifdef HAS_HDF5
|
||||
hid_t acc_tpl = H5P_DEFAULT;
|
||||
#ifdef HAVE_MPI
|
||||
MPI_Info info = MPI_INFO_NULL;
|
||||
acc_tpl = H5Pcreate(H5P_FILE_ACCESS);
|
||||
hid_t acc_tpl = H5Pcreate(H5P_FILE_ACCESS);
|
||||
H5Pset_fapl_mpio(acc_tpl, *m_adm.getCommunicator(), info);
|
||||
#else
|
||||
hid_t acc_tpl = H5P_DEFAULT;
|
||||
#endif
|
||||
unsigned int flag = restart ? m_restart_flag : m_flag;
|
||||
std::string fname = restart ? m_restart_name : m_name;
|
||||
@@ -754,10 +756,11 @@ bool HDF5Writer::writeRestartData(int level, const DataExporter::SerializeData&
|
||||
m_restart_flag = H5F_ACC_RDWR;
|
||||
openFile(level, true);
|
||||
int pid = 0;
|
||||
int ptot = 1;
|
||||
#ifdef HAVE_MPI
|
||||
pid = m_adm.getProcId();
|
||||
ptot = m_adm.getNoProcs();
|
||||
int ptot = m_adm.getNoProcs();
|
||||
#else
|
||||
int ptot = 1;
|
||||
#endif
|
||||
for (int p = 0; p < ptot; p++)
|
||||
for (const std::pair<std::string,std::string>& it : data) {
|
||||
|
||||
@@ -85,7 +85,9 @@ void Profiler::start (const std::string& funcName)
|
||||
Profile& p = tID < 0 ? myTimers[funcName] : myMTimers[tID][funcName];
|
||||
if (p.running) return;
|
||||
|
||||
#ifdef USE_OPENMP
|
||||
if (tID < 0)
|
||||
#endif
|
||||
nRunners++;
|
||||
|
||||
p.running = true;
|
||||
|
||||
@@ -206,6 +206,7 @@ VTF::~VTF ()
|
||||
|
||||
void VTF::writeGeometryBlocks (int iStep)
|
||||
{
|
||||
#ifdef HAS_VTFAPI
|
||||
if (myBlocks.empty())
|
||||
return;
|
||||
|
||||
@@ -213,11 +214,10 @@ void VTF::writeGeometryBlocks (int iStep)
|
||||
for (size_t i = 0; i < myBlocks.size(); i++)
|
||||
geomID[i] = myBlocks[i].first;
|
||||
|
||||
#ifdef HAS_VTFAPI
|
||||
if (!myGBlock) myGBlock = new VTFAGeometryBlock();
|
||||
#if HAS_VTFAPI == 1
|
||||
myGBlock->SetGeometryElementBlocks(&geomID.front(),geomID.size(),iStep);
|
||||
#elif HAS_VTFAPI == 2
|
||||
#else
|
||||
myGBlock->SetElementBlocksForState(&geomID.front(),geomID.size(),iStep);
|
||||
#endif
|
||||
#endif
|
||||
@@ -296,6 +296,7 @@ bool VTF::writeTransformation (const Vec3& X, const Tensor& T,
|
||||
bool VTF::writeVres (const std::vector<Real>& nodeResult,
|
||||
int idBlock, int geomID, size_t nvc)
|
||||
{
|
||||
#ifdef HAS_VTFAPI
|
||||
if (!myFile) return true;
|
||||
|
||||
const ElementBlock* grid = this->getBlock(geomID);
|
||||
@@ -332,12 +333,13 @@ bool VTF::writeVres (const std::vector<Real>& nodeResult,
|
||||
dBlock.SetMapToBlockID(myBlocks[geomID-1].first);
|
||||
if (VTFA_FAILURE(myFile->WriteBlock(&dBlock)))
|
||||
return showError("Error writing result block",idBlock);
|
||||
#elif HAS_VTFAPI == 2
|
||||
#else
|
||||
VTFXAResultValuesBlock dBlock(idBlock,VTFXA_DIM_VECTOR,VTFXA_FALSE);
|
||||
dBlock.SetMapToBlockID(myBlocks[geomID-1].first,VTFXA_NODES);
|
||||
dBlock.SetResultValues3D(resVec.data(),nnod);
|
||||
if (VTFA_FAILURE(myDatabase->WriteBlock(&dBlock)))
|
||||
return showError("Error writing result block",idBlock);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@@ -372,7 +374,7 @@ bool VTF::writeEres (const std::vector<Real>& elementResult,
|
||||
dBlock.SetMapToBlockID(myBlocks[geomID-1].first);
|
||||
if (VTFA_FAILURE(myFile->WriteBlock(&dBlock)))
|
||||
return showError("Error writing result block",idBlock);
|
||||
#elif HAS_VTFAPI == 2
|
||||
#else
|
||||
VTFXAResultValuesBlock dBlock(idBlock,VTFXA_DIM_SCALAR,VTFXA_FALSE);
|
||||
dBlock.SetMapToBlockID(myBlocks[geomID-1].first,VTFXA_ELEMENTS);
|
||||
dBlock.SetResultValues1D(resVec.data(),nres);
|
||||
@@ -387,6 +389,7 @@ bool VTF::writeEres (const std::vector<Real>& elementResult,
|
||||
bool VTF::writeNres (const std::vector<Real>& nodalResult,
|
||||
int idBlock, int geomID)
|
||||
{
|
||||
#ifdef HAS_VTFAPI
|
||||
if (!myFile) return true;
|
||||
|
||||
const ElementBlock* grid = this->getBlock(geomID);
|
||||
@@ -410,12 +413,13 @@ bool VTF::writeNres (const std::vector<Real>& nodalResult,
|
||||
dBlock.SetMapToBlockID(myBlocks[geomID-1].first);
|
||||
if (VTFA_FAILURE(myFile->WriteBlock(&dBlock)))
|
||||
return showError("Error writing result block",idBlock);
|
||||
#elif HAS_VTFAPI == 2
|
||||
#else
|
||||
VTFXAResultValuesBlock dBlock(idBlock,VTFXA_DIM_SCALAR,VTFXA_FALSE);
|
||||
dBlock.SetMapToBlockID(myBlocks[geomID-1].first,VTFXA_NODES);
|
||||
dBlock.SetResultValues1D(resVec.data(),nres);
|
||||
if (VTFA_FAILURE(myDatabase->WriteBlock(&dBlock)))
|
||||
return showError("Error writing result block",idBlock);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@@ -424,6 +428,7 @@ bool VTF::writeNres (const std::vector<Real>& nodalResult,
|
||||
|
||||
bool VTF::writeNfunc (const RealFunc& f, Real time, int idBlock, int geomID)
|
||||
{
|
||||
#ifdef HAS_VTFAPI
|
||||
if (!myFile) return true;
|
||||
|
||||
const ElementBlock* grid = this->getBlock(geomID);
|
||||
@@ -446,12 +451,13 @@ bool VTF::writeNfunc (const RealFunc& f, Real time, int idBlock, int geomID)
|
||||
dBlock.SetMapToBlockID(myBlocks[geomID-1].first);
|
||||
if (VTFA_FAILURE(myFile->WriteBlock(&dBlock)))
|
||||
return showError("Error writing result block",idBlock);
|
||||
#elif HAS_VTFAPI == 2
|
||||
#else
|
||||
VTFXAResultValuesBlock dBlock(idBlock,VTFXA_DIM_SCALAR,VTFXA_FALSE);
|
||||
dBlock.SetMapToBlockID(myBlocks[geomID-1].first,VTFXA_NODES);
|
||||
dBlock.SetResultValues1D(resVec.data(),nres);
|
||||
if (VTFA_FAILURE(myDatabase->WriteBlock(&dBlock)))
|
||||
return showError("Error writing result block",idBlock);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user