diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b0986a..86aa32f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required (VERSION 2.6) +CMAKE_MINIMUM_REQUIRED (VERSION 2.6) +CMAKE_POLICY (SET CMP0011 NEW) project (NLA3D) @@ -25,10 +26,14 @@ set (NLA3D_BLAS OFF # CMAKE_BUILD_TYPE empty or Release means the same for us set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2") -# TODO: this should depend on compiler -if(UNIX) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -fPIC") -endif() +IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wno-switch") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") +ENDIF() + +SET (CMAKE_CXX_STANDARD 11) +SET (CMAKE_CXX_STANDARD_REQUIRED TRUE) +SET (CMAKE_CXX_EXTENSION FALSE) # Linking on Mac Os was not working without this, see `cmake --help-policy CMP0042` if (APPLE) @@ -58,7 +63,7 @@ if (NLA3D_USE_MKL) find_package(MKL) if (MKL_FOUND) - include_directories(${MKL_INCLUDE_DIR}) + include_directories(SYSTEM ${MKL_INCLUDE_DIR}) # below code works fine only on UNIX systems.. if (MKL_MULTI_THREADED) @@ -77,14 +82,15 @@ endif() # NLA3D_USE_MKL find_package(EASYLOGGINGPP) if (EASYLOGGINGPP_FOUND) - include_directories(${EASYLOGGINGPP_INCLUDE_DIR}) + include_directories(SYSTEM ${EASYLOGGINGPP_INCLUDE_DIR}) else() message(WARNING "Can't find Easylogging++") endif() find_package(EIGEN) if (EIGEN_FOUND) - include_directories(${EIGEN_INCLUDE_DIR}) + # SYSTEM for avoid warnings from the external library + include_directories(SYSTEM ${EIGEN_INCLUDE_DIR}) else() message(WARNING "Can't find Eigen") endif() diff --git a/src/FEReaders.cpp b/src/FEReaders.cpp index 05bd890..1532e72 100644 --- a/src/FEReaders.cpp +++ b/src/FEReaders.cpp @@ -141,28 +141,6 @@ char sfirstNotBlank(const string& str) { return str[st]; } - -std::vector ssplit(const std::string& line, const std::vector& widths, bool strict) { - int ind = 0; - vector vv; - for (int w : widths) { - if (line.length() - ind < w) { - // no room for another field - if (strict) { - LOG(FATAL) << "ssplit: incomplete line: \"" << line << "\""; - } else { - if (line.length() - ind != 0) { - LOG(FATAL) << "ssplit: incomplete field: \"" << line << "\""; - } - return std::move(vv); - } - } - vv.push_back(line.substr(ind, w)); - ind += w; - } - return vv; -} - bool iequals(const string& a, const string& b) { unsigned int sz = a.size(); @@ -235,9 +213,8 @@ int Tokenizer::tokenize(const string& line) { } if (tolower) { - for (int i = 0; i < tokens.size(); i++) { - stolower(tokens[i]); - } + for (auto& token : tokens) + stolower(token); } return found; } @@ -254,7 +231,6 @@ double Tokenizer::tokenDouble(size_t ind) { bool readCdbFile(std::string filename, MeshData& md) { - uint32 n_number, en; ifstream file(filename); if (!file) { LOG(WARNING) << "Can't open cdb file " << filename; @@ -271,11 +247,6 @@ bool readCdbFile(std::string filename, MeshData& md) { std::unordered_map apdlParameters; - // current element type number. We keep the current element type number while proceed the apld - // file. Currently, this info is not used, but in the past it was used to determine element type - // while parsing EBLOCK blocks. - uint32 type = 0; - Tokenizer t; // do not convert tokens to lower symbols t.tolower = false; @@ -311,27 +282,17 @@ bool readCdbFile(std::string filename, MeshData& md) { stolower(strim(line)); std::regex re(R"(\((\d+)i(\d+),(\d+)e(\d+)\.[0-9e]+\))"); std::smatch match; - int int_num; - int int_field; - int float_num; - int float_field; - if (std::regex_match(line, match, re)) { - int_num = std::stoi(match[1]); - int_field = std::stoi(match[2]); - float_num = std::stoi(match[3]); - float_field = std::stoi(match[4]); - } else { + if (!std::regex_match(line, match, re)) { LOG(FATAL) << "Don't understand nblock format string \"" << line << "\""; } + size_t const int_num = std::stoi(match[1]); + size_t const int_field = std::stoi(match[2]); + size_t const float_num = std::stoi(match[3]); + size_t const float_field = std::stoi(match[4]); // prepare array of field widths - std::vector widths; - for (int i = 0; i < int_num; i++) { - widths.push_back(int_field); - } - for (int i = 0; i < float_num; i++) { - widths.push_back(float_field); - } + std::vector widths(int_num, int_field);; + widths.insert(widths.end(), float_num, float_field); // read nodes info line by line while(!getLine(file, line).eof()) { @@ -390,20 +351,14 @@ bool readCdbFile(std::string filename, MeshData& md) { stolower(strim(line)); std::regex re(R"(\((\d+)i(\d+)\))"); std::smatch match; - int int_num; - int int_field; - if (std::regex_match(line, match, re)) { - int_num = std::stoi(match[1]); - int_field = std::stoi(match[2]); - } else { + if (!std::regex_match(line, match, re)) { LOG(FATAL) << "Don't understand eblock format string \"" << line << "\""; } + size_t const int_num = std::stoi(match[1]); + size_t const int_field = std::stoi(match[2]); // prepare array of field widths - std::vector widths; - for (int i = 0; i < int_num; i++) { - widths.push_back(int_field); - } + std::vector widths(int_num, int_field); // read element data line by line while(!getLine(file, line).eof()) { // check for the end of element table @@ -450,7 +405,7 @@ bool readCdbFile(std::string filename, MeshData& md) { LOG(FATAL) << "Not enought fields to read element nodes"; } // parse element nodes - for (int i = 0; i < nNodes; i++) { + for (uint32 i = 0; i < nNodes; i++) { enodes.push_back(static_cast(std::stoi(v[st + i]))); } @@ -495,7 +450,6 @@ bool readCdbFile(std::string filename, MeshData& md) { while (n_terms > 0) { getLine(file, line); t.tokenize(line); - uint16 place = 6; for (int i = 0; i < std::max(n_terms, 2); i++) { uint32 node = t.tokenInt(3 + 3 * i + 0); Dof::dofType dof = Dof::label2dofType(t.tokens[3 + 3 * i + 1]); @@ -527,19 +481,13 @@ bool readCdbFile(std::string filename, MeshData& md) { stolower(strim(line)); std::regex re(R"(\((\d+)i(\d+)\))"); std::smatch match; - int int_num; - int int_field; - if (std::regex_match(line, match, re)) { - int_num = std::stoi(match[1]); - int_field = std::stoi(match[2]); - } else { + if (!std::regex_match(line, match, re)) { LOG(FATAL) << "Don't understand CMBLOCK format string \"" << line << "\""; } + size_t const int_num = std::stoi(match[1]); + size_t const int_field = std::stoi(match[2]); // prepare array of field widths - std::vector widths; - for (int i = 0; i < int_num; i++) { - widths.push_back(int_field); - } + std::vector widths(int_num, int_field);; uint16 in_row = 0; uint16 all = 0; @@ -586,29 +534,6 @@ bool readCdbFile(std::string filename, MeshData& md) { md.feComps.insert(std::make_pair(comp.name, comp)); } } //CMBLOCK - else if (iequals(t.tokens[0], "ET") || iequals(t.tokens[0], "ETYPE")) { - // Keep a track on last ET command.. We need this info to know element type. - // If we can convert ET argument into int, then we try to find the APDL parameter in - // apdlParameters dictionary. If it's not there - adpParameters will return new zero value. - // That means, that if parameter is not declared(somehow..) we just put type = 0 - // NOTE: in current implementation type value is not used, but it could be used again in the - // future. - try { - type = t.tokenInt(1); - } catch (const std::invalid_argument& ia) { - type = static_cast(apdlParameters[t.tokens[1]]); - } - } // ETYPE - else if (iequals(t.tokens[0], "TYPE")) { - // Keep the track on last TYPE command.. We need this info to know element type. - // NOTE: in current implementation type value is not used, but it could be used again in the - // future. - try { - type = t.tokenInt(1); - } catch (const std::invalid_argument& ia) { - type = 0; - } - } // ETYPE else if (iequals(t.tokens[0], "F")) { // Dof force record //f,42,heat,800000. diff --git a/src/FEReaders.h b/src/FEReaders.h index 0e07f3c..d5ae0cb 100644 --- a/src/FEReaders.h +++ b/src/FEReaders.h @@ -67,8 +67,28 @@ std::string& stoupper(std::string& str); // split `line` to substrings with `widths` lengths, if `strict` is false then last substrings could // be missed -std::vector ssplit(const std::string& line, const std::vector& widths, - bool strict = true); +template +std::vector ssplit(std::string const& line, CONT const& widths, bool strict = true) { + size_t ind = 0; + std::vector vv; + for (auto const& w : widths) { + if (line.length() < w + ind) { + // no room for another field + if (strict) { + LOG(FATAL) << "ssplit: incomplete line: \"" << line << "\""; + } else { + if (line.length() - ind != 0) { + LOG(FATAL) << "ssplit: incomplete field: \"" << line << "\""; + } + return vv; + } + } + vv.push_back(line.substr(ind, w)); + ind += w; + } + return vv; +} + // case insensitive string comparison bool iequals(const string& a, const string& b); diff --git a/src/lib/FESolver.cpp b/src/lib/FESolver.cpp index 148e005..9ac800f 100644 --- a/src/lib/FESolver.cpp +++ b/src/lib/FESolver.cpp @@ -130,10 +130,11 @@ FESolver::~FESolver() { void FESolver::attachFEStorage(FEStorage *st) { + CHECK_NOTNULL(st); if (storage) { LOG(WARNING) << "FEStorage already is attached. The old one will be dropped."; } - storage = CHECK_NOTNULL(st); + storage = st; } @@ -166,10 +167,11 @@ void FESolver::deletePostProcessors() { void FESolver::attachEquationSolver(math::EquationSolver *eq) { + CHECK_NOTNULL(eq); if (eqSolver) { LOG(WARNING) << "EquationSolver already is attached. The old one will be dropped."; } - eqSolver = CHECK_NOTNULL(eq); + eqSolver = eq; } void FESolver::initSolutionData() { diff --git a/src/lib/FEStorage.cpp b/src/lib/FEStorage.cpp index 211a983..9d4ebd8 100644 --- a/src/lib/FEStorage.cpp +++ b/src/lib/FEStorage.cpp @@ -9,10 +9,6 @@ namespace nla3d { using namespace math; -FEStorage::FEStorage() { -}; - - FEStorage::~FEStorage () { if (material) { delete material; @@ -533,7 +529,6 @@ void FEStorage::initSolutionData () { // register MPC coefficients for (auto mpc : mpcs) { assert(mpc->eq.size()); - uint32 eq_num = mpc->eqNum; for (auto term : mpc->eq) { uint32 eq_j = getNodeDofEqNumber(term.node, term.node_dof); addEntryMPC(mpc->eqNum, eq_j); diff --git a/src/lib/FEStorage.h b/src/lib/FEStorage.h index 79f23f1..bc9bb2f 100755 --- a/src/lib/FEStorage.h +++ b/src/lib/FEStorage.h @@ -37,7 +37,6 @@ class ElementFactory; // should start from 1 and up to nElements()/nNodes(). class FEStorage { public: - FEStorage(); ~FEStorage(); // A pointer to Material instance. nla3d supports only one material for FE model. External code diff --git a/src/lib/Mpc.cpp b/src/lib/Mpc.cpp index 2d48436..c0674cc 100644 --- a/src/lib/Mpc.cpp +++ b/src/lib/Mpc.cpp @@ -41,10 +41,6 @@ void MpcCollection::printEquations (std::ostream& out) { } } -RigidBodyMpc::RigidBodyMpc () { - -} - RigidBodyMpc::~RigidBodyMpc () { collection.clear(); } @@ -120,7 +116,7 @@ void RigidBodyMpc::update () { // drivatives for C matrix for i row (with respect to j and l) Mat<3,3> cDeriv; for (size_t d = 0; d < dofs.size(); d++) { - uint16 i; + uint16 i = 0; switch (dofs[d]) { case Dof::UX: i = 0; diff --git a/src/lib/Mpc.h b/src/lib/Mpc.h index 22c4a5b..cc2e09c 100644 --- a/src/lib/Mpc.h +++ b/src/lib/Mpc.h @@ -39,6 +39,7 @@ class Mpc { class MpcCollection { public: + virtual ~MpcCollection() { } virtual void update() = 0; virtual void pre() = 0; void printEquations(std::ostream& out); @@ -50,9 +51,8 @@ class MpcCollection { class RigidBodyMpc : public MpcCollection { public: - RigidBodyMpc(); ~RigidBodyMpc(); - uint32 masterNode; + uint32 masterNode = 0; void pre (); void update (); @@ -74,8 +74,7 @@ class fixBC { class loadBC { public: - loadBC () : node(0), node_dof(Dof::UNDEFINED), value(0.0) - { } + loadBC () { } loadBC (int32 n, Dof::dofType dof, double val = 0.0) : node(n), node_dof(dof), value(val) { } int32 node = 0; diff --git a/src/lib/PostProcessor.h b/src/lib/PostProcessor.h index 3ad5b30..0add1cc 100755 --- a/src/lib/PostProcessor.h +++ b/src/lib/PostProcessor.h @@ -15,7 +15,7 @@ class FESolver; class PostProcessor { public: PostProcessor(FEStorage *st); - ~PostProcessor() { }; + virtual ~PostProcessor() { }; virtual void pre ()=0; virtual void process (uint16 curLoadstep)=0; virtual void post (uint16 curLoadstep)=0; diff --git a/src/lib/VtkProcessor.cpp b/src/lib/VtkProcessor.cpp index 4dacf72..351bff4 100755 --- a/src/lib/VtkProcessor.cpp +++ b/src/lib/VtkProcessor.cpp @@ -75,10 +75,12 @@ void VtkProcessor::writeAllResults(bool write) { bool VtkProcessor::registerResults(std::initializer_list queries) { +#if not defined (NDEBUG) // check that each query is valid - for(auto v : queries) { + for(auto const& v : queries) { assert(v > scalarQuery::UNDEF && v < scalarQuery::LAST); } +#endif cellScalarQueries.insert(queries); return true; @@ -86,10 +88,12 @@ bool VtkProcessor::registerResults(std::initializer_list queries) { bool VtkProcessor::registerResults(std::initializer_list queries) { +#if not defined (NDEBUG) // check that each query is valid - for(auto v : queries) { + for(auto const& v : queries) { assert(v > vectorQuery::UNDEF && v < vectorQuery::LAST); } +#endif cellVectorQueries.insert(queries); return true; @@ -97,10 +101,12 @@ bool VtkProcessor::registerResults(std::initializer_list queries) { bool VtkProcessor::registerResults(std::initializer_list queries) { +#if not defined (NDEBUG) // check that each query is valid - for(auto v : queries) { + for(auto const& v : queries) { assert(v > tensorQuery::UNDEF && v < tensorQuery::LAST); } +#endif cellTensorQueries.insert(queries); return true; diff --git a/src/lib/elements/SOLID81.cpp b/src/lib/elements/SOLID81.cpp index a3130f4..fe72674 100644 --- a/src/lib/elements/SOLID81.cpp +++ b/src/lib/elements/SOLID81.cpp @@ -34,7 +34,8 @@ void ElementSOLID81::buildK() { Vec<24> Kup; Vec<24> Fu; //вектор узловых сил элемента Vec<24> F_ext; //вектор внешних сил (пока не подсчитывается) - Mat_Hyper_Isotrop_General* mat = CHECK_NOTNULL( dynamic_cast (storage->getMaterial())); + Mat_Hyper_Isotrop_General* mat = dynamic_cast (storage->getMaterial()); + CHECK_NOTNULL(mat); double k = mat->getK(); MatSym<6> matD_d; Vec<6> vecD_p; @@ -95,7 +96,8 @@ void ElementSOLID81::update() Vec<6> vecC; double p_e = storage->getElementDofSolution(getElNum(), Dof::HYDRO_PRESSURE); - Mat_Hyper_Isotrop_General* mat = CHECK_NOTNULL(dynamic_cast (storage->getMaterial())); + Mat_Hyper_Isotrop_General* mat = dynamic_cast (storage->getMaterial()); + CHECK_NOTNULL(mat); for (uint16 np = 0; np < nOfIntPoints(); np++) { B_NL.zero(); make_B_NL(np, B_NL); @@ -217,13 +219,15 @@ bool ElementSOLID81::getScalar(double* scalar, scalarQuery query, uint16 gp, con case scalarQuery::WU: getVector(&tmp, vectorQuery::IC, gp, 1.0); - mat = CHECK_NOTNULL(dynamic_cast(storage->getMaterial())); + mat = dynamic_cast(storage->getMaterial()); + CHECK_NOTNULL(mat); *scalar += mat->W(tmp[0], tmp[1], tmp[2]) * scale; return true; case scalarQuery::WP: J = solidmech::J_C(C[gp].ptr()); - mat = CHECK_NOTNULL(dynamic_cast(storage->getMaterial())); + mat = dynamic_cast(storage->getMaterial()); + CHECK_NOTNULL(mat); *scalar += 0.5 * mat->getK() * (J - 1.0) * (J - 1.0) * scale; return true; diff --git a/src/lib/elements/isoparametric.cpp b/src/lib/elements/isoparametric.cpp index 5c527e3..1368982 100644 --- a/src/lib/elements/isoparametric.cpp +++ b/src/lib/elements/isoparametric.cpp @@ -11,9 +11,6 @@ namespace nla3d { void ElementIsoParamLINE::makeJacob() { - const uint16 dim = 2; - const uint16 nodes_num = 4; - // bound user-provided intOrder intOrder = (intOrder < 1) ? 1 : intOrder; intOrder = (intOrder > 3) ? 3 : intOrder; @@ -71,8 +68,6 @@ void ElementIsoParamQUAD::makeJacob() { NiXj.clear(); NiXj.resize(_np_quad[i_int]); - double inv_det; - math::Mat dN; // form function derivatives math::Mat J; @@ -94,7 +89,6 @@ void ElementIsoParamQUAD::makeJacob() { // check for geometry form error LOG_IF(det[np] < 1.0e-20, ERROR) << "Determinant is too small (" << det[np] << ") in element = " << elNum; // обращение матрицы Якоби - inv_det = 1.0/det[np]; Jacob = J.inv(det[np]); // производные функций формы по глоб. координатам @@ -154,8 +148,6 @@ void ElementIsoParamHEXAHEDRON::makeJacob() { NiXj.clear(); NiXj.resize(_np_hexahedron[i_int]); - double inv_det; - math::Mat dN; // form function derivatives math::Mat J; @@ -176,7 +168,6 @@ void ElementIsoParamHEXAHEDRON::makeJacob() { // check for geometry form error LOG_IF(det[np] < 1.0e-20, ERROR) << "Determinant is too small (" << det[np] << ") in element = " << elNum; // обращение матрицы Якоби - inv_det = 1.0/det[np]; Jacob = J.inv(det[np]); // производные функций формы по глоб. координатам diff --git a/src/lib/materials/material.cpp b/src/lib/materials/material.cpp index bf31414..080db88 100755 --- a/src/lib/materials/material.cpp +++ b/src/lib/materials/material.cpp @@ -28,14 +28,15 @@ std::string Material::toString() { } double& Material::Ci (const std::string& nameConst) { - for (size_t i = 0; i < getNumC(); i++) { + size_t i = 0; + for (; i < getNumC(); i++) { if (nameConst.compare(MC_names[i]) == 0) { - return MC[i]; + break; } } - LOG(ERROR) << "Dan't find a material constant with name " << nameConst; - double dummy; - return dummy; + if (i == getNumC()) + LOG(ERROR) << "Can't find a material constant with name " << nameConst; + return MC[i]; } diff --git a/src/lib/materials/material.h b/src/lib/materials/material.h index c8b0d00..c96e2d5 100755 --- a/src/lib/materials/material.h +++ b/src/lib/materials/material.h @@ -14,10 +14,9 @@ class MaterialFactory; // Material must have named material constants class Material { public: - Material () : MC(NULL), numC(0), code(0) { - } + Material() { } Material (uint16 num_c); - ~Material() // TODO: discover the virtual destructor + virtual ~Material() { if (MC) delete[] MC; MC = NULL; @@ -37,10 +36,10 @@ class Material { friend class MaterialFactory; protected: void register_mat_const(uint16 num, ...); - double* MC; + double* MC = nullptr; std::vector MC_names; - uint16 numC; - uint16 code; + uint16 numC = 0; + uint16 code = 0; std::string name; }; diff --git a/src/lib/materials/materials_hyperelastic.cpp b/src/lib/materials/materials_hyperelastic.cpp index 443ee8a..b648682 100644 --- a/src/lib/materials/materials_hyperelastic.cpp +++ b/src/lib/materials/materials_hyperelastic.cpp @@ -38,7 +38,6 @@ void Mat_Hyper_Isotrop_General::getS_UP (uint16 ncomp, const solidmech::tensorC double J = IC[2]; - double oo = 1.0/(J*J); double pp = pow(J,-2.0/3.0); double pppp = pp*pp; diff --git a/src/lib/math/EquationSolver.cpp b/src/lib/math/EquationSolver.cpp index d0e8e43..bd3cfce 100644 --- a/src/lib/math/EquationSolver.cpp +++ b/src/lib/math/EquationSolver.cpp @@ -74,6 +74,7 @@ bool GaussDenseEquationSolver::_solve(double* X, double* A, // We are trying eliminate the term in column i, for rows i+1 and // greater. First, find a pivot (between rows i and N-1). max = 0; + imax = i; for(ip = i; ip < n; ip++) { //if(ffabs(A[ip][i]) > max) { if(fabs(A[ip*n+i]) > max) { diff --git a/src/lib/math/Mat.h b/src/lib/math/Mat.h index cbb128e..606d5f4 100755 --- a/src/lib/math/Mat.h +++ b/src/lib/math/Mat.h @@ -401,8 +401,6 @@ class dMat; class dMat_interface { public: - dMat_interface ():ptr(NULL),M(0),N(0),row(0) - { } double& operator[] (uint16 col) { assert(ptr); @@ -410,18 +408,26 @@ class dMat_interface assert (row < M); return ptr[row*N + col]; } + double operator[] (uint16 col) const + { + assert(ptr); + assert (col < N); + assert (row < M); + return ptr[row*N + col]; + } friend class dMat; private: - uint16 M, N; - uint32 row; - double *ptr; + uint16 M = 0; + uint16 N = 0; + uint32 row = 0; + double *ptr = nullptr; }; //dynamic matrix to pass arbitrary matrix to functions as arguments class dMat { public: - dMat(uint16 dim_m, uint16 dim_n) : dimM(0),dimN(0),data(NULL) + dMat(uint16 dim_m, uint16 dim_n) { if (dim_m && dim_n) resize(dim_m, dim_n); @@ -470,7 +476,7 @@ class dMat ~dMat() { if (data) delete[] data; - data = NULL; + data = nullptr; } void zero () @@ -504,9 +510,9 @@ class dMat friend std::ostream& operator<< (std::ostream& stream, dMat &obj); private: - uint16 dimM; - uint16 dimN; - double *data; + uint16 dimM = 0; + uint16 dimN = 0; + double *data = nullptr; dMat_interface dmat_int; }; diff --git a/src/lib/math/SparseMatrix.cpp b/src/lib/math/SparseMatrix.cpp index bf851ff..d955ccd 100755 --- a/src/lib/math/SparseMatrix.cpp +++ b/src/lib/math/SparseMatrix.cpp @@ -381,7 +381,6 @@ void SparseMatrix::print(std::ostream& out) { assert(si->compressed); assert(values); - uint32 ind; for (uint32 i = 1; i <= si->nRows; i++) { out << "["; for (uint32 j = 1; j <= si->nColumns; j++) { @@ -453,7 +452,6 @@ void SparseSymMatrix::print(std::ostream& out) { assert(si->compressed); assert(values); - uint32 ind; for (uint32 i = 1; i <= si->nRows; i++) { // out << "["; for (uint32 j = 1; j <= si->nColumns; j++) { diff --git a/src/lib/sys.h b/src/lib/sys.h index cdabc52..4d63a12 100755 --- a/src/lib/sys.h +++ b/src/lib/sys.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -40,11 +39,6 @@ #define sprintf_s snprintf #endif -// TODO: -// for some reasons CHECK_NOTNULL from easylogging++ doesn't work on Apple's clang and g++ -#undef CHECK_NOTNULL -#define CHECK_NOTNULL(x) x - // usefull macros to check floats with threshold #define CHECK_EQTH(a, b, th) CHECK(fabs(a-b) < th) diff --git a/src/main.cpp b/src/main.cpp index 1bd3758..8ef0907 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,7 @@ namespace options { uint32 rigidBodyMasterNode = 0; std::string rigidBodySlavesComponent = ""; std::vector rigidBodyDofs; -}; +} bool parse_args (int argc, char* argv[]) { if (argc < 2) { @@ -170,7 +170,8 @@ int main (int argc, char* argv[]) { } md.compressNumbers(); - Material* mat = CHECK_NOTNULL (MaterialFactory::createMaterial(options::materialName)); + Material* mat = MaterialFactory::createMaterial(options::materialName); + CHECK_NOTNULL(mat); if (mat->getNumC() != options::materialConstants.size()) LOG(ERROR) << "Material " << options::materialName << " needs exactly " << mat->getNumC() << " constants (" << options::materialConstants.size() << " were provided)"; @@ -298,7 +299,7 @@ int main (int argc, char* argv[]) { ss << '\t' << Dof::dofTypeLabels[reactProc->dofs[d]]; } ss << std::endl; - for (size_t ls = 0; ls < options::numberOfLoadsteps+1; ls++) { + for (uint16 ls = 0; ls < options::numberOfLoadsteps+1; ls++) { ss << ls; for (size_t d = 0; d < reactProc->dofs.size(); d++) { ss << '\t' << reactProc->getReactions(reactProc->dofs[d])[ls]; diff --git a/test/QUADTH_transient.cpp b/test/QUADTH_transient.cpp index df8e152..15dd6ed 100644 --- a/test/QUADTH_transient.cpp +++ b/test/QUADTH_transient.cpp @@ -186,7 +186,6 @@ std::vector readTempData (std::string fileRefCurve) { if (!file.is_open()) { return res; } - double tmp; std::string line; // skip first line getLine(file, line); diff --git a/test/TETRA0_test.cpp b/test/TETRA0_test.cpp index 0a4fdaf..e425862 100644 --- a/test/TETRA0_test.cpp +++ b/test/TETRA0_test.cpp @@ -141,7 +141,7 @@ stress_vec_t readStressData (std::string filename) { if (!file.is_open()) { return stress_vec; } - double tmp, sx, sy, sz, sxy, syz, sxz; + double tmp; // file format: // elem SX SY SZ SXY SYZ SXZ // 1. 0.28688422E+02 0.90668364E+01 0.11326577E+02 0.65410609E-01 -0.36082213E+01 -0.19945953E+01