| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2022 Inria | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are met: | ||
| 7 | * | ||
| 8 | * * Redistributions of source code must retain the above copyright notice, | ||
| 9 | * this list of conditions and the following disclaimer. | ||
| 10 | * * Redistributions in binary form must reproduce the above copyright notice, | ||
| 11 | * this list of conditions and the following disclaimer in the documentation | ||
| 12 | * and/or other materials provided with the distribution. | ||
| 13 | * * Neither the name of the ALICE Project-Team nor the names of its | ||
| 14 | * contributors may be used to endorse or promote products derived from this | ||
| 15 | * software without specific prior written permission. | ||
| 16 | * | ||
| 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
| 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 27 | * POSSIBILITY OF SUCH DAMAGE. | ||
| 28 | * | ||
| 29 | * Contact: Bruno Levy | ||
| 30 | * | ||
| 31 | * https://www.inria.fr/fr/bruno-levy | ||
| 32 | * | ||
| 33 | * Inria, | ||
| 34 | * Domaine de Voluceau, | ||
| 35 | * 78150 Le Chesnay - Rocquencourt | ||
| 36 | * FRANCE | ||
| 37 | * | ||
| 38 | */ | ||
| 39 | |||
| 40 | |||
| 41 | #include <geogram/basic/common.h> | ||
| 42 | #include <geogram/basic/logger.h> | ||
| 43 | #include <geogram/basic/command_line.h> | ||
| 44 | #include <geogram/basic/command_line_args.h> | ||
| 45 | #include <geogram/mesh/mesh.h> | ||
| 46 | #include <geogram/mesh/mesh_io.h> | ||
| 47 | |||
| 48 | // Tests support of large geofiles. | ||
| 49 | |||
| 50 | 1 | int main(int argc, char** argv) { | |
| 51 | using namespace GEO; | ||
| 52 | |||
| 53 | 1 | GEO::initialize(GEO::GEOGRAM_INSTALL_ALL); | |
| 54 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | CmdLine::import_arg_group("standard"); |
| 55 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | if(!CmdLine::parse(argc, argv)) { |
| 56 | return 1; | ||
| 57 | } | ||
| 58 | try { | ||
| 59 | index_t nb_vertices = 0; | ||
| 60 | { | ||
| 61 |
4/10✓ 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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
2 | CmdLine::ui_separator("Write large geofile"); |
| 62 | index_t cell_nu = 744; | ||
| 63 | index_t cell_nv = 744; | ||
| 64 | index_t cell_nw = 376; | ||
| 65 | index_t node_nu = cell_nu + 1; | ||
| 66 | index_t node_nv = cell_nv + 1; | ||
| 67 | index_t node_nw = cell_nw + 1; | ||
| 68 | |||
| 69 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | Mesh M; |
| 70 |
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.
|
2 | Logger::out("geofile") << "Create vertices" << std::endl; |
| 71 | |||
| 72 | M.vertices.create_vertices(node_nu* node_nv* node_nw); | ||
| 73 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Logger::out("geofile") << "Init vertices" << std::endl; |
| 74 | |||
| 75 |
2/2✓ Branch 0 taken 377 times.
✓ Branch 1 taken 1 times.
|
378 | FOR(k, node_nw) { |
| 76 |
2/2✓ Branch 0 taken 280865 times.
✓ Branch 1 taken 377 times.
|
281242 | FOR(j, node_nv) { |
| 77 |
2/2✓ Branch 0 taken 209244425 times.
✓ Branch 1 taken 280865 times.
|
209525290 | FOR (i, node_nu) { |
| 78 | 209244425 | M.vertices.point( | |
| 79 | 209244425 | node_nu* node_nv*k + j* node_nu + i | |
| 80 | 209244425 | ) = vec3( | |
| 81 | 209244425 | double(i) / double(node_nu), | |
| 82 | 209244425 | double(j) / double(node_nv), | |
| 83 | 209244425 | double(k) / double(node_nw) | |
| 84 | ); | ||
| 85 | } | ||
| 86 | } | ||
| 87 | } | ||
| 88 | |||
| 89 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | Logger::out("geofile") << "save" << std::endl; |
| 90 |
5/12✓ 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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
3 | if(!mesh_save(M, "bigfile.geogram")) { |
| 91 | ✗ | Logger::err("geofile") << "Could not save file" << std::endl; | |
| 92 | return 1; | ||
| 93 | } | ||
| 94 | nb_vertices = M.vertices.nb(); | ||
| 95 | 1 | } | |
| 96 | |||
| 97 | { | ||
| 98 |
4/10✓ 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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
2 | CmdLine::ui_separator("Read large geofile"); |
| 99 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | Mesh M; |
| 100 |
5/12✓ 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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
3 | if(!mesh_load("bigfile.geogram", M)) { |
| 101 | ✗ | Logger::err("geofile") << "Could not load file" << std::endl; | |
| 102 | ✗ | return 1; | |
| 103 | } | ||
| 104 | |||
| 105 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(M.vertices.nb() != nb_vertices) { |
| 106 | ✗ | Logger::err("geofile") << "Invalid number of vertices" | |
| 107 | << std::endl; | ||
| 108 | ✗ | return 1; | |
| 109 | } | ||
| 110 | 1 | } | |
| 111 | ✗ | } catch(const std::exception& e) { | |
| 112 | ✗ | std::cerr << "Received an exception: " << e.what() << std::endl; | |
| 113 | return 1; | ||
| 114 | ✗ | } | |
| 115 | |||
| 116 | 1 | return 0; | |
| 117 | } | ||
| 118 |