Commit 737cad9a authored by Stenger, Florian's avatar Stenger, Florian
Browse files

meshconv v3.19

parent 9b8aecee
Software License for meshconv
Copyright (c) 2008-2019 Technische Universität Dresden
Copyright (c) 2008-2020 Technische Universität Dresden
All rights reserved.
Author: Florian Stenger
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -116,9 +116,9 @@ void box_boundary(Mesh &m, int x0, int x1, int y0, int y1, int z0, int z1){
//set boundary indices for cube faces
//x=0 plane
for(list<Element>::iterator it = m.elements.begin(),
it_end = m.elements.end(); it != it_end; it++){
for(i = 0; i < f; i++){
for(e = 0; e < f; e++){
it_end = m.elements.end(); it != it_end; ++it){
for(i = 0; i < f; ++i){
for(e = 0; e < f; ++e){
if(e == i){
if(m.vertices[it->v[e]][0] - epsilon <= min_value[0]) break;
else continue;
......@@ -130,9 +130,9 @@ void box_boundary(Mesh &m, int x0, int x1, int y0, int y1, int z0, int z1){
}
//x=1 plane
for(list<Element>::iterator it = m.elements.begin(),
it_end = m.elements.end(); it != it_end; it++){
for(i = 0; i < f; i++){
for(e = 0; e < f; e++){
it_end = m.elements.end(); it != it_end; ++it){
for(i = 0; i < f; ++i){
for(e = 0; e < f; ++e){
if(e == i){
if(m.vertices[it->v[e]][0] + epsilon >= max_value[0]) break;
else continue;
......@@ -144,9 +144,9 @@ void box_boundary(Mesh &m, int x0, int x1, int y0, int y1, int z0, int z1){
}
//y=0 plane
for(list<Element>::iterator it = m.elements.begin(),
it_end = m.elements.end(); it != it_end; it++){
for(i = 0; i < f; i++){
for(e = 0; e < f; e++){
it_end = m.elements.end(); it != it_end; ++it){
for(i = 0; i < f; ++i){
for(e = 0; e < f; ++e){
if(e == i){
if(m.vertices[it->v[e]][1] - epsilon <= min_value[1]) break;
else continue;
......@@ -158,9 +158,9 @@ void box_boundary(Mesh &m, int x0, int x1, int y0, int y1, int z0, int z1){
}
//y=1 plane
for(list<Element>::iterator it = m.elements.begin(),
it_end = m.elements.end(); it != it_end; it++){
for(i = 0; i < f; i++){
for(e = 0; e < f; e++){
it_end = m.elements.end(); it != it_end; ++it){
for(i = 0; i < f; ++i){
for(e = 0; e < f; ++e){
if(e == i){
if(m.vertices[it->v[e]][1] + epsilon >= max_value[1]) break;
else continue;
......@@ -179,9 +179,9 @@ void box_boundary(Mesh &m, int x0, int x1, int y0, int y1, int z0, int z1){
//z=0 plane
for(list<Element>::iterator it = m.elements.begin(),
it_end = m.elements.end(); it != it_end; it++){
for(i = 0; i < f; i++){
for(e = 0; e < f; e++){
it_end = m.elements.end(); it != it_end; ++it){
for(i = 0; i < f; ++i){
for(e = 0; e < f; ++e){
if(e == i){
if(m.vertices[it->v[e]][2] - epsilon <= min_value[2]) break;
else continue;
......@@ -193,9 +193,9 @@ void box_boundary(Mesh &m, int x0, int x1, int y0, int y1, int z0, int z1){
}
//z=1 plane
for(list<Element>::iterator it = m.elements.begin(),
it_end = m.elements.end(); it != it_end; it++){
for(i = 0; i < f; i++){
for(e = 0; e < f; e++){
it_end = m.elements.end(); it != it_end; ++it){
for(i = 0; i < f; ++i){
for(e = 0; e < f; ++e){
if(e == i){
if(m.vertices[it->v[e]][2] + epsilon >= max_value[2]) break;
else continue;
......@@ -289,6 +289,39 @@ vector<vector<vector<int> > >* box_boundary_periodic(Mesh &m, int *dimensions){
return result;
}
//--------------------< set_boundary_inside_box >
void set_boundary_inside_box(Mesh &m, double x0, double x1, double y0, double y1,
double z0, double z1, int boundary_index, bool include_partial_hits){
if(!m.boundary_checked) determine_boundary(m);
int f = m.dim_of_elements + 1;
x0 -= epsilon;
x1 += epsilon;
y0 -= epsilon;
y1 += epsilon;
z0 -= epsilon;
z1 += epsilon;
for(list<Element>::iterator it = m.elements.begin(),
it_end = m.elements.end(); it != it_end; ++it){
for(int face = 0; face < f; ++face){
if(it->b[face] > 0) continue;
int inside_count = 0;
int vertex = 0;
for(; vertex < f; ++vertex){
if(vertex == face) continue;
Vertex &v = m.vertices[it->v[vertex]];
if(v[0] > x0 && v[0] < x1 && v[1] > y0 && v[1] < y1 && v[2] > z0 && v[2] < z1){
if(include_partial_hits) break;
else if(++inside_count == m.dim_of_elements) break;
}
}
if(vertex != f) it->b[face] = -boundary_index;
}
}
m.boundary_checked = true;
}
//--------------------< selection_boundary_2d >
void selection_boundary_2d(Mesh &m, Mesh &n, int boundary_index){
vector<vector<int> > segments;
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -283,9 +283,6 @@ void call_blur_vector(vector<string> &args, bool test){
//--------------------< call_box_boundary >
void call_box_boundary(vector<string> &args, bool test){
Mesh *m;
int x0, x1, y0, y1, z0=1, z1=1;
string task_description = "setting boundary-values for box-faces";
int prompt_length = task_description.size() + 5;
......@@ -295,15 +292,16 @@ void call_box_boundary(vector<string> &args, bool test){
}
if(undefined_variable_warning != "") cout << undefined_variable_warning << flush;
if(args.size() != 5 && args.size() != 7) error("Invalid number of arguments.");
m = lookup_mesh(args[0]);
x0 = ival(args[1]);
Mesh *m = lookup_mesh(args[0]);
int x0 = ival(args[1]);
if(x0 < 0) x0 = -x0 + 1000000;
x1 = ival(args[2]);
int x1 = ival(args[2]);
if(x1 < 0) x1 = -x1 + 1000000;
y0 = ival(args[3]);
int y0 = ival(args[3]);
if(y0 < 0) y0 = -y0 + 1000000;
y1 = ival(args[4]);
int y1 = ival(args[4]);
if(y1 < 0) y1 = -y1 + 1000000;
int z0 = 1, z1 = 1;
if(args.size() == 7){
z0 = ival(args[5]);
if(z0 < 0) z0 = -z0 + 1000000;
......@@ -3523,6 +3521,46 @@ void call_set_base_type(vector<string> &args, bool test){
}
}
//--------------------< call_set_boundary_inside_box >
void call_set_boundary_inside_box(vector<string> &args, bool test){
string task_description = "setting boundary-values inside box";
int prompt_length = task_description.size() + 5;
if(!test){
if(verbosity >= 1){
cout << task_description << fill_dots(prompt_length, task_description_length) << flush;
}
if(undefined_variable_warning != "") cout << undefined_variable_warning << flush;
check_argument_count(args, 6, 9);
Mesh *m = lookup_mesh(args[0]);
double x0 = dval(args[1]);
double x1 = dval(args[2]);
double y0 = dval(args[3]);
double y1 = dval(args[4]);
double z0 = -9e99;
double z1 = 9e99;
int arg_offset = 0;
if(args.size() >= 8){
arg_offset = 2;
z0 = dval(args[5]);
z1 = dval(args[6]);
}
int boundary_index = ival(args[5 + arg_offset]);
if(boundary_index < 0) boundary_index = -boundary_index + 1000000;
bool include_partial_hits = false;
if(args.size() == 7 || args.size() == 9){
if(args[6 + arg_offset] == "INCLUDE_PARTIAL_HITS") include_partial_hits = true;
else if(args[6 + arg_offset] != "EXCLUDE_PARTIAL_HITS") error("Unknown include-mode!");
}
set_boundary_inside_box(*m, x0, x1, y0, y1, z0, z1, boundary_index, include_partial_hits);
if(verbosity >= 1) cout << "ok" << endl;
}else{
if(task_description_length < prompt_length) task_description_length = prompt_length;
}
}
//--------------------< call_set_line_triangle_intersection >
void call_set_line_triangle_intersection(vector<string> &args, bool test){
if(!test){
......@@ -5500,6 +5538,7 @@ void execute_next_command(string &cmdline, bool test){
else if(srcmd == "retriangulate") call_retriangulate(cmdargs, test);
else if(srcmd == "selection_boundary") call_selection_boundary(cmdargs, test);
else if(srcmd == "set_base_type") call_set_base_type(cmdargs, test);
else if(srcmd == "set_boundary_inside_box") call_set_boundary_inside_box(cmdargs, test);
else if(srcmd == "set_line_triangle_intersection")
call_set_line_triangle_intersection(cmdargs, test);
else if(srcmd == "set_max_threads") call_set_max_threads(cmdargs, test);
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -362,7 +362,7 @@ void fit_to_mesh(Mesh &m1, Mesh &m2, double factor){
//If 'sorted_elements' == true, Elements from 'n' are inserted into 'm' sorted by their 'index'-
//member. This does not work for 'base_elements' and requires that the elements in both 'm' and
//'n' are sorted by 'index'.
void concatenate_mesh(Mesh &m, const Mesh &n, bool sorted_elements){
void concatenate_mesh(Mesh &m, Mesh &n, bool sorted_elements){
int i, offset, v[4];
bool use_vertices_of_m = false;
......@@ -378,7 +378,8 @@ void concatenate_mesh(Mesh &m, const Mesh &n, bool sorted_elements){
if(m.dim_of_world != n.dim_of_world || m.dim_of_elements != n.dim_of_elements){
error("Meshes have different dimensionality!");
}else{
if(!n.boundary_checked) m.boundary_checked = false;
if(!n.boundary_checked && m.boundary_checked) determine_boundary(n);
if(n.boundary_checked && !m.boundary_checked) determine_boundary(m);
}
//vertices
......@@ -430,7 +431,9 @@ void concatenate_mesh(Mesh &m, const Mesh &n, bool sorted_elements){
add_element(m, v);
Element &el = m.elements.back();
el.index = it->index;
for(i = 0; i <= m.dim_of_elements; ++i) el.b[i] = it->b[i];
for(i = 0; i <= m.dim_of_elements; ++i){
el.b[i] = it->b[i];
}
if(it->rd != NULL){
el.rd = new RefinementData(0);
*el.rd = *it->rd;
......@@ -3855,4 +3858,4 @@ void create_box_tile_mesh(Mesh &m, int size_x, int size_y, int size_z/*=0*/){
rfm.delete_refinement_data();
}
} //end namespace meshconv
\ No newline at end of file
} //end namespace meshconv
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......@@ -44,7 +44,7 @@
namespace meshconv{
using namespace std;
#define MESHCONV_VERSION "v3.16"
#define MESHCONV_VERSION "v3.19"
#define DEBUG_COUNT_AMBIGUOUS_RAYS 0
#define DEBUG_REFINE_BACKGRID 0
......@@ -672,7 +672,7 @@ void rescale(Mesh &m, vector<DataVector*> &vecs, double normalisation_size,
void center(Mesh &m, const Vertex &centers, vector<bool> &changes);
void offset(Mesh &m, const Vertex &offsets, vector<bool> &changes);
void fit_to_mesh(Mesh &m1, Mesh &m2, double factor=1.0);
void concatenate_mesh(Mesh &m, const Mesh &n, bool sorted_elements=false);
void concatenate_mesh(Mesh &m, Mesh &n, bool sorted_elements=false);
void combine_meshes(Mesh &m1, const Mesh &m2, vector<DataVector*> &vecs);
void extract_surface(Mesh &m, Mesh &n, vector<pair<DataVector*, DataVector*> > &vecs,
DataVector* boundaries);
......@@ -711,6 +711,8 @@ void determine_boundary(Mesh &m);
void determine_neighbourhood_only(Mesh &m);
void box_boundary(Mesh &m, int x0, int x1, int y0, int y1, int z0, int z1);
vector<vector<vector<int> > >* box_boundary_periodic(Mesh &m, int *dimensions);
void set_boundary_inside_box(Mesh &m, double x0, double x1, double y0, double y1,
double z0, double z1, int boundary_index, bool include_partial_hits);
void selection_boundary_2d(Mesh &m, Mesh &n, int boundary_index);
void selection_boundary_3d(Mesh &m, Mesh &n, int boundary_index);
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universitt Dresden
// Copyright (c) 2008-2020 Technische Universitt Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universität Dresden
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Technische Universitt Dresden
// Copyright (c) 2008-2020 Technische Universitt Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
// Copyright (c) 2008-2019 Dresden University of Technology
// Copyright (c) 2008-2020 Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment