42 if (
data !=
nullptr) {
78 if (
data !=
nullptr) {
87 if (
data->rowidx == 0)
90 data->rowidx = tmp %
data->num_rows ();
91 data->colidx = tmp /
data->num_rows ();
92 data->global_cell_idx = tmp;
93 data->local_cell_idx = tmp -
94 (
data->start_cell_row () +
95 data->num_rows () *
data->start_cell_col ());
98 if (
data->rowidx ==
data->num_rows () - 1)
105 if (
data->colidx == 1)
112 if (
data->colidx ==
data->num_cols () - 1) {
121 data->rowidx = tmp %
data->num_rows ();
122 data->colidx = tmp /
data->num_rows ();
123 data->global_cell_idx = tmp;
124 data->local_cell_idx = tmp -x
125 (
data->start_cell_row () +
126 data->num_rows () *
data->start_cell_col ());
168 static idx_t glob = 0;
215 if (
row_idx () == 0 && iedge == 0)
221 if (
col_idx () == 0 && iedge == 2)
243 throw std::out_of_range (
"inode must be in range 0..3");
285 throw std::out_of_range (
"inode must be in range 0..3, idir must be either 0 or 1");
346 const std::map<std::string, T> & f)
const {
348 std::ofstream ofs (filename, std::ofstream::out);
353 "<VTKFile type=\"StructuredGrid\" version=\"StructuredGrid\" byte_order=\"LittleEndian\">\n\
354 <StructuredGrid WholeExtent=\"0 " <<
num_rows() <<
" 0 " <<
num_cols() <<
" 0 0\">\n \
357 ofs <<
" <PointData Scalars=\"";
358 for (
auto const & ii : f) {
359 ofs << ii.first <<
",";
363 for (
auto const & ii : f) {
364 ofs <<
" <DataArray type=\"Float64\" Name=\"" << ii.first <<
"\" format=\"ascii\">\n ";
365 for (
auto const & jj : ii.second) {
368 ofs << std::endl <<
" </DataArray>" << std::endl;
371 ofs <<
" </PointData>\n";
373 ofs <<
" <Points>\n <DataArray type=\"Float64\" NumberOfComponents=\"3\" format=\"ascii\">\n";
377 ofs << std::setprecision(16) <<
hx()*ii <<
" " <<
hy()*jj <<
" 0 ";
381 ofs <<
" </DataArray>\n </Points>\n";
396(
const char *filename,
397 std::map<std::string, T>
const & vars)
const {
399 std::ofstream os (filename, std::ofstream::out);
401 os <<
"# name: p" << std::endl
402 <<
"# type: matrix" << std::endl
403 <<
"# rows: 2" << std::endl
408 os << std::setprecision(16) << jj*
hx() <<
" ";
415 os << std::setprecision(16) << ii*
hy() <<
" ";
420 os <<
"# name: t" << std::endl
421 <<
"# type: matrix" << std::endl
422 <<
"# rows: 4" << std::endl
429 os << std::setprecision(16) << icell->gt(inode) <<
" ";
435 os <<
"# name: vars" << std::endl
436 <<
"# type: scalar struct" << std::endl
437 <<
"# ndims: 2" << std::endl
438 <<
"1 1" << std::endl
439 <<
"# length: " << vars.size () << std::endl;
442 for (
auto const & ii : vars) {
443 os <<
"# name: " << ii.first << std::endl
444 <<
"# type: matrix" << std::endl
445 <<
"# rows: 1" << std::endl
446 <<
"# columns: " << ii.second.size () << std::endl;
447 for (
auto const & kk : ii.second) {
448 os << std::setprecision(16) << kk <<
" ";
idx_t start_cell_row() const
idx_t end_cell_col() const
static constexpr idx_t NOT_ON_BOUNDARY
real_t shg(real_t x, real_t y, idx_t idir, idx_t inode) const
real_t p(idx_t i, idx_t j) const
static constexpr idx_t edges_per_cell
idx_t end_cell_row() const
const grid_properties_t & grid_properties
static constexpr idx_t nodes_per_cell
real_t shp(real_t x, real_t y, idx_t inode) const
idx_t start_cell_col() const
cell_t * data
Face index in 0...3 (-1 if not defined).
const cell_t & operator[](idx_t tmp) const
idx_t num_local_cells() const
HOST static DEVICE real_t p(idx_t idir, idx_t inode, idx_t colidx, idx_t rowidx, real_t hx, real_t hy)
void vtk_export(const char *filename, const std::map< std::string, distributed_vector > &f) const
void set_sizes(idx_t numrows, idx_t numcols, real_t hx, real_t hy)
idx_t num_local_nodes() const
idx_t num_global_nodes() const
HOST static DEVICE real_t shp(real_t x, real_t y, idx_t inode, idx_t c, idx_t r, real_t hx, real_t hy)
HOST static DEVICE real_t shg(real_t x, real_t y, idx_t idir, idx_t inode, idx_t c, idx_t r, real_t hx, real_t hy)
cell_iterator begin_cell_sweep()
void octave_ascii_export(const char *filename, const std::map< std::string, distributed_vector > &f) const
grid_properties_t grid_properties
cell_iterator end_cell_sweep()
idx_t num_global_cells() const