Skip to content
Snippets Groups Projects
Commit c8c086f9 authored by Tom Fischer's avatar Tom Fischer
Browse files

Use more secure constructors.

parent 72c6f703
No related branches found
No related tags found
No related merge requests found
...@@ -65,9 +65,9 @@ void VtkCompositeNodeSelectionFilter::setSelectionArray(const std::vector<unsign ...@@ -65,9 +65,9 @@ void VtkCompositeNodeSelectionFilter::setSelectionArray(const std::vector<unsign
for (unsigned i=0; i<point_indeces.size(); ++i) for (unsigned i=0; i<point_indeces.size(); ++i)
{ {
double * coords = static_cast<vtkDataSetAlgorithm*>(_inputAlgorithm)->GetOutput()->GetPoint(point_indeces[i]); double * coords = static_cast<vtkDataSetAlgorithm*>(_inputAlgorithm)->GetOutput()->GetPoint(point_indeces[i]);
GeoLib::Point* p (new GeoLib::Point(coords)); GeoLib::Point* p (new GeoLib::Point(coords[0], coords[1], coords[2]));
_selection.push_back(p); _selection.push_back(p);
} }
init(); init();
} }
...@@ -51,7 +51,7 @@ void convertMeshNodesToGeometry(std::vector<MeshLib::Node*> const& nodes, ...@@ -51,7 +51,7 @@ void convertMeshNodesToGeometry(std::vector<MeshLib::Node*> const& nodes,
new std::map<std::string, std::size_t>); new std::map<std::string, std::size_t>);
std::size_t cnt(0); std::size_t cnt(0);
for (std::size_t id: node_ids) { for (std::size_t id: node_ids) {
pnts->push_back(new GeoLib::Point(nodes[id]->getCoords())); pnts->push_back(new GeoLib::Point(*(nodes[id]), nodes[id]->getID()));
pnt_names->insert(std::pair<std::string, std::size_t>( pnt_names->insert(std::pair<std::string, std::size_t>(
geo_name+"-PNT-"+std::to_string(cnt), cnt)); geo_name+"-PNT-"+std::to_string(cnt), cnt));
cnt++; cnt++;
......
...@@ -47,7 +47,7 @@ std::vector<bool> markNodesOutSideOfPolygon( ...@@ -47,7 +47,7 @@ std::vector<bool> markNodesOutSideOfPolygon(
// 1 copy all mesh nodes to GeoLib::Points // 1 copy all mesh nodes to GeoLib::Points
std::vector<GeoLib::Point*> rotated_nodes; std::vector<GeoLib::Point*> rotated_nodes;
for (std::size_t j(0); j < nodes.size(); j++) for (std::size_t j(0); j < nodes.size(); j++)
rotated_nodes.push_back(new GeoLib::Point(nodes[j]->getCoords())); rotated_nodes.push_back(new GeoLib::Point(*nodes[j], nodes[j]->getID()));
// 2 rotate the Points // 2 rotate the Points
MathLib::DenseMatrix<double> rot_mat(3,3); MathLib::DenseMatrix<double> rot_mat(3,3);
GeoLib::computeRotationMatrixToXY(normal, rot_mat); GeoLib::computeRotationMatrixToXY(normal, rot_mat);
......
...@@ -52,7 +52,7 @@ void GMSHAdaptiveMeshDensity::init(std::vector<GeoLib::Point const*> const& pnts ...@@ -52,7 +52,7 @@ void GMSHAdaptiveMeshDensity::init(std::vector<GeoLib::Point const*> const& pnts
// *** QuadTree - determining bounding box // *** QuadTree - determining bounding box
DBUG("GMSHAdaptiveMeshDensity::init(): computing axis aligned bounding box (2D) for quadtree."); DBUG("GMSHAdaptiveMeshDensity::init(): computing axis aligned bounding box (2D) for quadtree.");
GeoLib::Point min(pnts[0]->getCoords()), max(pnts[0]->getCoords()); GeoLib::Point min(*pnts[0]), max(*pnts[0]);
std::size_t n_pnts(pnts.size()); std::size_t n_pnts(pnts.size());
for (std::size_t k(1); k<n_pnts; k++) { for (std::size_t k(1); k<n_pnts; k++) {
for (std::size_t j(0); j < 2; j++) for (std::size_t j(0); j < 2; j++)
......
...@@ -70,7 +70,7 @@ bool TetGenInterface::readTetGenGeometry (std::string const& geo_fname, ...@@ -70,7 +70,7 @@ bool TetGenInterface::readTetGenGeometry (std::string const& geo_fname,
points->reserve(nNodes); points->reserve(nNodes);
for (std::size_t k(0); k<nNodes; ++k) for (std::size_t k(0); k<nNodes; ++k)
{ {
points->push_back(new GeoLib::Point(nodes[k]->getCoords())); points->push_back(new GeoLib::Point(*(nodes[k]), nodes[k]->getID()));
delete nodes[k]; delete nodes[k];
} }
std::string geo_name (BaseLib::extractBaseNameWithoutExtension(geo_fname)); std::string geo_name (BaseLib::extractBaseNameWithoutExtension(geo_fname));
......
...@@ -479,7 +479,7 @@ GeoLib::Polygon* createPolygonFromCircle (GeoLib::Point const& middle_pnt, doubl ...@@ -479,7 +479,7 @@ GeoLib::Polygon* createPolygonFromCircle (GeoLib::Point const& middle_pnt, doubl
double angle (2.0 * M_PI / resolution); double angle (2.0 * M_PI / resolution);
for (std::size_t k(0); k < resolution; k++) for (std::size_t k(0); k < resolution; k++)
{ {
GeoLib::Point* pnt (new GeoLib::Point(middle_pnt.getCoords())); GeoLib::Point* pnt(new GeoLib::Point(middle_pnt));
(*pnt)[0] += radius * cos (k * angle); (*pnt)[0] += radius * cos (k * angle);
(*pnt)[1] += radius * sin (k * angle); (*pnt)[1] += radius * sin (k * angle);
pnts.push_back (pnt); pnts.push_back (pnt);
......
...@@ -40,7 +40,7 @@ Station::Station(Point* coords, std::string name) : ...@@ -40,7 +40,7 @@ Station::Station(Point* coords, std::string name) :
{} {}
Station::Station(Station const& src) : Station::Station(Station const& src) :
Point(src.getCoords()), _name(src._name), _type(src._type), Point(src), _name(src._name), _type(src._type),
_station_value(src._station_value), _sensor_data(nullptr) _station_value(src._station_value), _sensor_data(nullptr)
{} {}
......
...@@ -41,7 +41,7 @@ bool convertMeshToGeo(const MeshLib::Mesh &mesh, GeoLib::GEOObjects &geo_objects ...@@ -41,7 +41,7 @@ bool convertMeshToGeo(const MeshLib::Mesh &mesh, GeoLib::GEOObjects &geo_objects
const std::vector<MeshLib::Node*> &nodes = mesh.getNodes(); const std::vector<MeshLib::Node*> &nodes = mesh.getNodes();
for (unsigned i=0; i<nNodes; ++i) for (unsigned i=0; i<nNodes; ++i)
(*points)[i] = new GeoLib::Point(nodes[i]->getCoords()); (*points)[i] = new GeoLib::Point(*nodes[i], nodes[i]->getID());
std::string mesh_name (mesh.getName()); std::string mesh_name (mesh.getName());
geo_objects.addPointVec(points, mesh_name, nullptr, eps); geo_objects.addPointVec(points, mesh_name, nullptr, eps);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment