Skip to content

Commit

Permalink
remove compiler warnings, tested with gcc and clang
Browse files Browse the repository at this point in the history
  • Loading branch information
hverhelst committed Feb 28, 2024
1 parent a31dfe6 commit 75ccc7c
Show file tree
Hide file tree
Showing 25 changed files with 76 additions and 101 deletions.
8 changes: 3 additions & 5 deletions examples/biharmonic2_eigenvalue_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ int main(int argc, char *argv[])
if (plot)
{
gsInfo<<"Plotting in Paraview...\n";
int systemRet = system("mkdir -p ModalResults");
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir("ModalResults");

gsParaviewCollection collection("ModalResults/modes");

Expand Down Expand Up @@ -270,16 +269,15 @@ int main(int argc, char *argv[])
omegas.push_back((math::pow(m/1.0,2)+math::pow(n/1.0,2))*math::pow(3.1415926535,2)*math::sqrt(D / (Density * thickness)));

std::sort(omegas.begin(),omegas.end());
GISMO_ENSURE((omegas.size()>=values.rows()),"Too few analytical eigenvalues");
GISMO_ENSURE(((index_t)omegas.size()>=values.rows()),"Too few analytical eigenvalues");
omegas.resize(values.rows());
gsAsVector<> analytical(omegas);



if (write)
{
int systemRet = system("mkdir -p ModalResults");
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir("ModalResults");

gsMatrix<> ratio = values;
ratio.array() /= analytical.array();
Expand Down
12 changes: 4 additions & 8 deletions examples/biharmonic_planar_eigenvalue_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ int main(int argc, char *argv[])
index_t gluingDataDegree = -1;
index_t gluingDataSmoothness = -1;

bool last = false;
bool info = false;
bool cond = false;
bool interpolation = false;

real_t penalty_init = -1.0;
Expand Down Expand Up @@ -536,8 +534,7 @@ int main(int argc, char *argv[])
if (plot)
{
gsInfo<<"Plotting in Paraview...\n";
int systemRet = system("mkdir -p ModalResults");
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir("ModalResults");

gsParaviewCollection collection("ModalResults/modes");

Expand All @@ -550,7 +547,7 @@ int main(int argc, char *argv[])
solVector = vectors.col(m);
std::string fileName = "ModalResults/modes" + util::to_string(m);
ev.writeParaview( u_sol, G, fileName);
for (index_t p = 0; p!=mp.nPatches(); p++)
for (size_t p = 0; p!=mp.nPatches(); p++)
{
fileName = "modes" + util::to_string(m);
collection.addPart(fileName + ".vts",m,"",p);
Expand All @@ -569,16 +566,15 @@ int main(int argc, char *argv[])
omegas.push_back((math::pow(m/1.0,2)+math::pow(n/1.0,2))*math::pow(3.1415926535,2)*math::sqrt(D / (Density * thickness)));

std::sort(omegas.begin(),omegas.end());
GISMO_ENSURE(omegas.size()>=values.rows(),"Too few analytical eigenvalues");
GISMO_ENSURE((index_t)omegas.size()>=values.rows(),"Too few analytical eigenvalues");
omegas.resize(values.rows());
gsAsVector<> analytical(omegas);



if (write)
{
int systemRet = system("mkdir -p ModalResults");
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir("ModalResults");

gsMatrix<> ratio = values;
ratio.array() /= analytical.array();
Expand Down
4 changes: 2 additions & 2 deletions examples/biharmonic_planar_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ int main(int argc, char *argv[])
coefs.resize(coefs.rows()/mp.geoDim(),mp.geoDim());

index_t offset = 0;
for (index_t p = 0; p != geom.nPatches(); p++)
for (size_t p = 0; p != geom.nPatches(); p++)
{
geom.patch(p) = give(*localbasis.basis(p).makeGeometry((coefs.block(offset,0,mapper.patchSize(p),mp.geoDim()))));
offset += mapper.patchSize(p);
Expand Down Expand Up @@ -484,7 +484,7 @@ int main(int argc, char *argv[])
bb2.getMapper().mapToSourceCoefs(targetCoefs,sourceCoefs);
gsDofMapper mapper(dbasis);
index_t offset = 0;
for (index_t p = 0; p != geom0.nPatches(); p++)
for (size_t p = 0; p != geom0.nPatches(); p++)
{
geom.patch(p) = give(*dbasis.basis(p).makeGeometry((sourceCoefs.block(offset,0,mapper.patchSize(p),mp.geoDim()))));
offset += mapper.patchSize(p);
Expand Down
2 changes: 1 addition & 1 deletion examples/biharmonic_surface2_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ int main(int argc, char *argv[])
// Recover manufactured solution
auto u_ex = ev.getVariable(ms, G);
auto grad_u_ex = ev.getVariable(sol1der, G);
auto laplace_u_ex = ev.getVariable(laplace, G);
// auto laplace_u_ex = ev.getVariable(laplace, G);
//! [Problem setup]

#ifdef _OPENMP
Expand Down
6 changes: 3 additions & 3 deletions examples/create_multipatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ int main(int argc, char *argv[])
unsigned maxLvl = 0;
bool THBcheck = false;
gsHTensorBasis<2,real_t> * hbasis;
for (index_t p=0; p!=mp.nPatches(); p++)
for (size_t p=0; p!=mp.nPatches(); p++)
{
if (hbasis = dynamic_cast<gsHTensorBasis<2,real_t> *>(&mp.basis(p)))
if ((hbasis = dynamic_cast<gsHTensorBasis<2,real_t> *>(&mp.basis(p))))
{
maxLvl = std::max(maxLvl,hbasis->maxLevel());
THBcheck = true;
Expand All @@ -124,7 +124,7 @@ int main(int argc, char *argv[])
//
gsTHBSpline<2,real_t> * THBspline;
gsTensorBSpline<2,real_t> bspline;
for (index_t p=0; p!=mp.nPatches(); p++)
for (size_t p=0; p!=mp.nPatches(); p++)
{
if ((THBspline = dynamic_cast<gsTHBSpline<2,real_t> *>(&mp.patch(p))))
{
Expand Down
8 changes: 2 additions & 6 deletions examples/kirchhoff-Love_multipatch_buckling_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ int main(int argc, char *argv[])
index_t numRefine = 2;
index_t degree = 3;
index_t smoothness = 2;
index_t geometry = 1;
index_t method = 0;
index_t nmodes = 10;
index_t mode = 0;
Expand Down Expand Up @@ -222,10 +221,7 @@ int main(int argc, char *argv[])

if (plot)
{
std::string commands = "mkdir -p " + out;
const char *command = commands.c_str();
int systemRet = system(command);
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir(out);
gsWriteParaview(mp,out + "/" + "mp",10,true,false);
}

Expand Down Expand Up @@ -460,7 +456,7 @@ int main(int argc, char *argv[])

std::string fileName = out + "/" + output + util::to_string(m) + "_";
gsWriteParaview<>(solField, fileName, 1000,mesh);
for (index_t p = 0; p!=mp.nPatches(); p++)
for (size_t p = 0; p!=mp.nPatches(); p++)
{
fileName = output + util::to_string(m) + "_";
collection.addTimestep(fileName,p,m,".vts");
Expand Down
22 changes: 9 additions & 13 deletions examples/kirchhoff-Love_multipatch_post-buckling_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ int main(int argc, char *argv[])
bool last = false;
bool info = false;
bool writeMatrix= false;
bool nonlinear = false;
bool SingularPoint = false;
bool quasiNewton = false;
index_t quasiNewtonInt = -1;
index_t numRefine = 2;
index_t degree = 3;
index_t smoothness = 2;
index_t geometry = 1;
index_t method = 0;
std::string input;

Expand Down Expand Up @@ -133,10 +131,7 @@ int main(int argc, char *argv[])
if (method==2 || method==3)
GISMO_ENSURE(degree > 2,"Degree must be larger than 2 for the approx and exact C1 methods, but it is "<<degree);

std::string commands = "mkdir -p " + dirname;
const char *command = commands.c_str();
int systemRet = system(command);
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir(dirname);


if (dL==0)
Expand Down Expand Up @@ -549,7 +544,7 @@ int main(int argc, char *argv[])

std::string fileName = dirname + "/" + output + util::to_string(m) + "_";
gsWriteParaview<>(solField, fileName, 1000,mesh);
for (index_t p = 0; p!=mp.nPatches(); p++)
for (size_t p = 0; p!=mp.nPatches(); p++)
{
fileName = output + util::to_string(m) + "_";
collection.addTimestep(fileName,p,m,".vts");
Expand All @@ -573,9 +568,9 @@ int main(int argc, char *argv[])
gsMatrix<> allCoefs;
gsL2Projection<real_t>::projectFunction(dbasis,mspline,geom,allCoefs);
allCoefs.resize(allCoefs.rows()/3,3);
for (index_t p = 0; p != geom.nPatches(); p++)
for (size_t p = 0; p != geom.nPatches(); p++)
{
for (index_t k=0; k!=mapper.patchSize(p); k++)
for (size_t k=0; k!=mapper.patchSize(p); k++)
{

geom.patch(p).coefs().row(k) += allCoefs.row(mapper.index(k,p));
Expand Down Expand Up @@ -731,7 +726,7 @@ int main(int argc, char *argv[])
{
std::string fileName = dirname + "/" + output + util::to_string(k) + "_";
gsWriteParaview<>(solField, fileName, 1000,mesh);
for (index_t p = 0; p!=mp.nPatches(); p++)
for (size_t p = 0; p!=mp.nPatches(); p++)
{
fileName = output + util::to_string(k) + "_";
collection.addTimestep(fileName,p,k,".vts");
Expand All @@ -747,7 +742,8 @@ int main(int argc, char *argv[])
gsMatrix<> pointResults(mp.geoDim(),refPoints.cols());
for (index_t p=0; p!=refPoints.cols(); p++)
pointResults.col(p) = solField.value(refPoints.col(p),refPatches(0,p));
gsVector<> otherData{arcLength->solutionL()};
gsVector<> otherData(1);
otherData<<arcLength->solutionL();
numWriter.add(pointResults,otherData);
}
}
Expand All @@ -759,7 +755,7 @@ int main(int argc, char *argv[])
assembler.constructStress(def,membraneStresses,stress_type::membrane);
fileName = dirname + "/MembraneStress" + util::to_string(k) + "_";
gsWriteParaview(def,membraneStresses,fileName,1000);
for (index_t p = 0; p!=mp.nPatches(); p++)
for (size_t p = 0; p!=mp.nPatches(); p++)
{
fileName = "MembraneStress" + util::to_string(k) + "_";
membraneStressCollection.addTimestep(fileName,p,k,".vts");
Expand All @@ -771,7 +767,7 @@ int main(int argc, char *argv[])
assembler.constructStress(def,flexuralStresses,stress_type::flexural);
fileName = dirname + "/FlexuralStresses" + util::to_string(k) + "_";
gsWriteParaview(def,flexuralStresses,fileName,1000);
for (index_t p = 0; p!=mp.nPatches(); p++)
for (size_t p = 0; p!=mp.nPatches(); p++)
{
fileName = "FlexuralStress" + util::to_string(k) + "_";
flexuralStressCollection.addTimestep(fileName,p,k,".vts");
Expand Down
11 changes: 3 additions & 8 deletions examples/kirchhoff-Love_multipatch_vibration_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ int main(int argc, char *argv[])
index_t numRefine = 2;
index_t degree = 3;
index_t smoothness = 2;
index_t geometry = 1;
index_t method = 0;
index_t nmodes = 10;
index_t mode = 0;
Expand Down Expand Up @@ -187,12 +186,8 @@ int main(int argc, char *argv[])
}

if (plot || write)
{
std::string commands = "mkdir -p " + out;
const char *command = commands.c_str();
int systemRet = system(command);
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
}
gsFileManager::mkdir(out);

if (plot)
gsWriteParaview(mp,"mp",10,true,false);
// for (size_t p = 0; p!=mp.nPatches(); ++p)
Expand Down Expand Up @@ -419,7 +414,7 @@ int main(int argc, char *argv[])

std::string fileName = dirname + "/" + output + util::to_string(m) + "_";
gsWriteParaview<>(solField, fileName, 1000,mesh);
for (index_t p = 0; p!=geom.nPatches(); p++)
for (size_t p = 0; p!=geom.nPatches(); p++)
{
fileName = output + util::to_string(m) + "_" + std::to_string(p);
collection.addPart(fileName + ".vts",m,"solution",p);
Expand Down
9 changes: 2 additions & 7 deletions examples/kirchhoff-Love_multipatch_vibration_example_XML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,7 @@ int main(int argc, char *argv[])
gsInfo<<"Finished\n";

if (plot || write)
{
std::string commands = "mkdir -p " + out;
const char *command = commands.c_str();
int systemRet = system(command);
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
}
gsFileManager::mkdir(out);

if (plotGeo) gsWriteParaview(geom,"geom",1000,true,false);

Expand Down Expand Up @@ -281,7 +276,7 @@ int main(int argc, char *argv[])

std::string fileName = dirname + "/" + output + util::to_string(m) + "_";
gsWriteParaview<>(solField, fileName, 1000,mesh);
for (index_t p = 0; p!=geom.nPatches(); p++)
for (size_t p = 0; p!=geom.nPatches(); p++)
{
fileName = output + util::to_string(m) + "_" + std::to_string(p);
collection.addPart(fileName + ".vts",m,"solution",p);
Expand Down
8 changes: 2 additions & 6 deletions examples/kirchhoff-Love_weak_multipatch_buckling_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ int main(int argc, char *argv[])
bool mesh = false;
bool first = false;
bool write = false;
bool info = false;
bool dense = false;

index_t numRefine = 2;
Expand Down Expand Up @@ -172,10 +171,7 @@ int main(int argc, char *argv[])

if (plot)
{
std::string commands = "mkdir -p " + out;
const char *command = commands.c_str();
int systemRet = system(command);
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir(out);
gsWriteParaview(mp,out + "/" + "mp",10,true,false);
}

Expand Down Expand Up @@ -325,7 +321,7 @@ int main(int argc, char *argv[])

std::string fileName = out + "/" + output + util::to_string(m) + "_";
gsWriteParaview<>(solField, fileName, 1000,mesh);
for (index_t p = 0; p!=mp.nPatches(); p++)
for (size_t p = 0; p!=mp.nPatches(); p++)
{
fileName = output + util::to_string(m) + "_";
collection.addTimestep(fileName,p,m,".vts");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ int main(int argc, char *argv[])

try { cmd.getValues(argc,argv); } catch (int rv) { return rv; }

std::string commands = "mkdir -p " + dirname;
const char *command = commands.c_str();
int systemRet = system(command);
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir(dirname);


if (dL==0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ int main(int argc, char *argv[])

if (plot)
{
std::string commands = "mkdir -p " + out;
const char *command = commands.c_str();
int systemRet = system(command);
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
gsFileManager::mkdir(out);
gsWriteParaview(mp,out + "/" + "mp",10,true,false);
}

Expand Down
7 changes: 1 addition & 6 deletions examples/strongCoupling_XML_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,7 @@ int main(int argc, char *argv[])
gsInfo<<"Finished\n";

if (plot || write)
{
std::string commands = "mkdir -p " + out;
const char *command = commands.c_str();
int systemRet = system(command);
GISMO_ASSERT(systemRet!=-1,"Something went wrong with calling the system argument");
}
gsFileManager::mkdir(out);

if (plotGeo) gsWriteParaview(geom,"geom",1000,true,false);

Expand Down
2 changes: 1 addition & 1 deletion src/gsAlmostC1.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ typedef typename std::vector<std::tuple<index_t,index_t,T>> sparseEntry_t;
*/
gsAlmostC1(gsMultiPatch<T> const & mp) ;

GISMO_CLONE_FUNCTION(gsAlmostC1)
// GISMO_CLONE_FUNCTION(gsAlmostC1)

~gsAlmostC1();

Expand Down
9 changes: 1 addition & 8 deletions src/gsAlmostC1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,22 +381,15 @@ namespace gismo
totalsize += sizes.at(p);
}

GISMO_ASSERT(totalsize==coefs.rows(),"Sizes do not agree");
GISMO_ENSURE(totalsize==coefs.rows(),"Sizes do not agree");

gsMultiBasis<T> basis(mp);
gsDofMapper tmpMap(basis);
tmpMap.finalize();

index_t offset = 0;
for (size_t p=0; p!=mp.nPatches(); p++) // patches
{
for (index_t k=0; k!=sizes.at(p); k++)
{
mp.patch(p).coefs().row(k) = coefs.row(tmpMap.index(k,p));
}
offset += sizes.at(p);
}

}

/*=====================================================================================
Expand Down

0 comments on commit 75ccc7c

Please sign in to comment.