Commit 8f48b5ba authored by Stenger, Florian's avatar Stenger, Florian
Browse files

meshconv v3.08

parents
project(meshconv)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_INSTALL_RPATH "$ORIGIN/")
find_package(Boost REQUIRED COMPONENTS iostreams)
find_package(OpenMP REQUIRED)
add_definitions(-DPROPAGATE_ERRORS -DOPENMP ${OpenMP_CXX_FLAGS})
file(GLOB LIB_SRC ${meshconv_SOURCE_DIR}/src/*.cc)
add_library(meshconvLib SHARED ${LIB_SRC})
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(meshconvLib ${Boost_LIBRARIES} ${OpenMP_CXX_FLAGS}) #-lz -lrt
add_executable(meshconv main.cc)
target_link_libraries(meshconv meshconvLib)
install(TARGETS meshconvLib meshconv
LIBRARY DESTINATION .
RUNTIME DESTINATION .)
#!/bin/bash
g++ -O3 -o meshconv main.cc src/*.cc -lboost_iostreams -lz -lrt
#!/bin/bash
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. ..
make install
#!/bin/bash
g++ -DMETIS -DOPENMP -O3 -o meshconv main.cc src/*.cc -lmetis -fopenmp -lboost_iostreams -lz -lrt
dim: 2
boxes: 5 5
box-size: 0.2 0.2
y-axis: textual
element-mode: simple
z = 0:
0 0 1 1 1
1 1 1 0 1
0 1 1 0 0
1 1 1 1 1
0 1 0 1 1
DIM: 2
DIM_OF_WORLD: 2
number of elements: 4
number of vertices: 5
vertex coordinates:
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
0.5 0.5
element vertices:
0 1 4
1 2 4
2 3 4
3 0 4
element boundaries:
0 0 1
0 0 1
0 0 1
0 0 1
element neighbours:
1 3 -1
2 0 -1
3 1 -1
0 2 -1
DIM: 3
DIM_OF_WORLD: 3
number of vertices: 8
number of elements: 6
vertex coordinates:
0.0 0.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
1.0 1.0 0.0
1.0 1.0 1.0
0.0 1.0 0.0
0.0 1.0 1.0
element vertices:
0 5 4 1
0 5 3 1
0 5 3 2
0 5 4 6
0 5 7 6
0 5 7 2
element boundaries:
1 1 0 0
1 1 0 0
1 1 0 0
1 1 0 0
1 1 0 0
1 1 0 0
element neighbours:
-1 -1 1 3
-1 -1 0 2
-1 -1 5 1
-1 -1 4 0
-1 -1 3 5
-1 -1 2 4
DIM: 1
DIM_OF_WORLD: 2
number of elements: 5
number of vertices: 5
vertex coordinates:
0.4 0.45
0.7 0.4
0.65 0.85
0.55 0.7
0.4 0.8
element vertices:
0 1
1 2
2 3
3 4
4 0
element boundaries:
0 0
0 0
0 0
0 0
0 0
element neighbours:
1 4
2 0
3 1
4 2
0 3
dim: 2
boxes: 5 5
box-size: 1.0 1.0
y-axis: textual
element-mode: simple
z = 0:
1 1 1 1 1
1 1 0 1 1
1 0 0 0 1
1 1 0 1 1
1 1 1 1 1
This diff is collapsed.
DIM: 1
DIM_OF_WORLD: 2
number of elements: 69
number of vertices: 69
vertex coordinates:
0.05 0.5788191064
0.95 0.5788191064
0.05 0.3538191064
0.95 0.3538191064
0.07903225806 0.5995736968
0.1080645161 0.6223584304
0.1370967742 0.640212816
0.1661290323 0.6461808936
0.1951612904 0.6365920916
0.2241935484 0.6168525729
0.2532258065 0.593922829
0.2822580645 0.5742014367
0.3112903226 0.5522867645
0.3403225806 0.5300820718
0.3693548387 0.51454785
0.3983870968 0.5125222383
0.4274193549 0.5253012655
0.4564516129 0.5464908865
0.485483871 0.5691306099
0.514516129 0.588507603
0.5435483871 0.6111473264
0.5725806451 0.6323369474
0.6016129032 0.6451159746
0.6306451613 0.6430903629
0.6596774194 0.6275561411
0.6887096774 0.6053514484
0.7177419355 0.5834367762
0.7467741935 0.5637153838
0.7758064516 0.54078564
0.8048387096 0.5210461213
0.8338709677 0.5114573193
0.8629032259 0.5174253969
0.8919354839 0.5352797825
0.9209677419 0.5580645161
0.95 0.5413191064
0.95 0.5038191064
0.95 0.4663191064
0.95 0.4288191065
0.95 0.3913191064
0.9153846154 0.3538191064
0.8807692308 0.3538191064
0.8461538462 0.3538191064
0.8115384615 0.3538191064
0.776923077 0.3538191064
0.7423076923 0.3538191064
0.7076923077 0.3538191064
0.673076923 0.3538191064
0.6384615385 0.3538191064
0.6038461538 0.3538191064
0.5692307692 0.3538191064
0.5346153847 0.3538191064
0.5 0.3538191064
0.4653846153 0.3538191064
0.4307692308 0.3538191064
0.3961538462 0.3538191064
0.3615384615 0.3538191064
0.326923077 0.3538191064
0.2923076923 0.3538191064
0.2576923077 0.3538191064
0.223076923 0.3538191064
0.1884615385 0.3538191064
0.1538461538 0.3538191064
0.1192307692 0.3538191064
0.08461538462 0.3538191064
0.05 0.3913191064
0.05 0.4288191065
0.05 0.4663191064
0.05 0.5038191064
0.05 0.5413191064
element vertices:
0 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 1
1 34
34 35
35 36
36 37
37 38
38 3
3 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
52 53
53 54
54 55
55 56
56 57
57 58
58 59
59 60
60 61
61 62
62 63
63 2
2 64
64 65
65 66
66 67
67 68
68 0
element boundaries:
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
element neighbours:
1 68
2 0
3 1
4 2
5 3
6 4
7 5
8 6
9 7
10 8
11 9
12 10
13 11
14 12
15 13
16 14
17 15
18 16
19 17
20 18
21 19
22 20
23 21
24 22
25 23
26 24
27 25
28 26
29 27
30 28
31 29
32 30
33 31
34 32
35 33
36 34
37 35
38 36
39 37
40 38
41 39
42 40
43 41
44 42
45 43
46 44
47 45
48 46
49 47
50 48
51 49
52 50
53 51
54 52
55 53
56 54
57 55
58 56
59 57
60 58
61 59
62 60
63 61
64 62
65 63
66 64
67 65
68 66
0 67
//This example creates an implicit mesh from a single explicit surface mesh (2d or 3d).
//Change the parameters above the line to your liking.
//the file you want to generate:
{resultMesh} = implicit.vtu
//your macro file to be refined:
{implicitMesh} = examples/data/macro.stand.2d
//your surface-mesh:
{sm} = examples/data/wave.2d
//maximal and minimal level of refined elements:
{min_refinement_level} = 0
{max_refinement_level} = 12
//phasefield-epsilon:
{epsilon} = 0.05
//-------------------------------------------------------------------
show_progress
read[{implicitMesh}, impl_mesh]
read[{sm}, sm]
//refine and generate signed-distance function:
refine[impl_mesh, sm, dist, {min_refinement_level}, {max_refinement_level}]
//generate phasefields:
copy_vector[dist, phi]
signdist_to_phi[phi, {epsilon}]
//write result to disk:
write[{resultMesh}, impl_mesh, dist, phi]
show_overall_time
//This example creates an implicit mesh from a voxel file.
//Change the parameters above the line to your liking.
//the file you want to generate:
{resultMesh} = implicit.vtu
//your macro file to be refined:
{implicitMesh} = examples/data/macro.stand.3d
//your voxeldata:
{voxeldata} = examples/data/voxel.txt
//maximal and minimal level of refined elements:
{min_refinement_level} = 12
{max_refinement_level} = 20
//segment
{threshold} = 1
{x1} = -5
{y1} = -5
{z1} = 0
{x2} = 105
{y2} = 105
{z2} = 100
//-------------------------------------------------------------------
show_progress
read[{implicitMesh}, m]
read_voxel_file[{voxeldata}, {threshold}, {x1}, {y1}, {z1}, {x2}, {y2}, {z2}]
voxel_refine[m, dist, {min_refinement_level}, {max_refinement_level}]
write[{resultMesh}, m, dist]
show_overall_time
//This example creates an implicit mesh from multiple explicit surface meshes (2d or 3d).
//Change the parameters above the line to your liking.
//the file you want to generate:
{resultMesh} = implicit_multi_surface.vtu
//your macro file to be refined:
{implicitMesh} = examples/data/macro.stand.2d
//your surface-meshes:
{surfaceMesh1} = examples/data/wave.2d
{surfaceMesh2} = examples/data/pentagon.2d
//maximal and minimal level of refined elements:
{min_refinement_level} = 0
{max_refinement_level} = 12
//phasefield-epsilon:
{epsilon} = 0.05
//-------------------------------------------------------------------
show_progress
read[{implicitMesh}, impl_mesh]
for[{i}, #(1, 100)]
if[{surfaceMesh{i}} undefined] break end
read[{surfaceMesh{i}}, sm{i}]
add_mesh[sum_mesh, sm{i}]
end
print
//write the combined surface mesh to file if desired (otherwise comment next line out):
//write[sum.vtu, sum_mesh]
//refine and generate sigend-distance functions:
refine[impl_mesh, sum_mesh, dist0, {min_refinement_level}, {max_refinement_level}]
for[{i}, #(1, 100)]
if[{surfaceMesh{i}} undefined] break end
refine[impl_mesh, sm{i}, dist{i}, 0, 0]
end
print
//generate phasefields:
{surfaceMesh0} = x
for({i}, 0, #(1, 100))
if[{surfaceMesh{i}} undefined] break end
copy_vector[dist{i}, phi{i}]
signdist_to_phi[phi{i}, {epsilon}]
if[{i} >= 1]
max[max_phi, max_phi, phi{i}]
min[min_phi, min_phi, phi{i}]
end
{vecs} += ", dist{i}, phi{i}"
end
{vecs} += ", max_phi, min_phi"
print
//write result to disk:
write[{resultMesh}, impl_mesh {vecs}]
show_overall_time
//This example creates an implicit mesh from multiple explicit surface meshes (2d or 3d) with
//differing refinement-levels for each surface.
//Change the parameters above the line to your liking.
//the file you want to generate:
{resultMesh} = implicit_multi_level.vtu
//your base-mesh to be refined:
{implicitMesh} = examples/data/macro.stand.2d
//your surface-meshes:
{surfaceMesh1} = examples/data/wave.2d
{level1} = 10
{interface_width1} = 0.0
{epsilon1} = 0.1
{surfaceMesh2} = examples/data/pentagon.2d
{level2} = 12
{interface_width2} = 0.03
{epsilon2} = 0.05
//minimal level of refined elements:
{min_refinement_level} = 0
//-------------------------------------------------------------------
show_progress
read[{implicitMesh}, impl_mesh]
for[{i}, #(1, 100)]
if[{surfaceMesh{i}} undefined] break end
read[{surfaceMesh{i}}, sm{i}]
refine[impl_mesh, sm{i}, dummy{i}, {min_refinement_level}, {level{i}}, {interface_width{i}}]
delete_vector[dummy{i}]
end
for[{i}, #(1, 100)]
if[{surfaceMesh{i}} undefined] break end
refine[impl_mesh, sm{i}, dist{i}, 0, 0]
copy_vector[dist{i}, phi{i}]
signdist_to_phi[phi{i}, {epsilon{i}}]
max[max_phi, max_phi, phi{i}]
min[min_phi, min_phi, phi{i}]
{vecs} += ", dist{i}, phi{i}"
end
{vecs} += ", max_phi, min_phi"
//write result to disk:
write[{resultMesh}, impl_mesh {vecs}]
show_overall_time
//This example creates an AMDiS mesh with definitions for periodic boundaries from a
//box-tile-file (2d or 3d).
//Change the parameters above the line to your liking.