Loading...
Searching...
No Matches
volcartesian_example_00001.cpp

Use volcartesian to create a 2D Cartesian patch.

Use volcartesian to create a 2D Cartesian patchThis example creates a 2D Cartesian patch on the square domain [-10,10]x[-10,10]. The domain is discretized with a cell size of 0.5 both in x and y directions.

To run: ./volcartesian_example_00001

/*---------------------------------------------------------------------------*\
*
* bitpit
*
* Copyright (C) 2015-2021 OPTIMAD engineering Srl
*
* -------------------------------------------------------------------------
* License
* This file is part of bitpit.
*
* bitpit is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License v3 (LGPL)
* as published by the Free Software Foundation.
*
* bitpit is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with bitpit. If not, see <http://www.gnu.org/licenses/>.
*
\*---------------------------------------------------------------------------*/
#include <array>
#if BITPIT_ENABLE_MPI==1
#include <mpi.h>
#endif
#include "bitpit_volcartesian.hpp"
using namespace bitpit;
int main(int argc, char *argv[]) {
std::cout << "Creating a 2D Cartesian patch" << "\n";
#if BITPIT_ENABLE_MPI==1
MPI_Init(&argc,&argv);
#endif
std::array<double, 3> origin = {{0., 0., 0.}};
double length = 20;
double dh = 0.5;
try {
VolCartesian *patch_2D = new VolCartesian(0, 2, origin, length, dh);
patch_2D->getVTK().setName("cartesian_2D_patch");
patch_2D->update();
patch_2D->write();
} catch (const std::exception &exception) {
log::cout() << exception.what();
exit(1);
}
#if BITPIT_ENABLE_MPI==1
MPI_Finalize();
#endif
}
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.
--- layout: doxygen_footer ---