Skip to content
Snippets Groups Projects
Commit 5704cb49 authored by Karsten Rink's avatar Karsten Rink
Browse files

changing the sequence in which rasters are read for tet meshes from low to high

parent 70dbc9db
No related branches found
No related tags found
No related merge requests found
......@@ -217,15 +217,13 @@ MeshLib::Mesh* MeshLayerEditDialog::createTetMesh()
MeshLib::Mesh* tg_mesh (nullptr);
if (_use_rasters)
{
std::vector<std::string> raster_paths(nLayers+1);
std::vector<std::string> raster_paths;
for (int i=nLayers; i>=0; --i)
raster_paths[i] = this->_edits[i]->text().toStdString();
raster_paths.push_back(this->_edits[i]->text().toStdString());
LayeredVolume lv;
lv.createLayers(*_msh, raster_paths);
if (lv.createLayers(*_msh, raster_paths))
tg_mesh = lv.getMesh("SubsurfaceMesh");
tg_mesh = lv.getMesh("SubsurfaceMesh");
QString file_path("");
if (tg_mesh)
{
std::vector<MeshLib::Node> tg_attr (lv.getAttributePoints());
......
......@@ -56,7 +56,7 @@ MeshLib::Mesh* LayeredMeshGenerator::getMesh(std::string const& mesh_name) const
return result;
}
double LayeredMeshGenerator::calcEpsilon(GeoLib::Raster const& high, GeoLib::Raster const& low)
double LayeredMeshGenerator::calcEpsilon(GeoLib::Raster const& low, GeoLib::Raster const& high)
{
const double max (*std::max_element(high.begin(), high.end()));
const double min (*std::min_element( low.begin(), low.end()));
......
......@@ -80,7 +80,7 @@ protected:
double minimum_thickness = std::numeric_limits<double>::epsilon()) const;
/// Calculates a data-dependent epsilon value
double calcEpsilon(GeoLib::Raster const& high, GeoLib::Raster const& low);
double calcEpsilon(GeoLib::Raster const& low, GeoLib::Raster const& high);
/// Checks if all raster files actually exist
bool allRastersExist(std::vector<std::string> const& raster_paths) const;
......
......@@ -41,11 +41,11 @@ bool LayeredVolume::createRasterLayers(const MeshLib::Mesh &mesh, const std::vec
if (top==nullptr)
top = new MeshLib::Mesh(mesh);
if (!MeshLayerMapper::layerMapping(*top, *rasters[0], noDataReplacementValue))
if (!MeshLayerMapper::layerMapping(*top, *rasters.back(), noDataReplacementValue))
return false;
MeshLib::Mesh* bottom (new MeshLib::Mesh(*top));
if (!MeshLayerMapper::layerMapping(*bottom, *rasters.back(), 0))
if (!MeshLayerMapper::layerMapping(*bottom, *rasters[0], 0))
{
delete top;
return false;
......
......@@ -156,7 +156,7 @@ void MeshLayerMapper::addLayerToMesh(const MeshLib::Mesh &dem_mesh, unsigned lay
// add nodes for new layer
for (std::size_t i=0; i<nNodes; ++i)
_nodes.push_back(getNewLayerNode(*nodes[i], *_nodes[last_layer_node_offset + i], raster, _nodes.size()));
_nodes.push_back(getNewLayerNode(*nodes[i], *_nodes[last_layer_node_offset + i], raster, _nodes.size(), _elevation_epsilon));
std::vector<MeshLib::Element*> const& elems = dem_mesh.getElements();
std::size_t const nElems (dem_mesh.getNElements());
......
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