mirror of
https://github.com/NGSolve/netgen.git
synced 2025-02-03 08:40:33 +05:00
Fix build warnings (found with gcc -Wall)
This commit is contained in:
parent
0c1943c77b
commit
3bfa6c19fa
@ -842,6 +842,9 @@ namespace ngcore
|
||||
NETGEN_INLINE void NothingToDelete ()
|
||||
{
|
||||
mem_to_delete = nullptr;
|
||||
|
||||
// this memory is not managed by the Array anymore, so set the memory usage to 0
|
||||
mt.Free(sizeof(T)*allocsize);
|
||||
}
|
||||
|
||||
/// Change logical size. If necessary, do reallocation. Keeps contents.
|
||||
|
@ -1211,7 +1211,7 @@ namespace netgen
|
||||
PrintMessage (2, "Object ", i, " has ", tams->GetNT(), " triangles");
|
||||
}
|
||||
}
|
||||
catch (exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
cerr << "*************************************************************" << endl
|
||||
<< "**** out of memory problem in CSG visualization ****" << endl
|
||||
|
@ -109,7 +109,7 @@ namespace netgen
|
||||
{
|
||||
void * p = new char [(line.maxsize+5) * elsize];
|
||||
|
||||
if (line.maxsize*elsize)
|
||||
if (line.maxsize && elsize)
|
||||
memcpy (p, line.col, line.maxsize * elsize);
|
||||
delete [] (char*)line.col;
|
||||
|
||||
|
@ -1041,7 +1041,7 @@ namespace netgen
|
||||
build_searchtree);
|
||||
return ind - 1;
|
||||
}
|
||||
catch(NgException e) // quads not implemented curved yet
|
||||
catch(const NgException & e) // quads not implemented curved yet
|
||||
{
|
||||
for (SegmentIndex si = 0; si < mesh->GetNSeg(); si++)
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ namespace netgen
|
||||
in >> name;
|
||||
cout << IM(3) << len << " element are in group " << name << endl;
|
||||
int hi, index;
|
||||
int fdnr, ednr;
|
||||
int fdnr=-1, ednr=-1;
|
||||
|
||||
in >> hi >> index >> hi >> hi;
|
||||
int codim = get<1>(element_map[index]);
|
||||
@ -712,7 +712,7 @@ namespace netgen
|
||||
if(!UserFormatRegister::HaveFormat(format))
|
||||
throw Exception("Unknown format: " + format);
|
||||
|
||||
const auto & entry = UserFormatRegister::Get(format);
|
||||
const auto entry = UserFormatRegister::Get(format);
|
||||
if(!entry.read)
|
||||
throw Exception("Reading format " + format + " is not implemented");
|
||||
|
||||
|
@ -39,7 +39,7 @@ bool WriteUserFormat (const string & format,
|
||||
if(!UserFormatRegister::HaveFormat(format))
|
||||
return true;
|
||||
|
||||
const auto & entry = UserFormatRegister::Get(format);
|
||||
const auto entry = UserFormatRegister::Get(format);
|
||||
if(!entry.write)
|
||||
return true;
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace netgen
|
||||
{
|
||||
data = NULL; height = width = 0;
|
||||
SetSize (m2.Height(), m2.Width());
|
||||
if (Height()*Width())
|
||||
if (Height() && Width())
|
||||
memcpy (data, m2.data, sizeof(double) * (Height() * Width()));
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ namespace netgen
|
||||
|
||||
delete[] data;
|
||||
|
||||
if (h*w)
|
||||
if (h && w)
|
||||
data = new double[h*w];
|
||||
else
|
||||
data = NULL;
|
||||
|
@ -788,9 +788,9 @@ namespace netgen
|
||||
if(fabs(mat.Det()) > 1e-6)
|
||||
break;
|
||||
}
|
||||
int maxpos1;
|
||||
int maxpos2;
|
||||
double val = 0;
|
||||
int maxpos1 = 0;
|
||||
int maxpos2 = 1;
|
||||
double val = ns[0] * ns[1];
|
||||
for (auto i : Range(ns))
|
||||
{
|
||||
for (auto j : Range(i + 1, ns.Size()))
|
||||
|
@ -1066,7 +1066,8 @@ double MeshOptimize3d :: SwapImproveEdge (
|
||||
bad3 += GetLegalPenalty();
|
||||
}
|
||||
|
||||
bool swap2, swap3;
|
||||
bool swap2=false;
|
||||
bool swap3=false;
|
||||
|
||||
if (goal == OPT_CONFORM)
|
||||
{
|
||||
@ -2608,7 +2609,7 @@ double MeshOptimize3d :: SplitImprove2Element (
|
||||
// search for very flat tets, with two disjoint edges nearly crossing, like a rectangle with diagonals
|
||||
int minedge = -1;
|
||||
double mindist = 1e99;
|
||||
double minlam0, minlam1;
|
||||
double minlam0=0, minlam1=0;
|
||||
|
||||
for (int i : Range(3))
|
||||
{
|
||||
|
@ -196,8 +196,8 @@ namespace netgen
|
||||
auto& el = mesh.SurfaceElement(velement);
|
||||
if(el.GetType() == TRIG)
|
||||
{
|
||||
double seg_lam;
|
||||
double lam;
|
||||
double seg_lam=-1;
|
||||
double lam=-1;
|
||||
auto seg = mesh.LineSegment(segs[i]);
|
||||
for(auto k : Range(3))
|
||||
{
|
||||
|
@ -517,7 +517,6 @@ namespace netgen
|
||||
}
|
||||
while (!meshed);
|
||||
|
||||
{
|
||||
PrintMessage (3, "Check subdomain ", domain, " / ", mesh.GetNDomains());
|
||||
|
||||
mesh.FindOpenElements(domain);
|
||||
@ -530,7 +529,6 @@ namespace netgen
|
||||
PrintError ("Surface mesh not consistent");
|
||||
throw NgException ("Stop meshing since surface mesh not consistent");
|
||||
}
|
||||
}
|
||||
RemoveIllegalElements (mesh, domain);
|
||||
ConformToFreeSegments (mesh, domain);
|
||||
}
|
||||
|
@ -175,7 +175,8 @@ namespace netgen
|
||||
}
|
||||
constexpr PointIndex (t_invalid inv) : i(PointIndex::BASE-1) { ; }
|
||||
// PointIndex & operator= (const PointIndex &ai) { i = ai.i; return *this; }
|
||||
constexpr operator int () const { return i; }
|
||||
constexpr operator const int& () const { return i; }
|
||||
explicit constexpr operator int& () { return i; }
|
||||
PointIndex operator++ (int) { PointIndex hi(*this); i++; return hi; }
|
||||
PointIndex operator-- (int) { PointIndex hi(*this); i--; return hi; }
|
||||
PointIndex & operator++ () { i++; return *this; }
|
||||
|
@ -267,7 +267,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
.def(py::init<int>())
|
||||
.def("__repr__", &ToString<PointIndex>)
|
||||
.def("__str__", &ToString<PointIndex>)
|
||||
.def_property_readonly("nr", &PointIndex::operator int)
|
||||
.def_property_readonly("nr", &PointIndex::operator const int&)
|
||||
.def("__eq__" , FunctionPointer( [](PointIndex &self, PointIndex &other)
|
||||
{ return static_cast<int>(self)==static_cast<int>(other); }) )
|
||||
.def("__hash__" , FunctionPointer( [](PointIndex &self ) { return static_cast<int>(self); }) )
|
||||
|
@ -224,7 +224,7 @@ NGCORE_API_EXPORT void ExportSTL(py::module & m)
|
||||
.def("GetVicinity", [] (shared_ptr<STLGeometry> self, int node, int size, string type) {
|
||||
NgArray<int> vic;
|
||||
|
||||
int trig;
|
||||
int trig=-1;
|
||||
if(type == "trig")
|
||||
trig = node;
|
||||
|
||||
|
@ -266,7 +266,7 @@ namespace netgen
|
||||
|
||||
|
||||
}
|
||||
catch (bad_weak_ptr e)
|
||||
catch (const bad_weak_ptr & e)
|
||||
{
|
||||
// cout << "don't have a mesh to visualize" << endl;
|
||||
VisualScene::DrawScene();
|
||||
@ -895,7 +895,7 @@ namespace netgen
|
||||
|
||||
vstimestamp = meshtimestamp;
|
||||
}
|
||||
catch (bad_weak_ptr e)
|
||||
catch (const bad_weak_ptr & e)
|
||||
{
|
||||
PrintMessage (3, "vsmesh::buildscene: don't have a mesh to visualize");
|
||||
VisualScene::BuildScene (zoomall);
|
||||
|
@ -641,7 +641,7 @@ namespace netgen
|
||||
// delete lock;
|
||||
// mem_lock.UnLock();
|
||||
}
|
||||
catch (bad_weak_ptr e)
|
||||
catch (const bad_weak_ptr & e)
|
||||
{
|
||||
// cout << "don't have a mesh to visualize" << endl;
|
||||
VisualScene::DrawScene();
|
||||
@ -1120,7 +1120,7 @@ namespace netgen
|
||||
|
||||
clipplanetimestamp = max2 (vispar.clipping.timestamp, solutiontimestamp);
|
||||
}
|
||||
catch (bad_weak_ptr e)
|
||||
catch (const bad_weak_ptr & e)
|
||||
{
|
||||
PrintMessage (3, "vssolution::buildscene: don't have a mesh to visualize");
|
||||
VisualScene::BuildScene (zoomall);
|
||||
|
10
ng/ngpkg.cpp
10
ng/ngpkg.cpp
@ -194,7 +194,7 @@ namespace netgen
|
||||
if(mesh->GetGeometry())
|
||||
ng_geometry = mesh->GetGeometry();
|
||||
}
|
||||
catch (NgException e)
|
||||
catch (const NgException & e)
|
||||
{
|
||||
PrintMessage (3, e.What());
|
||||
return TCL_ERROR;
|
||||
@ -269,7 +269,7 @@ namespace netgen
|
||||
geometry -> LoadSurfaces(infile);
|
||||
}
|
||||
}
|
||||
catch (NgException e)
|
||||
catch (const NgException & e)
|
||||
{
|
||||
PrintMessage (3, e.What());
|
||||
return TCL_ERROR;
|
||||
@ -551,7 +551,7 @@ namespace netgen
|
||||
}
|
||||
}
|
||||
|
||||
catch (NgException e)
|
||||
catch (const NgException & e)
|
||||
{
|
||||
Tcl_SetResult (interp, const_cast<char*> (e.What().c_str()), TCL_VOLATILE);
|
||||
return TCL_ERROR;
|
||||
@ -582,7 +582,7 @@ namespace netgen
|
||||
{
|
||||
ng_geometry -> Save (string (cfilename));
|
||||
}
|
||||
catch (NgException e)
|
||||
catch (const NgException & e)
|
||||
{
|
||||
Tcl_SetResult (interp, const_cast<char*> (e.What().c_str()), TCL_VOLATILE);
|
||||
return TCL_ERROR;
|
||||
@ -1440,7 +1440,7 @@ namespace netgen
|
||||
PrintMessage (1, "Meshing done, time = ", GetTime(), " sec");
|
||||
}
|
||||
|
||||
catch (NgException e)
|
||||
catch (const NgException & e)
|
||||
{
|
||||
cout << e.What() << endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user