Skip to content
Snippets Groups Projects
Commit abab97dc authored by Lars Bilke's avatar Lars Bilke
Browse files

Merge branch 'AddLayerToMesh' into 'master'

Rename AddTopLayer to AddLayer

See merge request ogs/ogs!3015
parents 75bca07c b8e653e0
No related branches found
No related tags found
No related merge requests found
/*
* \date 2015-04-14
* \brief Adds a top layer to an existing mesh.
* \file
* \brief Adds a layer to an existing mesh.
*
* \copyright
* Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
......@@ -23,9 +23,9 @@
int main (int argc, char* argv[])
{
TCLAP::CmdLine cmd(
"Adds a top layer to an existing mesh"
"Adds a layer to an existing mesh."
"The documentation is available at "
"https://docs.opengeosys.org/docs/tools/meshing/addtoplayer.\n\n"
"https://docs.opengeosys.org/docs/tools/meshing/addlayer.\n\n"
"OpenGeoSys-6 software, version " +
GitInfoLib::GitInfo::ogs_version +
".\n"
......@@ -46,13 +46,19 @@ int main (int argc, char* argv[])
"the thickness of the new layer", false, 10, "floating point value");
cmd.add(layer_thickness_arg);
TCLAP::ValueArg<bool> copy_material_ids_arg(
"", "copy_material_ids",
"copy the existing material distribution of the layer which is to "
"be extented ",
false, false,
"bool value: either true for copying or false for adding new "
"material ID");
TCLAP::SwitchArg layer_position_arg(
"", "add-layer-on-bottom",
"Per default the layer is add on the top, if this argument is set the "
"layer is add on the bottom.",
true);
cmd.add(layer_position_arg);
TCLAP::SwitchArg copy_material_ids_arg(
"", "copy-material-ids",
"Copy the existing material distribution of the layer which is to be "
"extented. If the switch isn't given a new material id will be "
"created.",
false);
cmd.add(copy_material_ids_arg);
cmd.parse(argc, argv);
......@@ -66,11 +72,12 @@ int main (int argc, char* argv[])
}
INFO("done.");
std::unique_ptr<MeshLib::Mesh> result(MeshLib::addTopLayerToMesh(
std::unique_ptr<MeshLib::Mesh> result(MeshLib::addLayerToMesh(
*subsfc_mesh, layer_thickness_arg.getValue(), mesh_out_arg.getValue(),
copy_material_ids_arg.getValue()));
if (!result) {
ERR("Failure while adding top layer.");
layer_position_arg.getValue(), copy_material_ids_arg.getValue()));
if (!result)
{
ERR("Failure while adding layer.");
return EXIT_FAILURE;
}
......
set(TOOLS
AddTopLayer
AddLayer
appendLinesAlongPolyline
checkMesh
convertToLinearMesh
......
......@@ -83,14 +83,6 @@ MeshLib::Element* extrudeElement(std::vector<MeshLib::Node*> const& subsfc_nodes
return nullptr;
}
MeshLib::Mesh* addTopLayerToMesh(MeshLib::Mesh const& mesh,
double thickness,
std::string const& name,
bool copy_material_ids)
{
return addLayerToMesh(mesh, thickness, name, true, copy_material_ids);
}
MeshLib::Mesh* addLayerToMesh(MeshLib::Mesh const& mesh, double thickness,
std::string const& name, bool on_top,
bool copy_material_ids)
......
......@@ -24,12 +24,6 @@ class Mesh;
class Node;
class Element;
/// Adds a layer on top of the mesh
MeshLib::Mesh* addTopLayerToMesh(MeshLib::Mesh const& mesh,
double thickness,
std::string const& name,
bool copy_material_ids);
/// Adds a layer to the mesh. If on_top is true, the layer is added on top,
/// if it is false, the layer is added at the bottom.
MeshLib::Mesh* addLayerToMesh(MeshLib::Mesh const& mesh, double thickness,
......
......@@ -591,8 +591,8 @@ Mesh* MeshGenerator::generateRegularPrismMesh(
bool const copy_material_ids = false;
for (std::size_t i = 0; i < n_z_cells; ++i)
{
mesh.reset(MeshLib::addTopLayerToMesh(*mesh, cell_size_z, mesh_name,
copy_material_ids));
mesh.reset(MeshLib::addLayerToMesh(*mesh, cell_size_z, mesh_name, true,
copy_material_ids));
}
std::vector<std::size_t> elem_ids (n_tris);
std::iota(elem_ids.begin(), elem_ids.end(), 0);
......
+++
date = "2018-02-27T11:00:13+01:00"
title = "AddTopLayer"
date = "2020-06-22T11:00:13+01:00"
title = "AddLayer"
author = "Thomas Fischer"
[menu]
[menu.tools]
parent = "meshing"
aliases = [ "/docs/tools/meshing/addtoplayer" ]
+++
## Introduction
The tool `AddTopLayer` adds one layer of elements with a specified thickness `thickness` on top of an existing mesh `input-mesh` and returns the newly generated mesh `output-mesh` that has an new top layer.
The tool `AddLayer` adds one layer of elements with a specified thickness
`thickness` on either on top or bottom of an existing mesh `input-mesh` and
returns the newly generated mesh `output-mesh` that has an new layer.
One might want to take care that the material groups are reduced, eg. material groups should not be [0,2,5], but [0,1,2]. The new layer will have the material group number of the highest material group +1.
One might want to take care that the material groups are reduced, eg. material
groups should not be [0,2,5], but [0,1,2]. The new layer will have the material
group number of the highest material group +1. With the switch
`--copy-material-ids` the MaterialIDs of the extruded layer will be kept.
The tool requires the [OGS-6 node ordering](http://doxygen.opengeosys.org/index.html) in the elements. A different node ordering may lead to unexpected results. In case one might try to change the ordering using the tool `NodeReordering`.
## Usage
```bash
AddTopLayer -i <input-mesh> -o <output-mesh> [-t <thickness>]
AddLayer -i <input-mesh> -o <output-mesh> [-t <thickness>]
```
## Simple example
......@@ -30,7 +37,7 @@ AddTopLayer -i <input-mesh> -o <output-mesh> [-t <thickness>]
Usage for example:
```
AddTopLayer -i quad.vtu -o quad_with_new_top_layer.vtu -t 1
AddLayer -i quad.vtu -o quad_with_new_top_layer.vtu -t 1
```
## Application
......
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