Discontinuous Galerkin Library
#include "dg/algorithm.h"
grid.h
Go to the documentation of this file.
1#pragma once
2
3#include <cassert>
4#include <cmath>
5#include <thrust/host_vector.h>
7#include "dlt.h"
8#include "../enums.h"
9
64namespace dg{
65
67template<class real_type>
68struct RealGrid2d;
69template<class real_type>
70struct RealGrid3d;
72
78template<class real_type>
80{
81 using value_type = real_type;
83 using host_vector = thrust::host_vector<real_type>;
89 RealGrid1d() = default;
100 RealGrid1d( real_type x0, real_type x1, unsigned n, unsigned N, bc bcx = PER)
101 {
102 set(x0,x1,bcx);
103 set(n,N);
104 }
106
111 real_type x0() const {return x0_;}
117 real_type x1() const {return x1_;}
123 real_type lx() const {return x1_-x0_;}
129 real_type h() const {return lx()/(real_type)Nx_;}
135 unsigned N() const {return Nx_;}
141 unsigned n() const {return n_;}
147 bc bcx() const {return bcx_;}
149
156 void set(real_type x0, real_type x1, bc bcx)
157 {
158 assert( x1 > x0 );
159 x0_=x0, x1_=x1;
160 bcx_=bcx;
161 }
168 void set( unsigned n, unsigned N)
169 {
170 assert( N > 0 );
171 Nx_=N; n_=n;
172 dlt_=DLT<real_type>(n);
173 }
183 void set( real_type x0, real_type x1, unsigned n, unsigned N, bc bcx)
184 {
185 set(x0,x1,bcx);
186 set(n,N);
187 }
189
191 unsigned size() const { return n_*Nx_;}
197 const DLT<real_type>& dlt() const {return dlt_;}
198 void display( std::ostream& os = std::cout) const
199 {
200 os << "Topology parameters are: \n"
201 <<" n = "<<n_<<"\n"
202 <<" N = "<<Nx_<<"\n"
203 <<" h = "<<h()<<"\n"
204 <<" x0 = "<<x0_<<"\n"
205 <<" x1 = "<<x1_<<"\n"
206 <<" lx = "<<lx()<<"\n"
207 <<"Boundary conditions in x are: \n"
208 <<" "<<bc2str(bcx_)<<"\n";
209 }
210
214 void shift( bool& negative, real_type& x)const
215 {
216 shift( negative, x, bcx_);
217 }
222 void shift( bool& negative, real_type &x, bc bcx)const
223 {
224 if( bcx == dg::PER)
225 {
226 real_type N = floor((x-x0_)/(x1_-x0_)); // ... -2[ -1[ 0[ 1[ 2[ ...
227 x = x - N*(x1_-x0_); //shift
228 }
229 //mirror along boundary as often as necessary
230 while( (x<x0_) || (x>x1_) )
231 {
232 if( x < x0_){
233 x = 2.*x0_ - x;
234 //every mirror swaps the sign if Dirichlet
235 if( bcx == dg::DIR || bcx == dg::DIR_NEU)
236 negative = !negative;//swap sign
237 }
238 if( x > x1_){
239 x = 2.*x1_ - x;
240 if( bcx == dg::DIR || bcx == dg::NEU_DIR) //notice the different boundary NEU_DIR to the above DIR_NEU !
241 negative = !negative; //swap sign
242 }
243 }
244 }
245
255 bool contains( real_type x)const
256 {
257 if( !std::isfinite(x) ) return false;
258 //should we catch the case x1_==x && dg::PER?
259 if( (x>=x0_ && x <= x1_)) return true;
260 return false;
261 }
262
263 private:
264 real_type x0_, x1_;
265 unsigned n_, Nx_;
266 bc bcx_;
267 DLT<real_type> dlt_;
268};
269
275template<class real_type>
277{
278 using value_type = real_type;
280 using host_vector = thrust::host_vector<real_type>;
282
288 real_type x0() const {return gx_.x0();}
294 real_type x1() const {return gx_.x1();}
300 real_type y0() const {return gy_.x0();}
306 real_type y1() const {return gy_.x1();}
312 real_type lx() const {return gx_.lx();}
318 real_type ly() const {return gy_.lx();}
324 real_type hx() const {return gx_.h();}
330 real_type hy() const {return gy_.h();}
336 unsigned n() const {return gx_.n();}
338 unsigned nx() const {return gx_.n();}
340 unsigned ny() const {return gy_.n();}
346 unsigned Nx() const {return gx_.N();}
352 unsigned Ny() const {return gy_.N();}
358 bc bcx() const {return gx_.bcx();}
364 bc bcy() const {return gy_.bcx();}
370 //const DLT<real_type>& dlt() const{return gx_.dlt();}
372 const DLT<real_type>& dltx() const{return gx_.dlt();}
374 const DLT<real_type>& dlty() const{return gy_.dlt();}
375
377 const RealGrid1d<real_type>& gx() const {return gx_;}
379 const RealGrid1d<real_type>& gy() const {return gy_;}
380
389 void multiplyCellNumbers( real_type fx, real_type fy){
390 if( fx != 1 || fy != 1)
391 do_set(nx(), round(fx*(real_type)Nx()), ny(), round(fy*(real_type)Ny()));
392 }
401 void set( unsigned new_n, unsigned new_Nx, unsigned new_Ny) {
402 set( new_n, new_Nx, new_n, new_Ny);
403 }
412 void set( unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny) {
413 if( new_nx==nx() && new_Nx==Nx() && new_ny==ny() && new_Ny == Ny())
414 return;
415 do_set(new_nx,new_Nx,new_ny,new_Ny);
416 }
417
418
424 unsigned size() const { return gx_.size()*gy_.size();}
430 void display( std::ostream& os = std::cout) const
431 {
432 os << "Topology parameters are: \n"
433 <<" nx = "<<nx()<<"\n"
434 <<" ny = "<<ny()<<"\n"
435 <<" Nx = "<<Nx()<<"\n"
436 <<" Ny = "<<Ny()<<"\n"
437 <<" hx = "<<hx()<<"\n"
438 <<" hy = "<<hy()<<"\n"
439 <<" x0 = "<<x0()<<"\n"
440 <<" x1 = "<<x1()<<"\n"
441 <<" y0 = "<<y0()<<"\n"
442 <<" y1 = "<<y1()<<"\n"
443 <<" lx = "<<lx()<<"\n"
444 <<" ly = "<<ly()<<"\n"
445 <<"Boundary conditions in x are: \n"
446 <<" "<<bc2str(bcx())<<"\n"
447 <<"Boundary conditions in y are: \n"
448 <<" "<<bc2str(bcy())<<"\n";
449 }
454 void shift( bool& negative, real_type& x, real_type& y)const
455 {
456 shift( negative, x, y, bcx(), bcy());
457 }
464 void shift( bool& negative, real_type& x, real_type& y, bc bcx, bc bcy)const
465 {
466 gx_.shift( negative, x,bcx);
467 gy_.shift( negative, y,bcy);
468 }
478 bool contains( real_type x, real_type y)const
479 {
480 if( gx_.contains(x) && gy_.contains(y)) return true;
481 return false;
482 }
484 template<class Vector>
485 bool contains( const Vector& x) const{
486 return contains( x[0], x[1]);
487 }
488 protected:
490 ~aRealTopology2d() = default;
501
504 aRealTopology2d(const aRealTopology2d& src) = default;
508 virtual void do_set( unsigned new_nx, unsigned new_Nx, unsigned new_ny,
509 unsigned new_Ny)=0;
510 private:
511 RealGrid1d<real_type> gx_, gy_;
512};
513
514
515
521template<class real_type>
523{
524 using value_type = real_type;
526 using host_vector = thrust::host_vector<real_type>;
528
534 real_type x0() const {return gx_.x0();}
540 real_type x1() const {return gx_.x1();}
541
547 real_type y0() const {return gy_.x0();}
553 real_type y1() const {return gy_.x1();}
554
560 real_type z0() const {return gz_.x0();}
566 real_type z1() const {return gz_.x1();}
567
573 real_type lx() const {return gx_.lx();}
579 real_type ly() const {return gy_.lx();}
585 real_type lz() const {return gz_.lx();}
586
592 real_type hx() const {return gx_.h();}
598 real_type hy() const {return gy_.h();}
604 real_type hz() const {return gz_.h();}
610 unsigned n() const {return gx_.n();}
612 unsigned nx() const {return gx_.n();}
614 unsigned ny() const {return gy_.n();}
616 unsigned nz() const {return gz_.n();}
622 unsigned Nx() const {return gx_.N();}
628 unsigned Ny() const {return gy_.N();}
634 unsigned Nz() const {return gz_.N();}
640 bc bcx() const {return gx_.bcx();}
646 bc bcy() const {return gy_.bcx();}
652 bc bcz() const {return gz_.bcx();}
654 const DLT<real_type>& dltx() const{return gx_.dlt();}
656 const DLT<real_type>& dlty() const{return gy_.dlt();}
658 const DLT<real_type>& dltz() const{return gz_.dlt();}
660 const RealGrid1d<real_type>& gx() const {return gx_;}
662 const RealGrid1d<real_type>& gy() const {return gy_;}
664 const RealGrid1d<real_type>& gz() const {return gz_;}
670 unsigned size() const { return gx_.size()*gy_.size()*gz_.size();}
676 void display( std::ostream& os = std::cout) const
677 {
678 os << "Topology parameters are: \n"
679 <<" nx = "<<nx()<<"\n"
680 <<" ny = "<<ny()<<"\n"
681 <<" nz = "<<nz()<<"\n"
682 <<" Nx = "<<Nx()<<"\n"
683 <<" Ny = "<<Ny()<<"\n"
684 <<" Nz = "<<Nz()<<"\n"
685 <<" hx = "<<hx()<<"\n"
686 <<" hy = "<<hy()<<"\n"
687 <<" hz = "<<hz()<<"\n"
688 <<" x0 = "<<x0()<<"\n"
689 <<" x1 = "<<x1()<<"\n"
690 <<" y0 = "<<y0()<<"\n"
691 <<" y1 = "<<y1()<<"\n"
692 <<" z0 = "<<z0()<<"\n"
693 <<" z1 = "<<z1()<<"\n"
694 <<" lx = "<<lx()<<"\n"
695 <<" ly = "<<ly()<<"\n"
696 <<" lz = "<<lz()<<"\n"
697 <<"Boundary conditions in x are: \n"
698 <<" "<<bc2str(bcx())<<"\n"
699 <<"Boundary conditions in y are: \n"
700 <<" "<<bc2str(bcy())<<"\n"
701 <<"Boundary conditions in z are: \n"
702 <<" "<<bc2str(bcz())<<"\n";
703 }
704
710 void shift( bool& negative, real_type& x, real_type& y, real_type& z)const
711 {
712 shift( negative, x,y,z, bcx(), bcy(), bcz());
713 }
722 void shift( bool& negative, real_type& x, real_type& y, real_type& z, bc bcx, bc bcy, bc bcz)const
723 {
724 gx_.shift( negative, x,bcx);
725 gy_.shift( negative, y,bcy);
726 gz_.shift( negative, z,bcz);
727 }
728
739 bool contains( real_type x, real_type y, real_type z)const
740 {
741 if( gx_.contains(x) && gy_.contains(y) && gz_.contains(z))
742 return true;
743 return false;
744 }
746 template<class Vector>
747 bool contains( const Vector& x) const{
748 return contains( x[0], x[1], x[2]);
749 }
751 void multiplyCellNumbers( real_type fx, real_type fy){
752 if( fx != 1 || fy != 1)
753 do_set(nx(), round(fx*(real_type)Nx()), ny(),
754 round(fy*(real_type)Ny()), nz(), Nz());
755 }
766 void set( unsigned new_n, unsigned new_Nx, unsigned new_Ny, unsigned new_Nz) {
767 set(new_n,new_Nx,new_n,new_Ny,1,new_Nz);
768 }
779 void set( unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny, unsigned new_nz, unsigned new_Nz) {
780 if( new_nx==nx() && new_Nx ==Nx() && new_ny == ny() && new_Ny == Ny() && new_nz == nz() && new_Nz==Nz())
781 return;
782 do_set(new_nx,new_Nx,new_ny,new_Ny,new_nz,new_Nz);
783 }
784 protected:
786 ~aRealTopology3d() = default;
798 gx_(gx),gy_(gy),gz_(gz){
799 }
802 aRealTopology3d(const aRealTopology3d& src) = default;
806 virtual void do_set(unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny, unsigned new_nz, unsigned new_Nz)=0;
807 private:
808 RealGrid1d<real_type> gx_,gy_,gz_;
809};
810
816template<class real_type>
817struct RealGrid2d : public aRealTopology2d<real_type>
818{
821 RealGrid2d( real_type x0, real_type x1, real_type y0, real_type y1, unsigned n, unsigned Nx, unsigned Ny, bc bcx = PER, bc bcy = PER):
822 aRealTopology2d<real_type>({x0,x1,n,Nx,bcx},{y0,y1,n,Ny,bcy}) { }
823
826
829 explicit RealGrid2d( const aRealTopology2d<real_type>& src): aRealTopology2d<real_type>(src){}
830 private:
831 virtual void do_set( unsigned nx, unsigned Nx, unsigned ny, unsigned Ny) override final{
833 }
834
835};
836
842template<class real_type>
843struct RealGrid3d : public aRealTopology3d<real_type>
844{
847 RealGrid3d( real_type x0, real_type x1, real_type y0, real_type y1, real_type z0, real_type z1, unsigned n, unsigned Nx, unsigned Ny, unsigned Nz, bc bcx = PER, bc bcy = PER, bc bcz=PER):
848 aRealTopology3d<real_type>({x0,x1,n,Nx,bcx},{y0,y1,n,Ny,bcy},{z0,z1,1,Nz,bcz}) { }
851
854 explicit RealGrid3d( const aRealTopology3d<real_type>& src): aRealTopology3d<real_type>(src){ }
855 private:
856 virtual void do_set( unsigned nx, unsigned Nx, unsigned ny, unsigned Ny,
857 unsigned nz, unsigned Nz) override final{
859 }
860};
861
863template<class real_type>
864void aRealTopology2d<real_type>::do_set( unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny)
865{
866 gx_.set(new_nx, new_Nx);
867 gy_.set(new_ny, new_Ny);
868}
869template<class real_type>
870void aRealTopology3d<real_type>::do_set(unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny, unsigned new_nz, unsigned new_Nz)
871{
872 gx_.set(new_nx, new_Nx);
873 gy_.set(new_ny, new_Ny);
874 gz_.set(new_nz, new_Nz);
875}
876
877template<class Topology>
878using get_host_vector = typename Topology::host_vector;
879
880template<class Topology>
881using get_host_grid = typename Topology::host_grid;
882
884
892#ifndef MPI_VERSION
893namespace x {
894using Grid1d = Grid1d ;
895using Grid2d = Grid2d ;
896using Grid3d = Grid3d ;
897using aTopology2d = aTopology2d ;
898using aTopology3d = aTopology3d ;
899} //namespace x
900#endif
902
903}// namespace dg
Struct holding coefficients for Discrete Legendre Transformation (DLT) related operations.
Definition: dlt.h:23
The discrete legendre trafo class.
bc
Switch between boundary conditions.
Definition: enums.h:15
static std::string bc2str(bc bcx)
write a string describing boundary condition to an output stream
Definition: enums.h:37
@ z
z direction
@ NEU_DIR
Neumann on left, Dirichlet on right boundary.
Definition: enums.h:19
@ PER
periodic boundaries
Definition: enums.h:16
@ DIR
homogeneous dirichlet boundaries
Definition: enums.h:17
@ DIR_NEU
Dirichlet on left, Neumann on right boundary.
Definition: enums.h:18
@ y
y direction
@ x
x direction
dg::RealGrid1d< double > Grid1d
Definition: grid.h:887
MPIGrid3d Grid3d
Definition: mpi_grid.h:760
aMPITopology3d aTopology3d
Definition: mpi_grid.h:762
MPIGrid2d Grid2d
Definition: mpi_grid.h:759
aMPITopology2d aTopology2d
Definition: mpi_grid.h:761
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
1D grid
Definition: grid.h:80
real_type h() const
cell size
Definition: grid.h:129
bc bcx() const
boundary conditions
Definition: grid.h:147
unsigned n() const
number of polynomial coefficients
Definition: grid.h:141
void set(unsigned n, unsigned N)
reset the cell numbers in the grid
Definition: grid.h:168
real_type lx() const
total length of interval
Definition: grid.h:123
const DLT< real_type > & dlt() const
the discrete legendre transformation
Definition: grid.h:197
void shift(bool &negative, real_type &x) const
Shift any point coordinate to a corresponding grid coordinate according to the boundary condition.
Definition: grid.h:214
unsigned size() const
n()*N() (Total number of grid points)
Definition: grid.h:191
void set(real_type x0, real_type x1, unsigned n, unsigned N, bc bcx)
Reset all values of the grid.
Definition: grid.h:183
void shift(bool &negative, real_type &x, bc bcx) const
Shift any point coordinate to a corresponding grid coordinate according to the boundary condition.
Definition: grid.h:222
RealGrid1d()=default
construct an empty grid this leaves the access functions undefined
real_type value_type
Definition: grid.h:81
real_type x1() const
right boundary
Definition: grid.h:117
unsigned N() const
number of cells
Definition: grid.h:135
real_type x0() const
left boundary
Definition: grid.h:111
void display(std::ostream &os=std::cout) const
Definition: grid.h:198
bool contains(real_type x) const
Check if the grid contains a point.
Definition: grid.h:255
thrust::host_vector< real_type > host_vector
The host vector type used by host functions like evaluate.
Definition: grid.h:83
RealGrid1d(real_type x0, real_type x1, unsigned n, unsigned N, bc bcx=PER)
1D grid
Definition: grid.h:100
void set(real_type x0, real_type x1, bc bcx)
reset the boundaries of the grid
Definition: grid.h:156
The simplest implementation of aRealTopology2d.
Definition: grid.h:818
RealGrid2d(const aRealTopology2d< real_type > &src)
allow explicit type conversion from any other topology
Definition: grid.h:829
RealGrid2d(real_type x0, real_type x1, real_type y0, real_type y1, unsigned n, unsigned Nx, unsigned Ny, bc bcx=PER, bc bcy=PER)
Equal polynomial coefficients.
Definition: grid.h:821
RealGrid2d(RealGrid1d< real_type > gx, RealGrid1d< real_type > gy)
Construct a 2d grid as the product of two 1d grids.
Definition: grid.h:825
The simplest implementation of aRealTopology3d.
Definition: grid.h:844
RealGrid3d(const aRealTopology3d< real_type > &src)
allow explicit type conversion from any other topology
Definition: grid.h:854
RealGrid3d(real_type x0, real_type x1, real_type y0, real_type y1, real_type z0, real_type z1, unsigned n, unsigned Nx, unsigned Ny, unsigned Nz, bc bcx=PER, bc bcy=PER, bc bcz=PER)
Equal polynomial coefficients.
Definition: grid.h:847
RealGrid3d(RealGrid1d< real_type > gx, RealGrid1d< real_type > gy, RealGrid1d< real_type > gz)
Construct a 3d topology as the product of three 1d grids.
Definition: grid.h:850
An abstract base class for two-dimensional grids.
Definition: grid.h:277
const DLT< real_type > & dltx() const
discrete legendre trafo
Definition: grid.h:372
unsigned n() const
number of polynomial coefficients in x
Definition: grid.h:336
thrust::host_vector< real_type > host_vector
The host vector type used by host functions like evaluate.
Definition: grid.h:280
void shift(bool &negative, real_type &x, real_type &y, bc bcx, bc bcy) const
Shift any point coordinate to a corresponding grid coordinate according to the boundary condition.
Definition: grid.h:464
void shift(bool &negative, real_type &x, real_type &y) const
Shift any point coordinate to a corresponding grid coordinate according to the boundary condition.
Definition: grid.h:454
real_type ly() const
length of y
Definition: grid.h:318
~aRealTopology2d()=default
disallow destruction through base class pointer
real_type x0() const
Left boundary in x.
Definition: grid.h:288
const DLT< real_type > & dlty() const
discrete legendre transformation in y
Definition: grid.h:374
bool contains(const Vector &x) const
Shortcut for contains( x[0], x[1])
Definition: grid.h:485
void display(std::ostream &os=std::cout) const
Display.
Definition: grid.h:430
real_type y1() const
Right boundary in y.
Definition: grid.h:306
void set(unsigned new_n, unsigned new_Nx, unsigned new_Ny)
Set the number of polynomials and cells.
Definition: grid.h:401
aRealTopology2d & operator=(const aRealTopology2d &src)=default
real_type hy() const
cell size in y
Definition: grid.h:330
const RealGrid1d< real_type > & gy() const
The y-axis grid.
Definition: grid.h:379
real_type value_type
Definition: grid.h:278
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:340
bool contains(real_type x, real_type y) const
Check if the grid contains a point.
Definition: grid.h:478
void multiplyCellNumbers(real_type fx, real_type fy)
Multiply the number of cells with a given factor.
Definition: grid.h:389
bc bcx() const
boundary conditions in x
Definition: grid.h:358
unsigned size() const
The total number of points.
Definition: grid.h:424
aRealTopology2d(const aRealTopology2d &src)=default
real_type hx() const
cell size in x
Definition: grid.h:324
real_type y0() const
left boundary in y
Definition: grid.h:300
aRealTopology2d(RealGrid1d< real_type > gx, RealGrid1d< real_type > gy)
Construct a 2d grid as the product of two 1d grids.
Definition: grid.h:500
real_type lx() const
length of x
Definition: grid.h:312
unsigned Nx() const
number of cells in x
Definition: grid.h:346
bc bcy() const
boundary conditions in y
Definition: grid.h:364
real_type x1() const
Right boundary in x.
Definition: grid.h:294
virtual void do_set(unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny)=0
const RealGrid1d< real_type > & gx() const
The x-axis grid.
Definition: grid.h:377
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:338
void set(unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny)
Set the number of polynomials and cells.
Definition: grid.h:412
unsigned Ny() const
number of cells in y
Definition: grid.h:352
An abstract base class for three-dimensional grids.
Definition: grid.h:523
real_type y0() const
left boundary in y
Definition: grid.h:547
real_type value_type
Definition: grid.h:524
unsigned size() const
The total number of points.
Definition: grid.h:670
const DLT< real_type > & dltz() const
discrete legendre transformation in z
Definition: grid.h:658
const RealGrid1d< real_type > & gz() const
The z-axis grid.
Definition: grid.h:664
const DLT< real_type > & dltx() const
discrete legendre transformation in x
Definition: grid.h:654
void multiplyCellNumbers(real_type fx, real_type fy)
Multiply the number of cells with a given factor.
Definition: grid.h:751
aRealTopology3d(RealGrid1d< real_type > gx, RealGrid1d< real_type > gy, RealGrid1d< real_type > gz)
Construct a 3d topology as the product of three 1d grids.
Definition: grid.h:797
real_type lx() const
length in x
Definition: grid.h:573
bool contains(const Vector &x) const
Shortcut for contains( x[0], x[1], x[2])
Definition: grid.h:747
unsigned nz() const
number of polynomial coefficients in z
Definition: grid.h:616
bc bcz() const
boundary conditions in z
Definition: grid.h:652
thrust::host_vector< real_type > host_vector
The host vector type used by host functions like evaluate.
Definition: grid.h:526
unsigned Nx() const
number of points in x
Definition: grid.h:622
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:614
void shift(bool &negative, real_type &x, real_type &y, real_type &z) const
Shift any point coordinate to a corresponding grid coordinate according to the boundary condition.
Definition: grid.h:710
const RealGrid1d< real_type > & gx() const
The x-axis grid.
Definition: grid.h:660
const DLT< real_type > & dlty() const
discrete legendre transformation in y
Definition: grid.h:656
real_type x0() const
left boundary in x
Definition: grid.h:534
real_type hy() const
cell size in y
Definition: grid.h:598
void set(unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny, unsigned new_nz, unsigned new_Nz)
Set the number of polynomials and cells.
Definition: grid.h:779
real_type y1() const
right boundary in y
Definition: grid.h:553
aRealTopology3d(const aRealTopology3d &src)=default
bool contains(real_type x, real_type y, real_type z) const
Check if the grid contains a point.
Definition: grid.h:739
real_type hx() const
cell size in x
Definition: grid.h:592
real_type ly() const
length in y
Definition: grid.h:579
const RealGrid1d< real_type > & gy() const
The y-axis grid.
Definition: grid.h:662
real_type z0() const
left boundary in z
Definition: grid.h:560
virtual void do_set(unsigned new_nx, unsigned new_Nx, unsigned new_ny, unsigned new_Ny, unsigned new_nz, unsigned new_Nz)=0
unsigned n() const
number of polynomial coefficients in x
Definition: grid.h:610
void set(unsigned new_n, unsigned new_Nx, unsigned new_Ny, unsigned new_Nz)
Set the number of polynomials and cells.
Definition: grid.h:766
aRealTopology3d & operator=(const aRealTopology3d &src)=default
real_type x1() const
right boundary in x
Definition: grid.h:540
unsigned Ny() const
number of points in y
Definition: grid.h:628
bc bcy() const
boundary conditions in y
Definition: grid.h:646
bc bcx() const
boundary conditions in x
Definition: grid.h:640
real_type hz() const
cell size in z
Definition: grid.h:604
~aRealTopology3d()=default
disallow deletion through base class pointer
real_type z1() const
right boundary in z
Definition: grid.h:566
real_type lz() const
length in z
Definition: grid.h:585
unsigned Nz() const
number of points in z
Definition: grid.h:634
void display(std::ostream &os=std::cout) const
Display.
Definition: grid.h:676
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:612
void shift(bool &negative, real_type &x, real_type &y, real_type &z, bc bcx, bc bcy, bc bcz) const
Shift any point coordinate to a corresponding grid coordinate according to the boundary condition.
Definition: grid.h:722