Loading...
Searching...
No Matches
volcartesian_example_00001.cpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
36#include <array>
37#if BITPIT_ENABLE_MPI==1
38#include <mpi.h>
39#endif
40
41#include "bitpit_volcartesian.hpp"
42
43using namespace bitpit;
44
45int main(int argc, char *argv[]) {
46
47 std::cout << "Creating a 2D Cartesian patch" << "\n";
48
49#if BITPIT_ENABLE_MPI==1
50 MPI_Init(&argc,&argv);
51#endif
52
53 std::array<double, 3> origin = {{0., 0., 0.}};
54 double length = 20;
55 double dh = 0.5;
56
57 try {
58 VolCartesian *patch_2D = new VolCartesian(0, 2, origin, length, dh);
59 patch_2D->getVTK().setName("cartesian_2D_patch");
60 patch_2D->update();
61 patch_2D->write();
62 } catch (const std::exception &exception) {
63 log::cout() << exception.what();
64 exit(1);
65 }
66
67#if BITPIT_ENABLE_MPI==1
68 MPI_Finalize();
69#endif
70
71}
std::vector< adaption::Info > update(bool trackAdaption=true, bool squeezeStorage=false)
VTKUnstructuredGrid & getVTK()
void write(VTKWriteMode mode=VTKWriteMode::DEFAULT)
void setName(const std::string &)
Definition VTK.cpp:119
The VolCartesian defines a Cartesian patch.
Logger & cout(log::Level defaultSeverity, log::Visibility defaultVisibility)
Definition logger.cpp:1705
--- layout: doxygen_footer ---