Discontinuous Galerkin Library
#include "dg/algorithm.h"
refined_grid.h
Go to the documentation of this file.
1#pragma once
2
3#include "cusp/transpose.h"
4#include "dg/backend/memory.h"
5#include "dg/blas.h"
6#include "grid.h"
7#include "weights.h"
8#include "interpolation.h"
9
10#include "base_geometry.h"
11
12
13namespace dg
14{
15
17namespace detail
18{
19
28template<class real_type>
29thrust::host_vector<real_type> normalize_weights_and_compute_abscissas( const RealGrid1d<real_type>& g, thrust::host_vector<real_type>& weights)
30{
31 //normalize weights
32 unsigned Nx_new = weights.size()/g.n();
33 for( unsigned i=0;i<weights.size(); i++)
34 weights[i] *= (real_type)g.N()/(real_type)Nx_new;
35
36 thrust::host_vector<real_type> boundaries(Nx_new+1), abs(g.n()*Nx_new);
37 boundaries[0] = g.x0();
38 for( unsigned i=0; i<Nx_new; i++)
39 {
40 boundaries[i+1] = boundaries[i] + g.lx()/(real_type)Nx_new/weights[g.n()*i];
41 for( unsigned j=0; j<g.n(); j++)
42 {
43 abs[i*g.n()+j] = (boundaries[i+1]+boundaries[i])/2. +
44 (boundaries[i+1]-boundaries[i])/2.*g.dlt().abscissas()[j];
45 }
46 }
47 return abs;
48}
49
50}//namespace detail
52
55
59template<class real_type>
61{
68 void generate( const RealGrid1d<real_type>& g_old, thrust::host_vector<real_type>& weights, thrust::host_vector<real_type>& abscissas) const
69 {
70 weights.resize( N_new(g_old.N(), g_old.bcx()));
71 abscissas.resize( N_new(g_old.N(), g_old.bcx()));
72 do_generate(g_old,weights,abscissas);
73 }
78 unsigned N_new( unsigned N_old, bc bcx) const
79 {
80 return do_N_new(N_old, bcx);
81 }
82 virtual aRealRefinement1d* clone()const=0;
83 virtual ~aRealRefinement1d() = default;
84 protected:
85 aRealRefinement1d() = default;
86 aRealRefinement1d(const aRealRefinement1d& src) = default;
88 private:
89 virtual void do_generate( const RealGrid1d<real_type>& g, thrust::host_vector<real_type>& weights, thrust::host_vector<real_type>& abscissas) const =0;
90 virtual unsigned do_N_new( unsigned N_old, bc bcx) const =0;
91};
92
96template<class real_type>
97struct RealIdentityRefinement : public aRealRefinement1d<real_type>
98{
100 private:
101 virtual void do_generate( const RealGrid1d<real_type>& g, thrust::host_vector<real_type>& weights, thrust::host_vector<real_type>& abscissas) const override final{
103 abscissas=dg::create::abscissas(g);
104 }
105 virtual unsigned do_N_new( unsigned N_old, bc bcx) const override final{
106 return N_old;
107 }
108};
109
113template<class real_type>
114struct RealLinearRefinement : public aRealRefinement1d<real_type>
115{
120 RealLinearRefinement( unsigned multiple): m_(multiple){
121 assert( multiple>= 1);
122 }
123 virtual RealLinearRefinement* clone()const{return new RealLinearRefinement(*this);}
124 private:
125 unsigned m_;
126 virtual void do_generate( const RealGrid1d<real_type>& g, thrust::host_vector<real_type>& weights, thrust::host_vector<real_type>& abscissas) const override final
127 {
128 thrust::host_vector< real_type> left( g.n()*g.N()*m_, 1);
129 for( unsigned k=0; k<left.size(); k++)
130 left[k] = (real_type)m_;
131 weights = left;
132 abscissas = dg::detail::normalize_weights_and_compute_abscissas( g, weights);
133 }
134 virtual unsigned do_N_new( unsigned N_old, bc bcx) const override final{
135 return N_old*m_;
136 }
137};
138
151template<class real_type>
152struct RealFemRefinement : public aRealRefinement1d<real_type>
153{
158 RealFemRefinement( unsigned multiple): m_M(multiple){
159 assert( multiple>= 1);
160 }
161 virtual RealFemRefinement* clone()const{return new RealFemRefinement(*this);}
162 private:
163 unsigned m_M;
164 std::vector<real_type> simpsons_weights( unsigned N, double h) const
165 {
166 // Create weights for Simpson's integration on an equidistant subgrid with N cells (including end points)
167 // N >= 2
168 std::vector<real_type> simpson( N, h);
169 if( N == 2)
170 {
171 simpson[0] = simpson[1] = h/2.;
172 return simpson;
173 }
174 simpson[0]=1./3. * h;
175 for( unsigned i=0; i<(N-3)/2; i++)
176 {
177 simpson[2*i+1] = 4./3. * h;
178 simpson[2*i+2] = 2./3. * h;
179 }
180 if( N%2 != 0)
181 {
182 simpson[N-2] = 4./3. * h;
183 simpson[N-1] = 1./3. * h;
184 }
185 else
186 {
187 simpson[N-4] = N==4 ? 3./8.*h : (1./3.+3./8.)*h;
188 simpson[N-3] = (9./8.)*h;
189 simpson[N-2] = (9./8.)*h;
190 simpson[N-1] = (3./8.)*h;
191 }
192 return simpson;
193 }
194 virtual void do_generate( const RealGrid1d<real_type>& g, thrust::host_vector<real_type>& weights, thrust::host_vector<real_type>& abscissas) const override final
195 {
196 thrust::host_vector<real_type> old = dg::create::abscissas(g);
197 if( m_M == 1)
198 {
199 abscissas = old;
201 return;
202 }
203 abscissas.resize( g.size()*m_M);
204 weights.resize( g.size()*m_M);
206 unsigned NLeft = m_M/2;
207 double hxleft = (old[0] - g.x0())/(double)(NLeft+1);
208 abscissas[0] = g.x0()+hxleft;
209 weights[0] = hxleft;
210 unsigned idx = 0;
211 std::vector<real_type> sim = simpsons_weights( NLeft+1, hxleft);
212 weights[idx] += sim[0];
213 for( unsigned k=1; k<=NLeft; k++)
214 {
215 idx++;
216 abscissas[idx] = abscissas[idx-1]+hxleft;
217 weights[idx] += sim[k];
218 }
219 // now abs is at old[0]
220 unsigned NMiddle = m_M;
221 for( unsigned i=0; i<old.size()-1; i++)
222 {
223 double hxmiddle = (old[i+1] - old[i])/(double)NMiddle;
224 sim = simpsons_weights( NMiddle+1, hxmiddle);
225 weights[idx] += sim[0];
226 for( unsigned k=1; k<=NMiddle; k++)
227 {
228 idx++;
229 abscissas[idx] = abscissas[idx-1]+hxmiddle;
230 weights[idx] += sim[k];
231 }
232 }
233 unsigned NRight = m_M - 1 - m_M/2;
234 double hxright = (g.x1() - old[g.size()-1] )/(double)(NRight+1);
235 if( NRight > 0)
236 {
237 sim = simpsons_weights( NRight+1, hxright);
238 weights[idx] += sim[0];
239 for( unsigned k=1; k<=NRight; k++)
240 {
241 idx++;
242 abscissas[idx] = abscissas[idx-1]+hxright;
243 weights[idx] += sim[k];
244 }
245 }
246 weights[idx] += hxright;
247 RealGrid1d<real_type> nGrid( g.x0(), g.x1(), g.n(), g.N()*m_M);
248 thrust::host_vector<real_type> wrong_weights = dg::create::weights(nGrid);
250 }
251 virtual unsigned do_N_new( unsigned N_old, bc bcx) const override final{
252 return N_old*m_M;
253 }
254};
255
259template<class real_type>
261{
271 RealEquidistRefinement( unsigned add_x, unsigned node, unsigned howmany=1): add_x_(add_x), node_(node), howm_(howmany){ }
272 virtual RealEquidistRefinement* clone()const{return new RealEquidistRefinement(*this);}
273 private:
274 unsigned add_x_, node_, howm_;
275 virtual void do_generate( const RealGrid1d<real_type>& g, thrust::host_vector<real_type>& weights, thrust::host_vector<real_type>& abscissas) const override final
276 {
277 if( add_x_ == 0 || howm_ == 0)
278 {
279 thrust::host_vector<real_type> w_( g.size(), 1);
280 abscissas = dg::create::abscissas(g);
281 weights = w_;
282 return;
283 }
284 weights = equidist_ref( add_x_, node_, g.n(), g.N(), g.bcx(), howm_);
285 abscissas = detail::normalize_weights_and_compute_abscissas( g, weights);
286 }
287 virtual unsigned do_N_new( unsigned N_old, bc bcx) const override final
288 {
289 if( bcx == dg::PER) return N_old + 2*add_x_*howm_;
290 return N_old + add_x_*howm_;
291 }
292 thrust::host_vector<real_type> equidist_ref( unsigned add_x, unsigned node, unsigned n, unsigned N, dg::bc bcx, unsigned howmany) const
293 {
294 assert( howm_ <= N);
295 assert( node_ <= N);
296 if( node_ != 0 && node_ != N)
297 assert( howm_ <= node_ && howm_ <= N-node_);
298 if( add_x_ == 0 || howm_ == 0)
299 {
300 thrust::host_vector<real_type> w_( n*N, 1);
301 return w_;
302 }
303 //there are add_x+1 finer cells per refined cell ...
304 thrust::host_vector< real_type> left( n*N+n*add_x_*howm_, 1), right(left);
305 for( unsigned i=0; i<(add_x_+1)*howm_; i++)//the original cell and the additional ones
306 for( unsigned k=0; k<n; k++)
307 left[i*n+k] = add_x_ + 1;
308 //mirror left into right
309 for( unsigned i=0; i<right.size(); i++)
310 right[i] = left[ (left.size()-1)-i];
311 thrust::host_vector< real_type> both( n*N+2*n*add_x_*howm_, 1);
312 for( unsigned i=0; i<left.size(); i++)
313 both[i] *= left[i];
314 for( unsigned i=0; i<right.size(); i++)
315 both[i+n*add_x_*howm_] *= right[i];
316 if( node_ == 0 && bcx != dg::PER) { return left; }
317 else if( node_ == N && bcx != dg::PER) { return right; }
318 else if((node_ == N || node_ == 0) && bcx == dg::PER) { return both; }
319 else
320 {
321 thrust::host_vector<real_type> w_ = both;
322 //now shift indices so that refinement is around node_s
323 for( unsigned i=0; i<both.size(); i++)
324 w_[((howm_*add_x_+node_)*n+i)%both.size()] = both[i];
325 return w_;
326 }
327 }
328
329};
330
334template<class real_type>
336{
346 RealExponentialRefinement( unsigned add_x, unsigned node): add_x_(add_x), node_(node) {}
348 private:
349 unsigned add_x_, node_;
350 virtual void do_generate( const RealGrid1d<real_type>& g, thrust::host_vector<real_type>& weights, thrust::host_vector<real_type>& abscissas) const override final
351 {
352 if( add_x_ == 0)
353 {
354 thrust::host_vector<real_type> w_( g.size(), 1);
355 abscissas= dg::create::abscissas(g);
356 weights = w_;
357 return;
358 }
359 weights = exponential_ref( add_x_, node_, g.n(), g.N(), g.bcx());
360 abscissas = detail::normalize_weights_and_compute_abscissas( g, weights);
361 }
362 virtual unsigned do_N_new( unsigned N_old, bc bcx) const override final
363 {
364 if( bcx == dg::PER) return N_old + 2*add_x_;
365 return N_old + add_x_;
366 }
367 thrust::host_vector<real_type> exponential_ref( unsigned add_x, unsigned node, unsigned n, unsigned N, dg::bc bcx) const
368 {
369 if( add_x_ == 0)
370 {
371 thrust::host_vector<real_type> w_( n*N, 1);
372 return w_;
373 }
374 assert( node_ <= N);
375 //there are add_x_+1 finer cells per refined cell ...
376 thrust::host_vector< real_type> left( n*N+n*add_x_, 1), right(left);
377 for( unsigned k=0; k<n; k++)//the original cell and the additional ones
378 left[k] = pow( 2, add_x_);
379 for( unsigned i=0; i<add_x_; i++)
380 for( unsigned k=0; k<n; k++)
381 left[(i+1)*n+k] = pow( 2, add_x_-i);
382 //mirror left into right
383 for( unsigned i=0; i<right.size(); i++)
384 right[i] = left[ (left.size()-1)-i];
385 thrust::host_vector< real_type> both( n*N+2*n*add_x_, 1);
386 for( unsigned i=0; i<left.size(); i++)
387 both[i] *= left[i];
388 for( unsigned i=0; i<right.size(); i++)
389 both[i+n*add_x_] *= right[i];
390 if( node_ == 0 && bcx != dg::PER) { return left; }
391 else if( node_ == N && bcx != dg::PER) { return right; }
392 else if((node_ == N || node_ == 0) && bcx == dg::PER) { return both; }
393 else
394 {
395 thrust::host_vector<real_type> w_ = both;
396 //now shift indices so that refinement is around node_s
397 for( unsigned i=0; i<both.size(); i++)
398 w_[((add_x_+node_)*n+i)%both.size()] = both[i];
399 return w_;
400 }
401 }
402};
403
410
412
417template<class real_type>
419{
420 RealCartesianRefinedGrid2d( const aRealRefinement1d<real_type>& refX, const aRealRefinement1d<real_type>& refY, real_type x0, real_type x1, real_type y0, real_type y1,
421 unsigned n, unsigned Nx, unsigned Ny, bc bcx = dg::PER, bc bcy = dg::PER) : dg::aGeometry2d( {x0, x1, n, refX.N_new(Nx,bcx), bcx}, {y0, y1, n, refY.N_new(Ny,bcy),bcy}), refX_(refX), refY_(refY), w_(2), a_(2)
422 {
423 construct_weights_and_abscissas(n,Nx,n,Ny);
424 }
425
427 private:
429 std::vector<thrust::host_vector<real_type> > w_, a_;
430 void construct_weights_and_abscissas(unsigned nx, unsigned Nx, unsigned ny, unsigned Ny)
431 {
432 RealGrid1d<real_type> gx( this->x0(), this->x1(), nx, Nx, this->bcx());
433 RealGrid1d<real_type> gy( this->y0(), this->y1(), ny, Ny, this->bcy());
434 thrust::host_vector<real_type> wx, ax, wy, ay;
435 refX_->generate( gx, wx, ax);
436 refY_->generate( gy, wy, ay);
437 w_[0].resize(this->size()), w_[1].resize(this->size());
438 a_[0].resize(this->size()), a_[1].resize(this->size());
439 //now make product space
440 for( unsigned i=0; i<wy.size(); i++)
441 for( unsigned j=0; j<wx.size(); j++)
442 {
443 w_[0][i*wx.size()+j] = wx[j];
444 w_[1][i*wx.size()+j] = wy[i];
445 a_[0][i*wx.size()+j] = ax[j];
446 a_[1][i*wx.size()+j] = ay[i];
447 }
448 }
449 virtual void do_set(unsigned nx, unsigned Nx, unsigned ny, unsigned Ny)override final{
450 aRealTopology2d<real_type>::do_set(nx,refX_->N_new(Nx,this->bcx()),ny,refY_->N_new(Ny, this->bcy()));
451 construct_weights_and_abscissas(nx,Nx,ny,Ny);
452 }
453 virtual SparseTensor<thrust::host_vector<real_type> > do_compute_metric()const override final{
454 SparseTensor<thrust::host_vector<real_type> > t(*this);
455 t.values().push_back( w_[0]);
456 t.values().push_back( w_[1]);
457 dg::blas1::pointwiseDot( w_[0], w_[0], t.values()[2]);
458 dg::blas1::pointwiseDot( w_[1], w_[1], t.values()[3]);
459 t.idx(0,0)=2, t.idx(1,1)=3;
460 return t;
461 }
462 virtual SparseTensor<thrust::host_vector<real_type> > do_compute_jacobian()const override final{
463 SparseTensor<thrust::host_vector<real_type> > t(*this);
464 t.values().push_back( w_[0]);
465 t.values().push_back( w_[1]);
466 t.idx(0,0)=2, t.idx(1,1)=3;
467 return t;
468 }
469 virtual std::vector<thrust::host_vector<real_type> > do_compute_map()const override final{
470 return a_;
471 }
472};
473
478template< class real_type>
480{
481 RealCartesianRefinedGrid3d( const aRealRefinement1d<real_type>& refX, const aRealRefinement1d<real_type>& refY, aRealRefinement1d<real_type>& refZ, real_type x0, real_type x1, real_type y0, real_type y1, real_type z0, real_type z1,
482 unsigned n, unsigned Nx, unsigned Ny, unsigned Nz, bc bcx = dg::PER, bc bcy = dg::PER, bc bcz=dg::PER) :
483 dg::aGeometry3d( {x0, x1, n, refX.N_new(Nx,bcx), bcx}, { y0, y1, refY.N_new(Ny,bcy), bcy}, {z0,z1, 1, refZ.N_new(Nz,bcz), bcz}), refX_(refX), refY_(refY), refZ_(refZ), w_(3), a_(3)
484 {
485 construct_weights_and_abscissas(n, Nx, n, Ny,1, Nz);
486 }
487
489 private:
490 ClonePtr<aRealRefinement1d<real_type>> refX_, refY_, refZ_;
491 std::vector<thrust::host_vector<real_type> > w_, a_;
492 void construct_weights_and_abscissas(unsigned nx, unsigned Nx, unsigned ny, unsigned Ny, unsigned nz, unsigned Nz)
493 {
494 RealGrid1d<real_type> gx( this->x0(), this->x1(), nx, Nx, this->bcx());
495 RealGrid1d<real_type> gy( this->y0(), this->y1(), ny, Ny, this->bcy());
496 RealGrid1d<real_type> gz( this->y0(), this->y1(), nz, Nz, this->bcz());
497 thrust::host_vector<real_type> w[3], a[3];
498 refX_->generate( gx, w[0], a[0]);
499 refY_->generate( gy, w[1], a[1]);
500 refZ_->generate( gz, w[2], a[2]);
501 w_[0].resize(this->size()), w_[1].resize(this->size()), w_[2].resize(this->size());
502 a_[0].resize(this->size()), a_[1].resize(this->size()), a_[2].resize(this->size());
503 //now make product space
504 for( unsigned s=0; s<w[2].size(); s++)
505 for( unsigned i=0; i<w[1].size(); i++)
506 for( unsigned j=0; j<w[0].size(); j++)
507 {
508 w_[0][(s*w[1].size()+i)*w[0].size()+j] = w[0][j];
509 w_[1][(s*w[1].size()+i)*w[0].size()+j] = w[1][i];
510 w_[2][(s*w[1].size()+i)*w[0].size()+j] = w[2][s];
511 a_[0][(s*w[1].size()+i)*w[0].size()+j] = a[0][j];
512 a_[1][(s*w[1].size()+i)*w[0].size()+j] = a[1][i];
513 a_[2][(s*w[1].size()+i)*w[0].size()+j] = a[1][s];
514 }
515 }
516 virtual void do_set(unsigned nx, unsigned Nx, unsigned ny, unsigned Ny, unsigned nz, unsigned Nz) override final{
517 aRealTopology3d<real_type>::do_set(nx,refX_->N_new(Nx, this->bcx()),ny,refY_->N_new(Ny,this->bcy()), nz, refZ_->N_new(Nz,this->bcz()));
518 construct_weights_and_abscissas(nx, Nx, ny, Ny, nz, Nz);
519 }
520 virtual SparseTensor<thrust::host_vector<real_type> > do_compute_metric()const override final {
521 SparseTensor<thrust::host_vector<real_type> > t(*this);
522 t.values().resize( 4, t.values()[0]);
523 dg::blas1::pointwiseDot( w_[0], w_[0], t.values()[1]);
524 dg::blas1::pointwiseDot( w_[1], w_[1], t.values()[2]);
525 dg::blas1::pointwiseDot( w_[2], w_[2], t.values()[3]);
526 t.idx(0,0)=1, t.idx(1,1)=2, t.idx(2,2)=3;
527 return t;
528 }
529 virtual SparseTensor<thrust::host_vector<real_type> > do_compute_jacobian()const override final{
530 SparseTensor<thrust::host_vector<real_type> > t(*this);
531 t.values().push_back( w_[0]);
532 t.values().push_back( w_[1]);
533 t.values().push_back( w_[2]);
534 t.idx(0,0)=2, t.idx(1,1)=3, t.idx(2,2)=4;
535 return t;
536 }
537 virtual std::vector<thrust::host_vector<real_type> > do_compute_map()const override final {
538 return a_;
539 }
540};
541
547
548}//namespace dg
base topology classes
static DG_DEVICE double one(double x)
Definition: functions.h:20
void copy(const ContainerTypeIn &source, ContainerTypeOut &target)
Definition: blas1.h:164
void pointwiseDivide(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:428
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:336
bc
Switch between boundary conditions.
Definition: enums.h:15
@ PER
periodic boundaries
Definition: enums.h:16
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
MPI_Vector< thrust::host_vector< real_type > > weights(const aRealMPITopology2d< real_type > &g)
Nodal weight coefficients.
Definition: mpi_weights.h:22
1D, 2D and 3D interpolation matrix creation functions
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Manager class that invokes the clone() method on the managed ptr when copied.
Definition: memory.h:19
Refined RealCartesian grid.
Definition: refined_grid.h:419
RealCartesianRefinedGrid2d(const aRealRefinement1d< real_type > &refX, const aRealRefinement1d< real_type > &refY, real_type x0, real_type x1, real_type y0, real_type y1, unsigned n, unsigned Nx, unsigned Ny, bc bcx=dg::PER, bc bcy=dg::PER)
Definition: refined_grid.h:420
virtual RealCartesianRefinedGrid2d * clone() const
Geometries are cloneable.
Definition: refined_grid.h:426
Refined RealCartesian grid.
Definition: refined_grid.h:480
RealCartesianRefinedGrid3d(const aRealRefinement1d< real_type > &refX, const aRealRefinement1d< real_type > &refY, aRealRefinement1d< real_type > &refZ, 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=dg::PER, bc bcy=dg::PER, bc bcz=dg::PER)
Definition: refined_grid.h:481
virtual RealCartesianRefinedGrid3d * clone() const
Geometries are cloneable.
Definition: refined_grid.h:488
Cell refinement around a given node.
Definition: refined_grid.h:261
RealEquidistRefinement(unsigned add_x, unsigned node, unsigned howmany=1)
Divide a number of cells left and right of a node into an equidistant number of new cells.
Definition: refined_grid.h:271
virtual RealEquidistRefinement * clone() const
Definition: refined_grid.h:272
The exponential refinement around a node.
Definition: refined_grid.h:336
virtual RealExponentialRefinement * clone() const
Definition: refined_grid.h:347
RealExponentialRefinement(unsigned add_x, unsigned node)
Construct exponential refinement.
Definition: refined_grid.h:346
Insert equidistant points in between dG nodes.
Definition: refined_grid.h:153
RealFemRefinement(unsigned multiple)
Refine every cell in the grid by an integer number of new cells.
Definition: refined_grid.h:158
virtual RealFemRefinement * clone() const
Definition: refined_grid.h:161
1D grid
Definition: grid.h:80
bc bcx() const
boundary conditions
Definition: grid.h:147
unsigned N() const
number of cells
Definition: grid.h:135
No refinement.
Definition: refined_grid.h:98
virtual RealIdentityRefinement * clone() const
Definition: refined_grid.h:99
Multiply every cell in the grid by a factor.
Definition: refined_grid.h:115
RealLinearRefinement(unsigned multiple)
Refine every cell in the grid by an integer number of new cells.
Definition: refined_grid.h:120
virtual RealLinearRefinement * clone() const
Definition: refined_grid.h:123
This is the abstract interface class for a two-dimensional Geometry.
Definition: base_geometry.h:15
This is the abstract interface class for a three-dimensional Geometry.
Definition: base_geometry.h:89
Abstract base class for 1d grid refinement that increases the number of grid cells of a fixed basis g...
Definition: refined_grid.h:61
aRealRefinement1d(const aRealRefinement1d &src)=default
virtual aRealRefinement1d * clone() const =0
aRealRefinement1d & operator=(const aRealRefinement1d &src)=default
aRealRefinement1d()=default
void generate(const RealGrid1d< real_type > &g_old, thrust::host_vector< real_type > &weights, thrust::host_vector< real_type > &abscissas) const
Generate the grid transformation.
Definition: refined_grid.h:68
virtual ~aRealRefinement1d()=default
unsigned N_new(unsigned N_old, bc bcx) const
the new number of cells
Definition: refined_grid.h:78
unsigned n() const
number of polynomial coefficients in x
Definition: grid.h:336
real_type x0() const
Left boundary in x.
Definition: grid.h:288
real_type y1() const
Right boundary in y.
Definition: grid.h:306
const RealGrid1d< real_type > & gy() const
The y-axis grid.
Definition: grid.h:379
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:340
bc bcx() const
boundary conditions in x
Definition: grid.h:358
unsigned size() const
The total number of points.
Definition: grid.h:424
real_type y0() const
left boundary in y
Definition: grid.h:300
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
unsigned Ny() const
number of cells in y
Definition: grid.h:352
real_type y0() const
left boundary in y
Definition: grid.h:547
unsigned size() const
The total number of points.
Definition: grid.h:670
const RealGrid1d< real_type > & gz() const
The z-axis grid.
Definition: grid.h:664
unsigned nz() const
number of polynomial coefficients in z
Definition: grid.h:616
bc bcz() const
boundary conditions in z
Definition: grid.h:652
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
const RealGrid1d< real_type > & gx() const
The x-axis grid.
Definition: grid.h:660
real_type x0() const
left boundary in x
Definition: grid.h:534
real_type y1() const
right boundary in y
Definition: grid.h:553
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
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 z1() const
right boundary in z
Definition: grid.h:566
unsigned Nz() const
number of points in z
Definition: grid.h:634
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:612
Creation functions for integration weights and their inverse.