Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Grid_SiloParticleOutput.hpp
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (c) 2018-2023 by the Cabana authors *
3 * All rights reserved. *
4 * *
5 * This file is part of the Cabana library. Cabana is distributed under a *
6 * BSD 3-clause license. For the licensing terms see the LICENSE file in *
7 * the top-level directory. *
8 * *
9 * SPDX-License-Identifier: BSD-3-Clause *
10 ****************************************************************************/
11
16
17#ifndef CABANA_GRID_SILOPARTICLEOUTPUT_HPP
18#define CABANA_GRID_SILOPARTICLEOUTPUT_HPP
19
21
23#include <Cabana_Slice.hpp>
24
25#include <Kokkos_Core.hpp>
26
27#include <silo.h>
28
29#include <mpi.h>
30
31#include <pmpio.h>
32
33namespace Cabana
34{
35namespace Grid
36{
37namespace Experimental
38{
39namespace SiloParticleOutput
40{
52template <class GlobalGridType, class CoordSliceType, class... FieldSliceTypes>
53void writePartialRangeTimeStep( const std::string& prefix,
54 const GlobalGridType& global_grid,
55 const int time_step_index, const double time,
56 const std::size_t begin, const std::size_t end,
57 const CoordSliceType& coords,
58 FieldSliceTypes&&... fields )
59{
60 // Pick a number of groups. We want to write approximately the N^3 blocks
61 // to N^2 groups. Pick the block dimension with the largest number of
62 // ranks as the number of groups. We may want to tweak this as an optional
63 // input later with this behavior as the default.
64 int num_group = 0;
65 for ( int d = 0; d < 3; ++d )
66 if ( global_grid.dimNumBlock( d ) > num_group )
67 num_group = global_grid.dimNumBlock( d );
68
69 Cabana::Experimental::SiloParticleOutput::writePartialRangeTimeStep(
70 prefix, global_grid.comm(), num_group, time_step_index, time, begin,
71 end, coords, fields... );
72}
73
83template <class GlobalGridType, class CoordSliceType, class... FieldSliceTypes>
84void writeTimeStep( const std::string& prefix,
85 const GlobalGridType& global_grid,
86 const int time_step_index, const double time,
87 const CoordSliceType& coords, FieldSliceTypes&&... fields )
88{
89 writePartialRangeTimeStep( prefix, global_grid, time_step_index, time, 0,
90 coords.size(), coords, fields... );
91}
92
93} // namespace SiloParticleOutput
94} // namespace Experimental
95} // namespace Grid
96} // namespace Cabana
97
98#endif // CABANA_GRID_SILOPARTICLEOUTPUT_HPP
void writeTimeStep(const std::string &prefix, const GlobalGridType &global_grid, const int time_step_index, const double time, const CoordSliceType &coords, FieldSliceTypes &&... fields)
Write output in Silo format for all particles using mesh information.
Definition Cabana_Grid_SiloParticleOutput.hpp:84
void writePartialRangeTimeStep(const std::string &prefix, const GlobalGridType &global_grid, const int time_step_index, const double time, const std::size_t begin, const std::size_t end, const CoordSliceType &coords, FieldSliceTypes &&... fields)
Write particle output in Silo format using mesh information.
Definition Cabana_Grid_SiloParticleOutput.hpp:53
Write particle output using the Silo format.
Slice a single particle property from an AoSoA.
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36