Directory: | ./ |
---|---|
File: | Executable/generate_contour.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 17 | 21 | 81.0% |
Branches: | 24 | 60 | 40.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // ______ ______ _ _ _____ ______ | ||
2 | // | ____| ____| | (_)/ ____| | ____| | ||
3 | // | |__ | |__ | | _| (___ ___| |__ | ||
4 | // | __| | __| | | | |\___ \ / __| __| | ||
5 | // | | | |____| |____| |____) | (__| |____ | ||
6 | // |_| |______|______|_|_____/ \___|______| | ||
7 | // Finite Elements for Life Sciences and Engineering | ||
8 | // | ||
9 | // License: LGL2.1 License | ||
10 | // FELiScE default license: LICENSE in root folder | ||
11 | // | ||
12 | // Main authors: Vicente Mataix Ferrandiz | ||
13 | // | ||
14 | |||
15 | // System includes | ||
16 | |||
17 | // External includes | ||
18 | |||
19 | // Project includes | ||
20 | #include "Core/filesystemUtil.hpp" | ||
21 | #include "InputOutput/io.hpp" | ||
22 | #include "Geometry/geometricMeshRegion.hpp" | ||
23 | #include "Tools/contour_utilities.hpp" | ||
24 | #include "Tools/simple_cmd.hpp" | ||
25 | |||
26 | 1 | int main(int argc, const char* argv[]) | |
27 | { | ||
28 | struct Options | ||
29 | { | ||
30 | std::string InputFile{""}; | ||
31 | bool ImposeParentReferences{false}; | ||
32 | }; | ||
33 | |||
34 | 3 | auto parser = CmdOptions<Options>::Create({ | |
35 | {"--file", &Options::InputFile }, | ||
36 | {"--parent_references", &Options::ImposeParentReferences } | ||
37 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
|
1 | }); |
38 | |||
39 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | auto options = parser->parse(argc, argv); |
40 | |||
41 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | if (options.InputFile == "") { |
42 | ✗ | std::cout << "The following input values must be set: " << std::endl; | |
43 | ✗ | std::cout << "\tInput file:\t--file"<< std::endl; | |
44 | ✗ | std::cout << "\tParent references:\t--parent_references"<< std::endl; | |
45 | ✗ | return 1; | |
46 | } | ||
47 | |||
48 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | std::cout << "The following input values has been considered" << std::endl; |
49 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
|
1 | std::cout << "\tInput file =\t" << options.InputFile << std::endl; |
50 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
|
1 | std::cout << "\tParent references imposed =\t" << options.ImposeParentReferences << std::endl; |
51 | |||
52 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | std::string current_path = std::filesystem::current_path(); |
53 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | current_path += "/"; |
54 |
4/8✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
|
2 | auto p_io = felisce::make_shared<felisce::IO>( current_path, options.InputFile + ".mesh" , options.InputFile + ".mesh", options.InputFile + ".out.mesh", current_path, current_path, "extrude_"); |
55 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | auto p_mesh_region = felisce::make_shared<felisce::GeometricMeshRegion>(); |
56 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | p_io->readMesh(*p_mesh_region, 1.0); |
57 | |||
58 | // Generate the contour | ||
59 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | felisce::ContourUtilities::GenerateContourMesh(*p_mesh_region, options.ImposeParentReferences); |
60 | |||
61 | // Export mesh | ||
62 |
1/2✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | p_io->writeOutput(*p_mesh_region, 0); |
63 | |||
64 | |||
65 | 1 | return 0; | |
66 | 1 | } | |
67 |