diff --git a/include/scalfmm/tools/fma_loader.hpp b/include/scalfmm/tools/fma_loader.hpp index 136c937301b5b4b2d2e258cdec1f79b21a23ae42..6021822b1a0af9494da72d394c66d65ee1fdc339 100644 --- a/include/scalfmm/tools/fma_loader.hpp +++ b/include/scalfmm/tools/fma_loader.hpp @@ -398,12 +398,6 @@ namespace scalfmm::io this->readAscciHeader(nbval); } - if(Dimension < m_typeData[2]) - { - std::cerr << "Wrong dimension. Template parameter is " << Dimension << " and dimension in file is " - << m_typeData[2] << ".\n"; - } - if(m_verbose) { std::cout << " nbParticles: " << this->m_nbParticles << std::endl @@ -439,6 +433,12 @@ namespace scalfmm::io m_typeData[2] = 3; m_typeData[3] = 1; } + if(Dimension != m_typeData[2]) + { + std::cerr << "Wrong dimension. Template parameter is " << Dimension << " and dimension in file is " + << m_typeData[2] << ".\n"; + throw std::invalid_argument("Use argument -d to set the right dimension !"); + } (*this->m_file) >> this->m_nbParticles >> this->m_boxWidth; if(m_verbose) { @@ -474,7 +474,12 @@ namespace scalfmm::io m_typeData[2] = 3; m_typeData[3] = 1; } - + if(Dimension != m_typeData[2]) + { + std::cerr << "Wrong dimension. Template parameter is " << Dimension << " and dimension in file is " + << m_typeData[2] << ".\n"; + throw std::invalid_argument("Use argument -d to set the right dimension !"); + } if(m_typeData[0] != sizeof(FReal)) { std::cerr << "readBinaryHeader: Size of elements in part file " << m_typeData[0]