Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
meshconv
Commits
4069b5a3
Commit
4069b5a3
authored
Feb 28, 2017
by
Stenger, Florian
Browse files
meshconv v3.09
parent
8d7d9cd4
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
examples/data/complicated_base.bt2
View file @
4069b5a3
...
...
@@ -4,6 +4,7 @@ box-size: 0.2 0.2
y-axis: textual
element-mode: simple
matrices:
z = 0:
0 0 1 1 1
1 1 1 0 1
...
...
license.txt
View file @
4069b5a3
Software License for meshconv
Copyright (c) 2008-201
6
Technische Universität Dresden
Copyright (c) 2008-201
7
Technische Universität Dresden
All rights reserved.
Author: Florian Stenger
Technische Universität Dresden - short TUD -
and SimuNova UG have
the exclusive
Technische Universität Dresden - short TUD -
has
the exclusive
rights to license this product under the following license.
Usage is permitted provided that the following conditions are met:
...
...
main.cc
View file @
4069b5a3
// Copyright (c) 2008-201
6
Technische Universität Dresden
// Copyright (c) 2008-201
7
Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
#include "
src/
meshconv.h"
#include "meshconv.h"
using
namespace
std
;
using
namespace
meshconv
;
//----------------------------------------< main >
int
main
(
int
argc
,
char
*
argv
[]){
string
cmdline
=
""
;
srand
(
time
(
NULL
));
string
cmdline
=
""
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
cmdline
+=
string
(
argv
[
i
])
+
" "
;
run
(
cmdline
);
delete_all
();
...
...
manual.pdf
View file @
4069b5a3
No preview for this file type
src/backgrid.cc
View file @
4069b5a3
// Copyright (c) 2008-201
6
Technische Universität Dresden
// Copyright (c) 2008-201
7
Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
...
...
@@ -173,7 +173,7 @@ void BackGrid::init(Mesh *m, Mesh *n, uchar operation_index_mode, bool no_scalin
min_seg_size
=
9e100
;
for
(
x
=
0
;
x
<
m
->
dim_of_world
;
++
x
){
seg_size
[
x
]
=
(
maxc
[
x
]
-
minc
[
x
])
/
(
double
)
(
segments
[
x
]
)
;
seg_size
[
x
]
=
(
maxc
[
x
]
-
minc
[
x
])
/
(
double
)
segments
[
x
];
if
(
min_seg_size
>
seg_size
[
x
])
min_seg_size
=
seg_size
[
x
];
}
}
...
...
@@ -187,8 +187,8 @@ void BackGrid::init(Mesh *m, Mesh *n, uchar operation_index_mode, bool no_scalin
if
(
distance_threshold
<
4
*
min_seg_size
){
distance_threshold
=
4
*
min_seg_size
;
if
(
verbosity
>=
2
&&
search_distance
>=
0.0
){
cout
<<
"W
arning
! d
esired backgrid-search-distance of "
<<
search_distance
<<
" is too small for this setup! "
<<
distance_threshold
<<
" is used instead."
<<
endl
;
w
arning
(
"D
esired backgrid-search-distance of "
+
ft
(
search_distance
)
+
" is too small for this setup! "
+
ft
(
distance_threshold
)
+
" is used instead."
)
;
}
}
...
...
@@ -2254,8 +2254,8 @@ void BackGridPointCloud::init(Mesh *m, Mesh *n, bool no_scaling){
if
(
distance_threshold
<
4
*
min_seg_size
){
distance_threshold
=
4
*
min_seg_size
;
if
(
verbosity
>=
2
&&
search_distance
>=
0.0
){
cout
<<
"W
arning
! d
esired backgrid-search-distance of "
<<
search_distance
<<
" is too small for this setup! "
<<
distance_threshold
<<
" is used instead."
<<
endl
;
w
arning
(
"D
esired backgrid-search-distance of "
+
ft
(
search_distance
)
+
" is too small for this setup! "
+
ft
(
distance_threshold
)
+
" is used instead."
)
;
}
}
...
...
src/boundary_operations.cc
View file @
4069b5a3
// Copyright (c) 2008-201
6
Technische Universität Dresden
// Copyright (c) 2008-201
7
Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
...
...
@@ -189,84 +189,58 @@ void box_boundary(Mesh &m, int x0, int x1, int y0, int y1, int z0, int z1){
//only works for dim_of_world = dim_of_elements = 2 or dim_of_world = dim_of_elements = 3
//or dim_of_world = 3, dim_of_elements = 2.
vector
<
vector
<
vector
<
int
>
>
>*
box_boundary_periodic
(
Mesh
&
m
,
int
*
dimensions
){
int
i
,
e
,
a
,
u
;
int
cnt_lower
,
cnt_upper
,
lower
[
3
],
upper
[
3
];
BFace
new_face
;
void
(
*
sort_bface
)(
BFace
&
)
=
((
m
.
dim_of_elements
==
3
)
?
sort_bface32
:
((
m
.
dim_of_world
==
3
)
?
sort_bface22
:
sort_bface21
));
bool
(
*
compare
)(
const
BFace
&
,
const
BFace
&
)
=
((
m
.
dim_of_elements
==
3
)
?
bface_compare32
:
((
m
.
dim_of_world
==
3
)
?
bface_compare22
:
bface_compare21
));
vector
<
set
<
BFace
,
bool
(
*
)(
const
BFace
&
,
const
BFace
&
)
>
>
bfaces
(
m
.
dim_of_world
,
set
<
BFace
,
bool
(
*
)(
const
BFace
&
,
const
BFace
&
)
>
(
compare
));
set
<
BFace
,
bool
(
*
)(
const
BFace
&
,
const
BFace
&
)
>::
iterator
f_it
;
list
<
Element
>::
iterator
it
;
Vertex
max_value
,
min_value
;
Vertex
new_face
;
vector
<
int
>
new_value
(
m
.
dim_of_elements
+
1
);
vector
<
vector
<
vector
<
int
>
>
>
*
result
=
new
vector
<
vector
<
vector
<
int
>
>
>
(
m
.
dim_of_world
);
vector
<
int
>
v
(
m
.
dim_of_elements
+
1
);
rebuild_element_indices
(
m
);
Vertex
max_value
,
min_value
;
determine_coordinate_extrema
(
m
,
min_value
,
max_value
);
vector
<
VertexMap
<
vector
<
int
>
>
>
bfaces
(
m
.
dim_of_world
,
VertexMap
<
vector
<
int
>
>
(
min_value
,
max_value
,
m
.
dim_of_world
));
for
(
it
=
m
.
elements
.
begin
()
;
it
!
=
m
.
elements
.
end
();
++
it
){
for
(
e
=
0
;
e
<
m
.
dim_of_world
;
++
e
){
for
(
list
<
Element
>::
iterator
it
=
m
.
elements
.
begin
()
,
end
=
m
.
elements
.
end
();
it
!=
end
;
++
it
){
for
(
int
e
=
0
;
e
<
m
.
dim_of_world
;
++
e
){
if
(
dimensions
[
e
]
==
0
)
continue
;
cnt_lower
=
0
;
cnt_upper
=
0
;
for
(
i
=
0
;
i
<=
m
.
dim_of_elements
;
++
i
){
for
(
int
i
=
0
;
i
<=
m
.
dim_of_elements
;
++
i
){
if
(
m
.
vertices
[
it
->
v
[
i
]][
e
]
+
para_epsilon
>
max_value
[
e
])
upper
[
cnt_upper
++
]
=
i
;
if
(
m
.
vertices
[
it
->
v
[
i
]][
e
]
-
para_epsilon
<
min_value
[
e
])
lower
[
cnt_lower
++
]
=
i
;
}
if
(
cnt_upper
==
m
.
dim_of_elements
){
for
(
i
=
0
;
i
<
m
.
dim_of_elements
;
++
i
){
new_face
.
li
[
i
]
=
upper
[
i
];
u
=
0
;
for
(
a
=
0
;
a
<
m
.
dim_of_world
;
++
a
){
if
(
a
==
e
)
continue
;
new_face
.
v
[
i
][
u
++
]
=
m
.
vertices
[
it
->
v
[
upper
[
i
]]][
a
];
}
new_face
=
Vertex
(
0.0
,
0.0
,
0.0
);
for
(
int
i
=
0
;
i
<
m
.
dim_of_elements
;
++
i
){
new_value
[
i
+
1
]
=
upper
[
i
];
new_face
+=
m
.
vertices
[
it
->
v
[
upper
[
i
]]];
}
}
else
if
(
cnt_lower
==
m
.
dim_of_elements
){
for
(
i
=
0
;
i
<
m
.
dim_of_elements
;
++
i
){
new_face
.
li
[
i
]
=
lower
[
i
];
u
=
0
;
for
(
a
=
0
;
a
<
m
.
dim_of_world
;
++
a
){
if
(
a
==
e
)
continue
;
new_face
.
v
[
i
][
u
++
]
=
m
.
vertices
[
it
->
v
[
lower
[
i
]]][
a
];
}
new_face
=
Vertex
(
0.0
,
0.0
,
0.0
);
for
(
int
i
=
0
;
i
<
m
.
dim_of_elements
;
++
i
){
new_value
[
i
+
1
]
=
lower
[
i
];
new_face
+=
m
.
vertices
[
it
->
v
[
lower
[
i
]]];
}
}
else
{
continue
;
}
//element has a face on boundary
(
*
sort_bface
)(
new_face
);
new_face
.
ref_element
=
&
(
*
it
);
f_it
=
bfaces
[
e
].
find
(
new_face
);
if
(
f_it
!=
bfaces
[
e
].
end
()){
v
[
0
]
=
f_it
->
ref_element
->
index
;
for
(
i
=
0
;
i
<
m
.
dim_of_elements
;
++
i
)
v
[
i
+
1
]
=
f_it
->
li
[
i
];
(
*
result
)[
e
].
push_back
(
v
);
v
[
0
]
=
new_face
.
ref_element
->
index
;
for
(
i
=
0
;
i
<
m
.
dim_of_elements
;
++
i
)
v
[
i
+
1
]
=
new_face
.
li
[
i
];
(
*
result
)[
e
].
push_back
(
v
);
bfaces
[
e
].
erase
(
f_it
);
new_face
/=
m
.
dim_of_elements
;
new_face
[
e
]
=
0.0
;
new_value
[
0
]
=
it
->
index
;
vector
<
pair
<
Vertex
,
vector
<
int
>
>*>
find_result
=
bfaces
[
e
].
find
(
new_face
);
if
(
find_result
.
size
()
>
1
){
error
(
"Some boundary-face occurrs more than twice in one dimension."
);
}
if
(
find_result
.
empty
()){
bfaces
[
e
].
insert
(
new_face
,
new_value
);
}
else
{
bfaces
[
e
].
insert
(
new_face
);
(
*
result
)[
e
].
push_back
(
find_result
[
0
]
->
second
);
(
*
result
)[
e
].
push_back
(
new_value
);
}
}
}
if
(
verbosity
>=
2
&&
bfaces
[
0
].
size
()
>
0
){
cout
<<
endl
<<
" remaining boundary faces in x-dimension: "
<<
bfaces
[
0
].
size
()
<<
" "
;
}
if
(
m
.
dim_of_world
>=
2
&&
verbosity
>=
2
&&
bfaces
[
1
].
size
()
>
0
){
cout
<<
endl
<<
" remaining boundary faces in y-dimension: "
<<
bfaces
[
1
].
size
()
<<
" "
;
}
if
(
m
.
dim_of_world
==
3
&&
verbosity
>=
2
&&
bfaces
[
2
].
size
()
>
0
){
cout
<<
endl
<<
" remaining boundary faces in z-dimension: "
<<
bfaces
[
2
].
size
()
<<
" "
;
}
return
result
;
}
...
...
src/commands.cc
View file @
4069b5a3
This diff is collapsed.
Click to expand it.
src/compression.cc
View file @
4069b5a3
// Copyright (c) 2008-201
6
Technische Universität Dresden
// Copyright (c) 2008-201
7
Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
...
...
src/filereaders.cc
View file @
4069b5a3
This diff is collapsed.
Click to expand it.
src/filewriters.cc
View file @
4069b5a3
This diff is collapsed.
Click to expand it.
src/geometry.cc
View file @
4069b5a3
// Copyright (c) 2008-201
6
Technische Universität Dresden
// Copyright (c) 2008-201
7
Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
...
...
src/interface.cc
View file @
4069b5a3
// Copyright (c) 2008-201
6
Technische Universität Dresden
// Copyright (c) 2008-201
7
Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
...
...
@@ -101,7 +101,8 @@ string get_element_type_name(int dim_of_elements, unsigned vertex_dofs, unsigned
}
//----------------------------------------< lookup_mesh >
Mesh
*
lookup_mesh
(
string
str
,
bool
may_create_new_mesh
,
bool
no_error
,
bool
read_mcb_file
){
Mesh
*
lookup_mesh
(
string
str
,
bool
may_create_new_mesh
/*=false*/
,
bool
no_error
/*=false*/
,
bool
read_mcb_file
/*=true*/
){
map
<
string
,
Mesh
>::
iterator
m_it
;
map
<
string
,
MeshPartitioning
>::
iterator
p_it
;
...
...
@@ -116,19 +117,19 @@ Mesh* lookup_mesh(string str, bool may_create_new_mesh, bool no_error, bool read
p_it
=
mesh_partitionings
.
find
(
new_str
);
if
(
p_it
!=
mesh_partitionings
.
end
()){
if
(
int
(
p_it
->
second
.
partitions
.
size
())
>
index
){
pair
<
string
,
Mesh
*>
&
part
=
p_it
->
second
.
partitions
[
index
];
if
(
part
.
second
==
NULL
){
MeshPartition
&
part
=
p_it
->
second
.
partitions
[
index
];
if
(
part
.
mesh
==
NULL
){
if
(
read_mcb_file
){
if
(
part
.
first
==
""
){
if
(
part
.
name
==
""
){
error
(
"Mesh-partition "
+
str
+
" is dead (i.e. neither in memory nor on disk)."
);
}
part
.
second
=
create_mesh
(
str
);
read_meshconv_file
(
part
.
first
,
part
.
second
);
//load from temporary file
part
.
mesh
=
create_mesh
(
str
);
read_meshconv_file
(
part
.
name
,
part
.
mesh
);
//load from temporary file
}
else
{
return
NULL
;
}
}
return
part
.
second
;
return
part
.
mesh
;
}
}
}
...
...
@@ -379,7 +380,7 @@ void delete_mesh_partitioning(string name, bool erase_object, bool erase_temp_fi
if
(
mp
!=
NULL
){
if
(
erase_temp_file
){
for
(
unsigned
p
=
0
;
p
<
mp
->
partitions
.
size
();
++
p
){
if
(
mp
->
partitions
[
p
].
first
!=
""
)
remove
(
mp
->
partitions
[
p
].
first
.
c_str
());
if
(
mp
->
partitions
[
p
].
name
!=
""
)
remove
(
mp
->
partitions
[
p
].
name
.
c_str
());
}
}
if
(
erase_partitions
){
...
...
@@ -401,7 +402,7 @@ void delete_mesh(string name, bool erase_object, bool erase_temp_file){
if
(
mp
!=
NULL
){
if
(
erase_temp_file
){
for
(
unsigned
p
=
0
;
p
<
mp
->
partitions
.
size
();
++
p
){
if
(
mp
->
partitions
[
p
].
first
!=
""
)
remove
(
mp
->
partitions
[
p
].
first
.
c_str
());
if
(
mp
->
partitions
[
p
].
name
!=
""
)
remove
(
mp
->
partitions
[
p
].
name
.
c_str
());
}
}
if
(
erase_object
)
mesh_partitionings
.
erase
(
name
);
...
...
@@ -415,10 +416,10 @@ void delete_mesh(string name, bool erase_object, bool erase_temp_file){
map
<
string
,
MeshPartitioning
>::
iterator
p_it
=
mesh_partitionings
.
find
(
new_str
);
if
(
p_it
!=
mesh_partitionings
.
end
()){
if
(
int
(
p_it
->
second
.
partitions
.
size
())
>
index
){
if
(
erase_object
)
p_it
->
second
.
partitions
[
index
].
second
=
NULL
;
if
(
erase_temp_file
&&
p_it
->
second
.
partitions
[
index
].
first
!=
""
){
remove
(
p_it
->
second
.
partitions
[
index
].
first
.
c_str
());
p_it
->
second
.
partitions
[
index
].
first
=
""
;
if
(
erase_object
)
p_it
->
second
.
partitions
[
index
].
mesh
=
NULL
;
if
(
erase_temp_file
&&
p_it
->
second
.
partitions
[
index
].
name
!=
""
){
remove
(
p_it
->
second
.
partitions
[
index
].
name
.
c_str
());
p_it
->
second
.
partitions
[
index
].
name
=
""
;
}
}
}
...
...
@@ -487,12 +488,12 @@ void unload_mesh(string name){
string
new_str
=
name
.
substr
(
0
,
i
);
map
<
string
,
MeshPartitioning
>::
iterator
p_it
=
mesh_partitionings
.
find
(
new_str
);
if
(
p_it
!=
mesh_partitionings
.
end
()){
pair
<
string
,
Mesh
*>
&
partition
=
p_it
->
second
.
partitions
[
index
];
if
(
partition
.
second
!=
NULL
){
partition
.
first
=
temporary_file
(
new_str
,
index
,
p_it
->
second
.
name
.
size
());
write_meshconv_file
(
partition
.
first
,
partition
.
second
);
MeshPartition
&
partition
=
p_it
->
second
.
partitions
[
index
];
if
(
partition
.
mesh
!=
NULL
){
partition
.
name
=
temporary_file
(
new_str
,
index
,
p_it
->
second
.
name
.
size
());
write_meshconv_file
(
partition
.
name
,
partition
.
mesh
);
delete_mesh
(
name
,
true
);
partition
.
second
=
NULL
;
partition
.
mesh
=
NULL
;
}
}
}
...
...
@@ -537,8 +538,8 @@ void mesh_info(string name, int task_description_length){
cout
<<
mp
->
partitions
.
size
()
<<
" partitions: "
<<
endl
;
plen
=
ft
((
unsigned
)
mp
->
partitions
.
size
()
-
1
).
size
();
for
(
i
=
0
;
i
<
mp
->
partitions
.
size
();
++
i
){
if
(
mp
->
partitions
[
i
].
second
!=
NULL
){
Mesh
&
tmp_m
=
*
mp
->
partitions
[
i
].
second
;
if
(
mp
->
partitions
[
i
].
mesh
!=
NULL
){
Mesh
&
tmp_m
=
*
mp
->
partitions
[
i
].
mesh
;
cout
<<
string
(
task_description_length
,
' '
)
<<
"partition "
<<
ft
(
i
,
plen
)
<<
": vertices: "
<<
tmp_m
.
numvertices
<<
", elements: "
<<
tmp_m
.
numelements
<<
" (memory)"
<<
endl
;
...
...
@@ -556,9 +557,9 @@ void mesh_info(string name, int task_description_length){
++
bi
;
}
#endif
}
else
if
(
mp
->
partitions
[
i
].
first
!=
""
){
}
else
if
(
mp
->
partitions
[
i
].
name
!=
""
){
int
numvertices
,
numelements
;
get_mesh_info_from_binary
(
mp
->
partitions
[
i
].
first
,
numvertices
,
numelements
);
get_mesh_info_from_binary
(
mp
->
partitions
[
i
].
name
,
numvertices
,
numelements
);
cout
<<
string
(
task_description_length
,
' '
)
<<
"partition "
<<
ft
(
i
,
plen
)
<<
": vertices: "
<<
numvertices
<<
", elements: "
<<
numelements
<<
" (disk)"
<<
endl
;
total_elements
+=
numelements
;
...
...
@@ -688,7 +689,7 @@ void init_lagrange_element_types(){
//----------------------------------------< replace_constants >
void
replace_constants
(
string
&
str
){
unsigned
long
pos
;
size_t
pos
;
map
<
string
,
string
>
constants
;
constants
.
insert
(
make_pair
(
"ON"
,
"1"
));
//set_enforce_perfect_corners
...
...
@@ -742,10 +743,9 @@ void replace_constants(string &str){
do
{
pos
=
str
.
find
(
it
->
first
,
pos
);
if
(
pos
!=
npos
){
unsigned
long
next_pos
=
pos
+
it
->
first
.
size
();
if
(
pos
>
0
&&
pos
<
str
.
size
()
&&
(
str
[
pos
-
1
]
==
','
||
str
[
pos
-
1
]
==
' '
||
str
[
pos
-
1
]
==
'('
)
&&
(
str
[
next_pos
]
==
','
||
str
[
next_pos
]
==
' '
||
str
[
next_pos
]
==
')'
)){
size_t
next_pos
=
pos
+
it
->
first
.
size
();
if
(
pos
<
str
.
size
()
&&
(
str
[
pos
-
1
]
==
','
||
str
[
pos
-
1
]
==
' '
||
str
[
pos
-
1
]
==
'('
)
&&
(
str
[
next_pos
]
==
','
||
str
[
next_pos
]
==
' '
||
str
[
next_pos
]
==
')'
)){
str
.
replace
(
pos
,
it
->
first
.
size
(),
it
->
second
);
}
++
pos
;
...
...
@@ -756,7 +756,7 @@ void replace_constants(string &str){
//----------------------------------------< replace_variables >
void
replace_variables
(
string
&
str
){
unsigned
long
pos_c
;
size_t
pos_c
;
bool
occurence
;
map
<
string
,
string
>::
iterator
v_it
;
...
...
@@ -777,7 +777,7 @@ void replace_variables(string &str){
if
(
undefined_variable_warning
==
""
){
pos_c
=
str
.
find
(
"{"
);
if
(
pos_c
!=
npos
){
unsigned
long
pos_e
=
str
.
find
(
"}"
,
pos_c
);
size_t
pos_e
=
str
.
find
(
"}"
,
pos_c
);
if
(
pos_e
!=
npos
){
undefined_variable_warning
=
"Warning! undefined variable "
+
str
.
substr
(
pos_c
,
pos_e
-
pos_c
+
1
)
+
". "
;
...
...
@@ -788,8 +788,8 @@ void replace_variables(string &str){
//----------------------------------------< run_single_mode >
void
run_single_mode
(
string
cmdline
,
bool
test
){
unsigned
long
pos
;
bool
p_mode
=
false
,
s_mode
=
false
;
size_t
pos
;
bool
p_mode
=
false
,
s_mode
=
false
;
map
<
string
,
string
>::
iterator
v_it
;
//check for empty command line
...
...
@@ -798,7 +798,7 @@ void run_single_mode(string cmdline, bool test){
}
//replace brackets and interval-tokens of the form #(...)
for
(
pos
=
0
;
pos
<
cmdline
.
size
();
++
pos
){
for
(
pos
=
0
;
pos
<
cmdline
.
size
();
++
pos
){
if
(
cmdline
[
pos
]
==
'\"'
){
s_mode
=
!
s_mode
;
}
else
if
(
cmdline
[
pos
]
==
'['
&&
!
p_mode
&&
!
s_mode
){
...
...
@@ -836,13 +836,15 @@ void run_single_mode(string cmdline, bool test){
void
run_script
(
string
filename
,
bool
test
){
ifstream
in
;
string
tmp
,
cmdline
;
unsigned
long
pos
;
size_t
pos
;
in
.
open
(
filename
.
c_str
());
if
(
!
in
)
error
(
"Could not open file
\"
"
+
filename
+
"
\"
."
);
while
(
!
in
.
eof
()){
getline
(
in
,
tmp
);
if
(
tmp
.
size
()
>
0
&&
tmp
[
tmp
.
size
()
-
1
]
==
13
)
tmp
=
tmp
.
substr
(
0
,
tmp
.
size
()
-
1
);
//dos-/windows-files
if
(
tmp
.
size
()
>
0
&&
tmp
[
tmp
.
size
()
-
1
]
==
13
){
//handle dos- / windows-files
tmp
=
tmp
.
substr
(
0
,
tmp
.
size
()
-
1
);
}
if
(
tmp
.
substr
(
0
,
1
)
==
"%"
||
tmp
.
substr
(
0
,
2
)
==
"//"
||
tmp
.
substr
(
0
,
2
)
==
"#!"
)
continue
;
pos
=
tmp
.
find
(
"%"
);
if
(
pos
==
npos
)
pos
=
tmp
.
find
(
"//"
);
...
...
@@ -876,7 +878,7 @@ void delete_all(){
//VectorPartitionings
for
(
vm_it
=
vector_partitionings
.
begin
();
vm_it
!=
vector_partitionings
.
end
();
++
vm_it
){
for
(
unsigned
p
=
0
;
p
<
vm_it
->
second
.
size
();
++
p
){
for
(
unsigned
p
=
0
;
p
<
vm_it
->
second
.
size
();
++
p
){
remove
(
vm_it
->
second
[
p
].
first
.
c_str
());
}
}
...
...
@@ -919,6 +921,11 @@ double cpu_time(){
#endif
}
//----------------------------------------< warning >
void
warning
(
string
message
){
cout
<<
"Warning! "
<<
message
<<
endl
;
}
//----------------------------------------< error >
void
error
(
string
message
){
#ifdef PROPAGATE_ERRORS
...
...
src/mesh_maintenance.cc
View file @
4069b5a3
// Copyright (c) 2008-201
6
Technische Universität Dresden
// Copyright (c) 2008-201
7
Technische Universität Dresden
// All rights reserved.
// Author: Florian Stenger
// This file is part of meshconv. See also license.txt in the distribution-folder.
...
...
@@ -13,145 +13,6 @@ using namespace std;
// ## Comparators ##
// ###################
//----------------------------------------< indexed_vector_compare2 >
//returns true if vertex lhs is "smaller" than vertex rhs
bool
indexed_vector_compare2
(
const
IndexedVector
&
lhs
,
const
IndexedVector
&
rhs
){
//$ACL_exclude
return
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
]
>
para_epsilon
)
||
(
abs
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
])
<=
para_epsilon
&&
lhs
.
first
[
1
]
-
rhs
.
first
[
1
]
>
para_epsilon
);
}
//----------------------------------------< indexed_vector_compare3 >
bool
indexed_vector_compare3
(
const
IndexedVector
&
lhs
,
const
IndexedVector
&
rhs
){
//$ACL_exclude
return
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
]
>
para_epsilon
)
||
(
abs
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
])
<=
para_epsilon
&&
lhs
.
first
[
1
]
-
rhs
.
first
[
1
]
>
para_epsilon
)
||
(
abs
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
])
<=
para_epsilon
&&
abs
(
lhs
.
first
[
1
]
-
rhs
.
first
[
1
])
<=
para_epsilon
&&
lhs
.
first
[
2
]
-
rhs
.
first
[
2
]
>
para_epsilon
);
}
//----------------------------------------< indexed_vertex_compare2 >
//returns true if vertex lhs is "smaller" than vertex rhs
bool
indexed_vertex_compare2
(
const
IndexedVertex
&
lhs
,
const
IndexedVertex
&
rhs
){
//$ACL_exclude
return
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
]
>
para_epsilon
)
||
(
abs
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
])
<=
para_epsilon
&&
lhs
.
first
[
1
]
-
rhs
.
first
[
1
]
>
para_epsilon
);
}
//----------------------------------------< indexed_vertex_compare3 >
bool
indexed_vertex_compare3
(
const
IndexedVertex
&
lhs
,
const
IndexedVertex
&
rhs
){
//$ACL_exclude
return
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
]
>
para_epsilon
)
||
(
abs
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
])
<=
para_epsilon
&&
lhs
.
first
[
1
]
-
rhs
.
first
[
1
]
>
para_epsilon
)
||
(
abs
(
lhs
.
first
[
0
]
-
rhs
.
first
[
0
])
<=
para_epsilon
&&
abs
(
lhs
.
first
[
1
]
-
rhs
.
first
[
1
])
<=
para_epsilon
&&
lhs
.
first
[
2
]
-
rhs
.
first
[
2
]
>
para_epsilon
);
}
//----------------------------------------< indexed_vertex_compare3_by_index >
bool
indexed_vertex_compare3_by_index
(
const
IndexedVertex
&
lhs
,
const
IndexedVertex
&
rhs
){
//$ACL_exclude
return
(
lhs
.
second
<
rhs
.
second
);
}
//----------------------------------------< epsilon_safe_compare >
bool
epsilon_safe_compare
(
double
lhs
,
double
rhs
){
//$ACL_exclude
return
(
rhs
-
lhs
>
para_epsilon
);
}
//----------------------------------------< vertex_compare1 >
bool
vertex_compare1
(
const
Vertex
&
lhs
,
const
Vertex
&
rhs
){
//$ACL_exclude
return
(
lhs
[
0
]
-
rhs
[
0
]
>
para_epsilon
);
}
//----------------------------------------< vertex_compare2 >
bool
vertex_compare2
(
const
Vertex
&
lhs
,
const
Vertex
&
rhs
){
//$ACL_exclude
return
((
lhs
[
0
]
-
rhs
[
0
]
>
para_epsilon
)
||
(
abs
(
lhs
[
0
]
-
rhs
[
0
])
<=
para_epsilon
&&
lhs
[
1
]
-
rhs
[
1
]
>
para_epsilon
));
}
//----------------------------------------< vertex_compare3 >
bool
vertex_compare3
(
const
Vertex
&
lhs
,
const
Vertex
&
rhs
){
//$ACL_exclude
return
(
lhs
[
0
]
-
rhs
[
0
]
>
para_epsilon
)
||
(
abs
(
lhs
[
0
]
-
rhs
[
0
])
<=
para_epsilon
&&
lhs
[
1
]
-
rhs
[
1
]
>
para_epsilon
)
||
(
abs
(
lhs
[
0
]
-
rhs
[
0
])
<=
para_epsilon
&&
abs
(
lhs
[
1
]
-
rhs
[
1
])
<=
para_epsilon
&&
lhs
[
2
]
-
rhs
[
2
]
>
para_epsilon
);
}
//----------------------------------------< vertex_compare3_config >
bool
vertex_compare3_config
(
const
Vertex
&
lhs
,
const
Vertex
&
rhs
){
//$ACL_exclude
return
(
lhs
[
0
]
-
rhs
[
0
]
>
config_epsilon
)
||
(
abs
(
lhs
[
0
]
-
rhs
[
0
])
<=
config_epsilon
&&
lhs
[
1
]
-
rhs
[
1
]
>
config_epsilon
)
||
(
abs
(
lhs
[
0
]
-
rhs
[
0
])
<=
config_epsilon
&&
abs
(
lhs
[
1
]
-
rhs
[
1
])
<=
config_epsilon
&&
lhs
[
2
]
-
rhs
[
2
]
>
config_epsilon
);
}
//----------------------------------------< vertex_ptr_compare2 >
bool
vertex_ptr_compare2
(
const
Vertex
*
lhs
,
const
Vertex
*
rhs
){
//$ACL_exclude
const
Vertex
&
lhsr
=
*
lhs
,
&
rhsr
=
*
rhs
;
return
((
lhsr
[
0
]
-
rhsr
[
0
]
>
para_epsilon
)
||
(
abs
(
lhsr
[
0
]
-
rhsr
[
0
])
<=
para_epsilon
&&
lhsr
[
1
]
-
rhsr
[
1
]
>
para_epsilon
));
}
//----------------------------------------< vertex_ptr_compare3 >
bool
vertex_ptr_compare3
(
const
Vertex
*
lhs
,
const
Vertex
*
rhs
){
//$ACL_exclude
const
Vertex
&
lhsr
=
*
lhs
,
&
rhsr
=
*
rhs
;
return
(
lhsr
[
0
]
-
rhsr
[
0
]
>
para_epsilon
)
||
(
abs
(
lhsr
[
0
]
-
rhsr
[
0
])
<=
para_epsilon
&&
lhsr
[
1
]
-
rhsr
[
1
]
>
para_epsilon
)
||
(
abs
(
lhsr
[
0
]
-
rhsr
[
0
])
<=
para_epsilon
&&
abs
(
lhsr
[
1
]
-
rhsr
[
1
])
<=
para_epsilon
&&
lhsr
[
2
]
-
rhsr
[
2
]
>
para_epsilon
);
}
//----------------------------------------< pair_compare >
bool
pair_compare
(
const
pair
<
double
,
double
>
&
lhs
,
const
pair
<
double
,
double
>
&
rhs
){
//$ACL_exclude
return
(
rhs
.
first
-
lhs
.
first
>
para_epsilon
)
||
(
abs
(
rhs
.
first
-
lhs
.
first
)
<=
para_epsilon
&&
rhs
.
second
-
lhs
.
second
>
para_epsilon
);
}
//----------------------------------------< selective_compare2 >
bool
selective_compare2
(
const
Vertex
&
lhs
,
const
Vertex
&
rhs
,
unsigned
short
dim1
,
unsigned
short
dim2
){
//$ACL_exclude
return
(
rhs
[
dim1
]
-
lhs
[
dim1
]
>
para_epsilon
)
||
(
abs
(
rhs
[
dim1
]
-
lhs
[
dim1
])
<=
para_epsilon
&&
rhs
[
dim2
]
-
lhs
[
dim2
]
>
para_epsilon
);
}
//----------------------------------------< bface_compare21 >
//2 vertices in 1D-world, only x-coordinates are compared
bool
bface_compare21
(
const
BFace
&
lhs
,
const
BFace
&
rhs
){
//$ACL_exclude
return
(
lhs
.
v
[
0
][
0
]
-
rhs
.
v
[
0
][
0
]
>
para_epsilon
)
||
(
abs
(
lhs
.
v
[
0
][
0
]
-
rhs
.
v
[
0
][
0
])
<=
para_epsilon
&&
(
lhs
.
v
[
1
][
0
]
-
rhs
.
v
[
1
][
0
]
>
para_epsilon
));
}
//----------------------------------------< bface_compare22 >
//2 vertices in 2D-world
bool
bface_compare22
(
const
BFace
&
lhs
,
const
BFace
&
rhs
){
//$ACL_exclude
return
(
vertex_compare2
(
lhs
.
v
[
0
],
rhs
.
v
[
0
])
||
(
!
vertex_compare2
(
lhs
.
v
[
0
],
rhs
.
v
[
0
])
&&
!
vertex_compare2
(
rhs
.
v
[
0
],
lhs
.
v
[
0
])
&&
vertex_compare2
(
lhs
.
v
[
1
],
rhs
.
v
[
1
])));
}
//----------------------------------------< bface_compare32 >
//3 vertices in 2D-world
bool
bface_compare32
(
const
BFace
&
lhs
,
const
BFace
&
rhs
){
//$ACL_exclude
return
vertex_compare2
(
lhs
.
v
[
0
],
rhs
.
v
[
0
])
||
(
!
vertex_compare2
(
lhs
.
v
[
0
],
rhs
.
v
[
0
])
&&
!
vertex_compare2
(
rhs
.
v
[
0
],
lhs
.
v
[
0
])
&&
vertex_compare2
(
lhs
.
v
[
1
],
rhs
.
v
[
1
]))
||
(
!
vertex_compare2
(
lhs
.
v
[
0
],
rhs
.
v
[
0
])
&&
!
vertex_compare2
(
rhs
.
v
[
0
],
lhs
.
v
[
0
])
&&
!
vertex_compare2
(
lhs
.
v
[
1
],
rhs
.
v
[
1
])
&&
!
vertex_compare2
(
rhs
.
v
[
1
],
lhs
.
v
[
1
])
&&
vertex_compare2
(
lhs
.
v
[
2
],
rhs
.
v
[
2
]));
}
//----------------------------------------< bface_compare33 >
//3 vertices in 3D-world
bool
bface_compare33
(
const
BFace
&
lhs
,
const
BFace
&
rhs
){
//$ACL_exclude
return
vertex_compare3
(
lhs
.
v
[
0
],
rhs
.
v
[
0
])
||
(
!
vertex_compare3
(
lhs
.
v
[
0
],
rhs
.
v
[
0
])
&&
!
vertex_compare3
(
rhs
.
v
[
0
],
lhs
.
v
[
0
])
&&
vertex_compare3
(
lhs
.
v
[
1
],
rhs
.
v
[
1
]))
||
(
!
vertex_compare3
(
lhs
.
v
[
0
],
rhs
.
v
[
0
])
&&
!
vertex_compare3
(
rhs
.
v
[
0
],
lhs
.
v
[
0
])
&&
!
vertex_compare3
(
lhs
.
v
[
1
],
rhs
.
v
[
1
])
&&
!
vertex_compare3
(
rhs
.
v
[
1
],
lhs
.
v
[
1
])
&&
vertex_compare3
(
lhs
.
v
[
2
],
rhs
.
v
[
2
]));
}
//----------------------------------------< face_compare1 >
//returns true if face lhs is "smaller" than face rhs