dune-pdelab  2.5-dev
pdelab.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 #ifndef DUNE_PDELAB_BOILERPLATE_PDELAB_HH
4 #define DUNE_PDELAB_BOILERPLATE_PDELAB_HH
5 
16 // first of all we include a lot of dune grids and pdelab files
17 #include <iostream>
18 #include <memory>
19 
20 #include <dune/common/parallel/mpihelper.hh> // include mpi helper class
21 #include <dune/common/parametertreeparser.hh>
22 #include <dune/common/classname.hh>
23 #include <dune/common/exceptions.hh>
24 #include <dune/common/fvector.hh>
25 
26 #include <dune/geometry/type.hh>
27 #include <dune/geometry/quadraturerules.hh>
28 
29 #include <dune/grid/onedgrid.hh>
30 #include <dune/grid/io/file/vtk.hh>
31 #include <dune/grid/yaspgrid.hh>
32 #if HAVE_UG
33 #include <dune/grid/uggrid.hh>
34 #endif
35 #if HAVE_ALBERTA
36 #include<dune/grid/albertagrid.hh>
37 #include <dune/grid/albertagrid/dgfparser.hh>
38 #endif
39 #if HAVE_UG
40 #include<dune/grid/uggrid.hh>
41 #endif
42 #if HAVE_DUNE_ALUGRID
43 #include<dune/alugrid/grid.hh>
44 #include <dune/alugrid/dgf.hh>
45 #endif
46 #include <dune/grid/utility/structuredgridfactory.hh>
47 #include <dune/grid/io/file/gmshreader.hh>
48 
49 #include <dune/istl/bvector.hh>
50 #include <dune/istl/operators.hh>
51 #include <dune/istl/solvers.hh>
52 #include <dune/istl/solvercategory.hh>
53 #include <dune/istl/preconditioners.hh>
54 #include <dune/istl/io.hh>
55 
56 #include <dune/istl/paamg/amg.hh>
81 
82 namespace Dune {
83  namespace PDELab {
84 
85  // make grids
86  template<typename T>
88  {
89  public:
90  // export types
91  typedef T Grid;
92  typedef typename T::ctype ctype;
93  static const int dim = T::dimension;
94  static const int dimworld = T::dimensionworld;
95 
96  // constructors
97  StructuredGrid (Dune::GeometryType::BasicType meshtype, unsigned int cells)
98  {
99  FieldVector<ctype,dimworld> lowerLeft(0.0);
100  FieldVector<ctype,dimworld> upperRight(1.0);
101  array<unsigned int,dim> elements; elements.fill(cells);
102 
103  StructuredGridFactory<T> factory;
104 
105  if (meshtype==Dune::GeometryType::cube)
106  gridp = factory.createCubeGrid(lowerLeft,upperRight,elements);
107  else if (meshtype==Dune::GeometryType::simplex)
108  gridp = factory.createSimplexGrid(lowerLeft,upperRight,elements);
109  else
110  {
111  DUNE_THROW(GridError, className<StructuredGrid>()
112  << "::StructuredGrid(): grid type must be simplex or cube ");
113  }
114  }
115 
116 
117  StructuredGrid (Dune::GeometryType::BasicType meshtype,
118  array<double,dimworld> lower_left, array<double,dimworld> upper_right,
119  array<unsigned int,dim> cells)
120  {
121  FieldVector<ctype,dimworld> lowerLeft;
122  FieldVector<ctype,dimworld> upperRight;
123  array<unsigned int,dim> elements;
124 
125  // copy data to correct types for StructuredGridFactory
126  for (size_t i=0; i<dimworld; i++)
127  {
128  lowerLeft[i] = lower_left[i];
129  upperRight[i] = upper_right[i];
130  }
131  for (size_t i=0; i<dim; i++)
132  {
133  elements[i] = cells[i];
134  }
135 
136  StructuredGridFactory<T> factory;
137 
138  if (meshtype==Dune::GeometryType::cube)
139  gridp = factory.createCubeGrid(lowerLeft,upperRight,elements);
140  else if (meshtype==Dune::GeometryType::simplex)
141  gridp = factory.createSimplexGrid(lowerLeft,upperRight,elements);
142  else
143  {
144  DUNE_THROW(GridError, className<StructuredGrid>()
145  << "::StructuredGrid(): grid type must be simplex or cube ");
146  }
147  }
148 
149  // return shared pointer
150  std::shared_ptr<T> getSharedPtr ()
151  {
152  return gridp;
153  }
154 
155  // return grid reference
156  T& getGrid ()
157  {
158  return *gridp;
159  }
160 
161  // return grid reference const version
162  const T& getGrid () const
163  {
164  return *gridp;
165  }
166 
168  {
169  return *gridp;
170  }
171 
173  {
174  return gridp.operator->();
175  }
176 
177  const T& operator*() const
178  {
179  return *gridp;
180  }
181 
182  const T* operator->() const
183  {
184  return gridp.operator->();
185  }
186 
187 
188  private:
189  std::shared_ptr<T> gridp; // hold a shared pointer to a grid
190  };
191 
192  // specialization for yaspgrid; treats paralle case right
193  template<int dim>
194  class StructuredGrid<YaspGrid<dim> >
195  {
196  public:
197 
198  // export types
199  typedef YaspGrid<dim> Grid;
200  typedef typename Grid::ctype ctype;
201  static const int dimworld = Grid::dimensionworld;
202 
203  // simple constructor for the unit cube
204  StructuredGrid (Dune::GeometryType::BasicType meshtype, unsigned int cells, int overlap=1)
205  {
206  // check element type
207  if (meshtype!=Dune::GeometryType::cube)
208  std::cout << "StructuredGrid(): element type " << meshtype << " is ignored" << std::endl;
209 
210  // copy data to correct types for YaspGrid
211  Dune::FieldVector<double,dimworld> L(1.0);
212  std::array<int,dimworld> N(Dune::fill_array<int,dimworld>(cells));
213  std::bitset<dimworld> B(false);
214 
215  // instantiate the grid
216  gridp = std::shared_ptr<Grid>(new Grid(L,N,B,overlap,Dune::MPIHelper::getCollectiveCommunication()));
217  }
218 
219  // constructor with sizes given
220  StructuredGrid (Dune::GeometryType::BasicType meshtype,
221  array<double,dimworld> lower_left, array<double,dimworld> upper_right,
222  array<unsigned int,dim> cells, int overlap=1)
223  {
224  // check that lower right corner is the origin
225  for(int d = 0; d < dimworld; ++d)
226  if(std::abs(lower_left[d]) > std::abs(upper_right[d])*1e-10)
227  DUNE_THROW(GridError, className<StructuredGrid>()
228  << "::createCubeGrid(): The lower coordinates "
229  "must be at the origin for YaspGrid.");
230 
231  // check element type
232  if (meshtype!=Dune::GeometryType::cube)
233  std::cout << "StructuredGrid(): element type " << meshtype << " is ignored" << std::endl;
234 
235  // copy data to correct types for YaspGrid
236  Dune::FieldVector<double,dimworld> L;
237  std::array<int,dimworld> N;
238  std::bitset<dimworld> B(false);
239  for (size_t i=0; i<dimworld; i++)
240  {
241  L[i] = upper_right[i];
242  N[i] = cells[i];
243  }
244 
245  // instantiate the grid
246  gridp = std::shared_ptr<Grid>(new Grid(L,N,B,overlap,Dune::MPIHelper::getCollectiveCommunication()));
247  }
248 
249  // constructor with periodicity argument
250  StructuredGrid (Dune::GeometryType::BasicType meshtype,
251  array<double,dimworld> lower_left, array<double,dimworld> upper_right,
252  array<unsigned int,dim> cells, array<bool,dim> periodic, int overlap=1)
253  {
254  // check that lower right corner is the origin
255  for(int d = 0; d < dimworld; ++d)
256  if(std::abs(lower_left[d]) > std::abs(upper_right[d])*1e-10)
257  DUNE_THROW(GridError, className<StructuredGrid>()
258  << "::createCubeGrid(): The lower coordinates "
259  "must be at the origin for YaspGrid.");
260 
261  // check element type
262  if (meshtype!=Dune::GeometryType::cube)
263  std::cout << "StructuredGrid(): element type " << meshtype << " is ignored" << std::endl;
264 
265  // copy data to correct types for YaspGrid
266  Dune::FieldVector<double,dimworld> L;
267  std::array<int,dimworld> N;
268  std::bitset<dimworld> B(false);
269  for (size_t i=0; i<dimworld; i++)
270  {
271  L[i] = upper_right[i];
272  N[i] = cells[i];
273  B[i] = periodic[i];
274  }
275 
276  // instantiate the grid
277  gridp = std::shared_ptr<Grid>(new Grid(L,N,B,overlap,Dune::MPIHelper::getCollectiveCommunication()));
278  }
279 
280  // return shared pointer
281  std::shared_ptr<Grid> getSharedPtr ()
282  {
283  return gridp;
284  }
285 
286  // return grid reference
287  Grid& getGrid ()
288  {
289  return *gridp;
290  }
291 
292  // return grid reference const version
293  const Grid& getGrid () const
294  {
295  return *gridp;
296  }
297 
298  Grid& operator*()
299  {
300  return *gridp;
301  }
302 
303  Grid* operator->()
304  {
305  return gridp.operator->();
306  }
307 
308  const Grid& operator*() const
309  {
310  return *gridp;
311  }
312 
313  const Grid* operator->() const
314  {
315  return gridp.operator->();
316  }
317 
318  private:
319  std::shared_ptr<Grid> gridp; // hold a shared pointer to a grid
320  };
321 
322  // unstructured grid read from gmsh file
323  template<typename T>
325  {
326  public:
327  // export types
328  typedef T Grid;
329  typedef typename T::ctype ctype;
330  static const int dim = T::dimension;
331  static const int dimworld = T::dimensionworld;
332 
333  // constructors
334  UnstructuredGrid (std::string filename, bool verbose = true, bool insert_boundary_segments=true)
335  {
336  Dune::GridFactory<T> factory;
337  Dune::GmshReader<T>::read(factory,filename,verbose,insert_boundary_segments);
338  gridp = std::shared_ptr<T>(factory.createGrid());
339  }
340 
341  // return shared pointer
342  std::shared_ptr<T> getSharedPtr ()
343  {
344  return gridp;
345  }
346 
347  // return grid reference
348  T& getGrid ()
349  {
350  return *gridp;
351  }
352 
353  // return grid reference const version
354  const T& getGrid () const
355  {
356  return *gridp;
357  }
358 
360  {
361  return *gridp;
362  }
363 
365  {
366  return gridp.operator->();
367  }
368 
369  const T& operator*() const
370  {
371  return *gridp;
372  }
373 
374  const T* operator->() const
375  {
376  return gridp.operator->();
377  }
378 
379  private:
380  std::shared_ptr<T> gridp; // hold a shared pointer to a grid
381  };
382 
383 
384  //============================================================================
385  // Continuous Lagrange Finite Element Space
386  //============================================================================
387 
388  // finite element map base template
389  template<typename GV, typename C, typename R, unsigned int degree, unsigned int dim, Dune::GeometryType::BasicType gt>
390  class CGFEMBase
391  {};
392 
393  template<typename GV, typename C, typename R, unsigned int degree, unsigned int dim>
394  class CGFEMBase<GV,C,R,degree,dim,Dune::GeometryType::simplex>
395  {
396  public:
398 
399  CGFEMBase (const GV& gridview)
400  {
401  femp = std::shared_ptr<FEM>(new FEM(gridview));
402  }
403 
404  FEM& getFEM() {return *femp;}
405  const FEM& getFEM() const {return *femp;}
406 
407  private:
408  std::shared_ptr<FEM> femp;
409  };
410 
411  template<typename GV, typename C, typename R, unsigned int degree, unsigned int dim>
412  class CGFEMBase<GV,C,R,degree,dim,Dune::GeometryType::cube>
413  {
414  public:
416 
417  CGFEMBase (const GV& gridview)
418  {
419  femp = std::shared_ptr<FEM>(new FEM(gridview));
420  }
421 
422  FEM& getFEM() {return *femp;}
423  const FEM& getFEM() const {return *femp;}
424 
425  private:
426  std::shared_ptr<FEM> femp;
427  };
428 
429  //============================================================================
430 
431  // define enumeration type that differentiate conforming and nonconforming meshes
432  enum MeshType {
435  };
436 
437  // constraints base template
438  template<typename Grid, unsigned int degree, Dune::GeometryType::BasicType gt, MeshType mt, SolverCategory::Category st, typename BCType, typename GV = typename Grid::LeafGridView>
439  class CGCONBase
440  {};
441 
442  template<typename Grid, typename BCType, typename GV>
443  class CGCONBase<Grid,1,Dune::GeometryType::simplex,MeshType::nonconforming,SolverCategory::sequential,BCType,GV>
444  {
445  public:
447 
448  CGCONBase (Grid& grid, const BCType& bctype, const GV& gv)
449  {
450  conp = std::shared_ptr<CON>(new CON(grid,true,bctype));
451  }
452 
453  CGCONBase (Grid& grid, const BCType& bctype)
454  {
455  conp = std::shared_ptr<CON>(new CON(grid,true,bctype));
456  }
457 
458  template<typename GFS>
459  void postGFSHook (const GFS& gfs) {}
460  CON& getCON() {return *conp;}
461  const CON& getCON() const {return *conp;}
462  template<typename GFS, typename DOF>
463  void make_consistent (const GFS& gfs, DOF& x) const {}
464  private:
465  std::shared_ptr<CON> conp;
466  };
467 
468  template<typename Grid, typename BCType, typename GV>
469  class CGCONBase<Grid,1,Dune::GeometryType::cube,MeshType::nonconforming,SolverCategory::sequential,BCType,GV>
470  {
471  public:
473 
474  CGCONBase (Grid& grid, const BCType& bctype, const GV& gv)
475  {
476  conp = std::shared_ptr<CON>(new CON(grid,true,bctype));
477  }
478 
479  CGCONBase (Grid& grid, const BCType& bctype)
480  {
481  conp = std::shared_ptr<CON>(new CON(grid,true,bctype));
482  }
483 
484  template<typename GFS>
485  void postGFSHook (const GFS& gfs) {}
486  CON& getCON() {return *conp;}
487  const CON& getCON() const {return *conp;}
488  template<typename GFS, typename DOF>
489  void make_consistent (const GFS& gfs, DOF& x) const {}
490  private:
491  std::shared_ptr<CON> conp;
492  };
493 
494  template<typename Grid, unsigned int degree, Dune::GeometryType::BasicType gt,typename BCType, typename GV>
495  class CGCONBase<Grid,degree,gt,MeshType::conforming,SolverCategory::sequential,BCType,GV>
496  {
497  public:
499 
500  CGCONBase (Grid& grid, const BCType& bctype, const GV& gv)
501  {
502  conp = std::shared_ptr<CON>(new CON());
503  }
504 
505  CGCONBase (Grid& grid, const BCType& bctype)
506  {
507  conp = std::shared_ptr<CON>(new CON());
508  }
509 
510  template<typename GFS>
511  void postGFSHook (const GFS& gfs) {}
512  CON& getCON() {return *conp;}
513  const CON& getCON() const {return *conp;}
514  template<typename GFS, typename DOF>
515  void make_consistent (const GFS& gfs, DOF& x) const {}
516  private:
517  std::shared_ptr<CON> conp;
518  };
519 
520  template<typename Grid, unsigned int degree, Dune::GeometryType::BasicType gt,typename BCType, typename GV>
521  class CGCONBase<Grid,degree,gt,MeshType::conforming,SolverCategory::overlapping,BCType,GV>
522  {
523  public:
525 
526  CGCONBase (Grid& grid, const BCType& bctype, const GV& gv)
527  {
528  conp = std::shared_ptr<CON>(new CON());
529  }
530 
531  CGCONBase (Grid& grid, const BCType& bctype)
532  {
533  conp = std::shared_ptr<CON>(new CON());
534  }
535 
536  template<typename GFS>
537  void postGFSHook (const GFS& gfs) {}
538  CON& getCON() {return *conp;}
539  const CON& getCON() const {return *conp;}
540  template<typename GFS, typename DOF>
541  void make_consistent (const GFS& gfs, DOF& x) const
542  {
543  // make vector consistent; this is needed for all overlapping solvers
544  ISTL::ParallelHelper<GFS> helper(gfs);
545  helper.maskForeignDOFs(Backend::native(x));
547  if (gfs.gridView().comm().size()>1)
548  gfs.gridView().communicate(adddh,Dune::InteriorBorder_All_Interface,Dune::ForwardCommunication);
549  }
550  private:
551  std::shared_ptr<CON> conp;
552  };
553 
554  template<typename Grid, unsigned int degree, Dune::GeometryType::BasicType gt,typename BCType, typename GV>
555  class CGCONBase<Grid,degree,gt,MeshType::conforming,SolverCategory::nonoverlapping,BCType,GV>
556  {
557  public:
559  CGCONBase (Grid& grid, const BCType& bctype)
560  {
561  conp = std::shared_ptr<CON>(new CON);
562  }
563 
564  template<typename GFS>
565  CON& getCON() {return *conp;}
566  const CON& getCON() const {return *conp;}
567  template<typename GFS, typename DOF>
568  void make_consistent (const GFS& gfs, DOF& x) const {}
569  private:
570  std::shared_ptr<CON> conp;
571  };
572 
573 
574  // continuous Lagrange finite elements
575  template<typename T, typename N, unsigned int degree, typename BCType,
576  Dune::GeometryType::BasicType gt, MeshType mt, SolverCategory::Category st = SolverCategory::sequential,
577  typename VBET=ISTL::VectorBackend<> >
578  class CGSpace {
579  public:
580 
581  // export types
582  typedef T Grid;
583  typedef typename T::LeafGridView GV;
584  typedef typename T::ctype ctype;
585  static const int dim = T::dimension;
586  static const int dimworld = T::dimensionworld;
587 
590 
591  typedef typename FEMB::FEM FEM;
592  typedef typename CONB::CON CON;
593 
594  typedef VBET VBE;
596 
597  typedef N NT;
600  typedef typename GFS::template ConstraintsContainer<N>::Type CC;
602 
603  // constructor making the grid function space an all that is needed
604  CGSpace (Grid& grid, const BCType& bctype)
605  : gv(grid.leafGridView()), femb(gv), conb(grid,bctype)
606  {
607  gfsp = std::shared_ptr<GFS>(new GFS(gv,femb.getFEM(),conb.getCON()));
608  gfsp->name("cgspace");
609  // initialize ordering
610  gfsp->update();
611  conb.postGFSHook(*gfsp);
612  ccp = std::shared_ptr<CC>(new CC());
613  }
614 
615  FEM& getFEM()
616  {
617  return femb.getFEM();
618  }
619 
620  const FEM& getFEM() const
621  {
622  return femb.getFEM();
623  }
624 
625  // return gfs reference
626  GFS& getGFS ()
627  {
628  return *gfsp;
629  }
630 
631  // return gfs reference const version
632  const GFS& getGFS () const
633  {
634  return *gfsp;
635  }
636 
637  // return gfs reference
638  CC& getCC ()
639  {
640  return *ccp;
641  }
642 
643  // return gfs reference const version
644  const CC& getCC () const
645  {
646  return *ccp;
647  }
648 
649  void assembleConstraints (const BCType& bctype)
650  {
651  ccp->clear();
652  constraints(bctype,*gfsp,*ccp);
653  }
654 
656  {
657  ccp->clear();
658  }
659 
660  void setConstrainedDOFS (DOF& x, NT nt) const
661  {
662  set_constrained_dofs(*ccp,nt,x);
663  conb.make_consistent(*gfsp,x);
664  }
665 
666  void setNonConstrainedDOFS (DOF& x, NT nt) const
667  {
668  set_nonconstrained_dofs(*ccp,nt,x);
669  conb.make_consistent(*gfsp,x);
670  }
671 
672  void copyConstrainedDOFS (const DOF& xin, DOF& xout) const
673  {
674  copy_constrained_dofs(*ccp,xin,xout);
675  conb.make_consistent(*gfsp,xout);
676  }
677 
678  void copyNonConstrainedDOFS (const DOF& xin, DOF& xout) const
679  {
680  copy_nonconstrained_dofs(*ccp,xin,xout);
681  conb.make_consistent(*gfsp,xout);
682  }
683 
684  private:
685  GV gv; // need this object here because FEM and GFS store a const reference !!
686  FEMB femb;
687  CONB conb;
688  std::shared_ptr<GFS> gfsp;
689  std::shared_ptr<CC> ccp;
690  };
691 
692  // template specialization for nonoverlapping case
693  template<typename T, typename N, unsigned int degree, typename BCType,
694  Dune::GeometryType::BasicType gt, MeshType mt,
695  typename VBET>
696  class CGSpace<T, N, degree, BCType, gt, mt, SolverCategory::nonoverlapping, VBET> {
697  public:
698 
699  // export types
700  typedef T Grid;
701  typedef typename T::LeafGridView GV;
702  typedef typename T::ctype ctype;
704  static const int dim = T::dimension;
705  static const int dimworld = T::dimensionworld;
706 
709 
710  typedef typename FEMB::FEM FEM;
711  typedef typename CONB::CON CON;
712 
713  typedef VBET VBE;
715 
716  typedef N NT;
719  typedef typename GFS::template ConstraintsContainer<N>::Type CC;
721 
722  // constructor making the grid function space an all that is needed
723  CGSpace (Grid& grid, const BCType& bctype)
724  : gv(grid.leafGridView()), es(gv), femb(es), conb(grid,bctype)
725  {
726  gfsp = std::shared_ptr<GFS>(new GFS(es,femb.getFEM(),conb.getCON()));
727  gfsp->name("cgspace");
728  // initialize ordering
729  gfsp->update();
730  // conb.postGFSHook(*gfsp);
731  ccp = std::shared_ptr<CC>(new CC());
732  }
733 
734  FEM& getFEM()
735  {
736  return femb.getFEM();
737  }
738 
739  const FEM& getFEM() const
740  {
741  return femb.getFEM();
742  }
743 
744  // return gfs reference
745  GFS& getGFS ()
746  {
747  return *gfsp;
748  }
749 
750  // return gfs reference const version
751  const GFS& getGFS () const
752  {
753  return *gfsp;
754  }
755 
756  // return gfs reference
757  CC& getCC ()
758  {
759  return *ccp;
760  }
761 
762  // return gfs reference const version
763  const CC& getCC () const
764  {
765  return *ccp;
766  }
767 
768  void assembleConstraints (const BCType& bctype)
769  {
770  ccp->clear();
771  constraints(bctype,*gfsp,*ccp);
772  }
773 
775  {
776  ccp->clear();
777  }
778 
779  void setConstrainedDOFS (DOF& x, NT nt) const
780  {
781  set_constrained_dofs(*ccp,nt,x);
782  conb.make_consistent(*gfsp,x);
783  }
784 
785  void setNonConstrainedDOFS (DOF& x, NT nt) const
786  {
787  set_nonconstrained_dofs(*ccp,nt,x);
788  conb.make_consistent(*gfsp,x);
789  }
790 
791  void copyConstrainedDOFS (const DOF& xin, DOF& xout) const
792  {
793  copy_constrained_dofs(*ccp,xin,xout);
794  conb.make_consistent(*gfsp,xout);
795  }
796 
797  void copyNonConstrainedDOFS (const DOF& xin, DOF& xout) const
798  {
799  copy_nonconstrained_dofs(*ccp,xin,xout);
800  conb.make_consistent(*gfsp,xout);
801  }
802 
803  private:
804  GV gv; // need this object here because FEM and GFS store a const reference !!
805  ES es;
806  FEMB femb;
807  CONB conb;
808  std::shared_ptr<GFS> gfsp;
809  std::shared_ptr<CC> ccp;
810  };
811 
812 
813 
814  //============================================================================
815  // Discontinuous Finite Element Space
816  //============================================================================
817 
818  // constraints base template
819  template<SolverCategory::Category st>
820  class DGCONBase
821  {};
822 
823  template<>
824  class DGCONBase<SolverCategory::sequential>
825  {
826  public:
829  {
830  conp = std::shared_ptr<CON>(new CON());
831  }
832  CON& getCON() {return *conp;}
833  const CON& getCON() const {return *conp;}
834  template<typename GFS, typename DOF>
835  void make_consistent (const GFS& gfs, DOF& x) const {}
836  private:
837  std::shared_ptr<CON> conp;
838  };
839 
840  template<>
841  class DGCONBase<SolverCategory::nonoverlapping>
842  {
843  public:
846  {
847  conp = std::shared_ptr<CON>(new CON());
848  }
849  CON& getCON() {return *conp;}
850  const CON& getCON() const {return *conp;}
851  template<typename GFS, typename DOF>
852  void make_consistent (const GFS& gfs, DOF& x) const {}
853  private:
854  std::shared_ptr<CON> conp;
855  };
856 
857  template<>
858  class DGCONBase<SolverCategory::overlapping>
859  {
860  public:
863  {
864  conp = std::shared_ptr<CON>(new CON());
865  }
866  CON& getCON() {return *conp;}
867  const CON& getCON() const {return *conp;}
868  template<typename GFS, typename DOF>
869  void make_consistent (const GFS& gfs, DOF& x) const
870  {
871  // make vector consistent; this is needed for all overlapping solvers
872  ISTL::ParallelHelper<GFS> helper(gfs);
873  helper.maskForeignDOFs(Backend::native(x));
875  if (gfs.gridView().comm().size()>1)
876  gfs.gridView().communicate(adddh,Dune::InteriorBorder_All_Interface,Dune::ForwardCommunication);
877  }
878  private:
879  std::shared_ptr<CON> conp;
880  };
881 
882  // Discontinuous space
883  // default implementation, use only specializations below
884  template<typename T, typename N, unsigned int degree,
885  Dune::GeometryType::BasicType gt, SolverCategory::Category st = SolverCategory::sequential,
887  class DGPkSpace
888  {
889  public:
890 
891  // export types
892  typedef T Grid;
893  typedef typename T::LeafGridView GV;
894  typedef typename T::ctype ctype;
895  static const int dim = T::dimension;
896  static const int dimworld = T::dimensionworld;
897  typedef N NT;
898 #if HAVE_GMP
900 #else
902 #endif
904  typedef typename CONB::CON CON;
905  typedef VBET VBE;
909  typedef typename GFS::template ConstraintsContainer<N>::Type CC;
911 
912  // constructor making the grid function space an all that is needed
913  DGPkSpace (const GV& gridview) : gv(gridview), conb()
914  {
915  femp = std::shared_ptr<FEM>(new FEM());
916  gfsp = std::shared_ptr<GFS>(new GFS(gv,*femp));
917  // initialize ordering
918  gfsp->update();
919  ccp = std::shared_ptr<CC>(new CC());
920  }
921 
922  FEM& getFEM() { return *femp; }
923  const FEM& getFEM() const { return *femp; }
924 
925  // return gfs reference
926  GFS& getGFS () { return *gfsp; }
927 
928  // return gfs reference const version
929  const GFS& getGFS () const {return *gfsp;}
930 
931  // return gfs reference
932  CC& getCC () { return *ccp;}
933 
934  // return gfs reference const version
935  const CC& getCC () const { return *ccp;}
936 
937  template<class BCTYPE>
938  void assembleConstraints (const BCTYPE& bctype)
939  {
940  ccp->clear();
941  constraints(bctype,*gfsp,*ccp);
942  }
943 
945  {
946  ccp->clear();
947  }
948 
949  void setConstrainedDOFS (DOF& x, NT nt) const
950  {
951  set_constrained_dofs(*ccp,nt,x);
952  conb.make_consistent(*gfsp,x);
953  }
954 
955  void setNonConstrainedDOFS (DOF& x, NT nt) const
956  {
957  set_nonconstrained_dofs(*ccp,nt,x);
958  conb.make_consistent(*gfsp,x);
959  }
960 
961  void copyConstrainedDOFS (const DOF& xin, DOF& xout) const
962  {
963  copy_constrained_dofs(*ccp,xin,xout);
964  conb.make_consistent(*gfsp,xout);
965  }
966 
967  void copyNonConstrainedDOFS (const DOF& xin, DOF& xout) const
968  {
969  copy_nonconstrained_dofs(*ccp,xin,xout);
970  conb.make_consistent(*gfsp,xout);
971  }
972 
973  private:
974  GV gv; // need this object here because FEM and GFS store a const reference !!
975  CONB conb;
976  std::shared_ptr<FEM> femp;
977  std::shared_ptr<GFS> gfsp;
978  std::shared_ptr<CC> ccp;
979  };
980 
981  // Discontinuous space
982  // default implementation, use only specializations below
983  template<typename T, typename N, unsigned int degree,
984  Dune::GeometryType::BasicType gt, SolverCategory::Category st = SolverCategory::sequential,
985  //typename VBET=ISTL::VectorBackend<ISTL::Blocking::fixed,Dune::PB::PkSize<degree,T::dimension>::value> >
986  typename VBET=ISTL::VectorBackend<> >
988  {
989  public:
990 
991  // export types
992  typedef T Grid;
993  typedef typename T::LeafGridView GV;
994  typedef typename T::ctype ctype;
995  static const int dim = T::dimension;
996  static const int dimworld = T::dimensionworld;
997  typedef N NT;
998 #if HAVE_GMP
1000 #else
1002 #endif
1004  typedef typename CONB::CON CON;
1005  typedef VBET VBE;
1009  typedef typename GFS::template ConstraintsContainer<N>::Type CC;
1011 
1012  // constructor making the grid function space an all that is needed
1013  DGQkOPBSpace (const GV& gridview) : gv(gridview), conb()
1014  {
1015  femp = std::shared_ptr<FEM>(new FEM());
1016  gfsp = std::shared_ptr<GFS>(new GFS(gv,*femp));
1017  // initialize ordering
1018  gfsp->update();
1019  ccp = std::shared_ptr<CC>(new CC());
1020  }
1021 
1022  FEM& getFEM() { return *femp; }
1023  const FEM& getFEM() const { return *femp; }
1024 
1025  // return gfs reference
1026  GFS& getGFS () { return *gfsp; }
1027 
1028  // return gfs reference const version
1029  const GFS& getGFS () const {return *gfsp;}
1030 
1031  // return gfs reference
1032  CC& getCC () { return *ccp;}
1033 
1034  // return gfs reference const version
1035  const CC& getCC () const { return *ccp;}
1036 
1037  template<class BCTYPE>
1038  void assembleConstraints (const BCTYPE& bctype)
1039  {
1040  ccp->clear();
1041  constraints(bctype,*gfsp,*ccp);
1042  }
1043 
1045  {
1046  ccp->clear();
1047  }
1048 
1049  void setConstrainedDOFS (DOF& x, NT nt) const
1050  {
1051  set_constrained_dofs(*ccp,nt,x);
1052  conb.make_consistent(*gfsp,x);
1053  }
1054 
1055  void setNonConstrainedDOFS (DOF& x, NT nt) const
1056  {
1057  set_nonconstrained_dofs(*ccp,nt,x);
1058  conb.make_consistent(*gfsp,x);
1059  }
1060 
1061  void copyConstrainedDOFS (const DOF& xin, DOF& xout) const
1062  {
1063  copy_constrained_dofs(*ccp,xin,xout);
1064  conb.make_consistent(*gfsp,xout);
1065  }
1066 
1067  void copyNonConstrainedDOFS (const DOF& xin, DOF& xout) const
1068  {
1069  copy_nonconstrained_dofs(*ccp,xin,xout);
1070  conb.make_consistent(*gfsp,xout);
1071  }
1072 
1073  private:
1074  GV gv; // need this object here because FEM and GFS store a const reference !!
1075  CONB conb;
1076  std::shared_ptr<FEM> femp;
1077  std::shared_ptr<GFS> gfsp;
1078  std::shared_ptr<CC> ccp;
1079  };
1080 
1081  // Discontinuous space
1082  // default implementation, use only specializations below
1083  template<typename T, typename N, unsigned int degree,
1084  Dune::GeometryType::BasicType gt, SolverCategory::Category st = SolverCategory::sequential,
1087  {
1088  public:
1089 
1090  // export types
1091  typedef T Grid;
1092  typedef typename T::LeafGridView GV;
1093  typedef typename T::ctype ctype;
1094  static const int dim = T::dimension;
1095  static const int dimworld = T::dimensionworld;
1096  typedef N NT;
1097  typedef QkDGLocalFiniteElementMap<ctype,NT,degree,dim> FEM;
1099  typedef typename CONB::CON CON;
1100  typedef VBET VBE;
1104  typedef typename GFS::template ConstraintsContainer<N>::Type CC;
1106 
1107  // constructor making the grid function space an all that is needed
1108  DGQkSpace (const GV& gridview) : gv(gridview), conb()
1109  {
1110  femp = std::shared_ptr<FEM>(new FEM());
1111  gfsp = std::shared_ptr<GFS>(new GFS(gv,*femp));
1112  // initialize ordering
1113  gfsp->update();
1114  ccp = std::shared_ptr<CC>(new CC());
1115  }
1116 
1117  FEM& getFEM() { return *femp; }
1118  const FEM& getFEM() const { return *femp; }
1119 
1120  // return gfs reference
1121  GFS& getGFS () { return *gfsp; }
1122 
1123  // return gfs reference const version
1124  const GFS& getGFS () const {return *gfsp;}
1125 
1126  // return gfs reference
1127  CC& getCC () { return *ccp;}
1128 
1129  // return gfs reference const version
1130  const CC& getCC () const { return *ccp;}
1131 
1132  template<class BCTYPE>
1133  void assembleConstraints (const BCTYPE& bctype)
1134  {
1135  ccp->clear();
1136  constraints(bctype,*gfsp,*ccp);
1137  }
1138 
1140  {
1141  ccp->clear();
1142  }
1143 
1144  void setConstrainedDOFS (DOF& x, NT nt) const
1145  {
1146  set_constrained_dofs(*ccp,nt,x);
1147  conb.make_consistent(*gfsp,x);
1148  }
1149 
1150  void setNonConstrainedDOFS (DOF& x, NT nt) const
1151  {
1152  set_nonconstrained_dofs(*ccp,nt,x);
1153  conb.make_consistent(*gfsp,x);
1154  }
1155 
1156  void copyConstrainedDOFS (const DOF& xin, DOF& xout) const
1157  {
1158  copy_constrained_dofs(*ccp,xin,xout);
1159  conb.make_consistent(*gfsp,xout);
1160  }
1161 
1162  void copyNonConstrainedDOFS (const DOF& xin, DOF& xout) const
1163  {
1164  copy_nonconstrained_dofs(*ccp,xin,xout);
1165  conb.make_consistent(*gfsp,xout);
1166  }
1167 
1168  private:
1169  GV gv; // need this object here because FEM and GFS store a const reference !!
1170  CONB conb;
1171  std::shared_ptr<FEM> femp;
1172  std::shared_ptr<GFS> gfsp;
1173  std::shared_ptr<CC> ccp;
1174  };
1175 
1176 
1177  // Discontinuous space using QK with Gauss Lobatto points (use only for cube elements)
1178  template<typename T, typename N, unsigned int degree,
1179  Dune::GeometryType::BasicType gt, SolverCategory::Category st = SolverCategory::sequential,
1180  //typename VBET=ISTL::VectorBackend<ISTL::Blocking::fixed,Dune::QkStuff::QkSize<degree,T::dimension>::value> >
1181  typename VBET=ISTL::VectorBackend<> >
1183  {
1184  public:
1185 
1186  // export types
1187  typedef T Grid;
1188  typedef typename T::LeafGridView GV;
1189  typedef typename T::ctype ctype;
1190  static const int dim = T::dimension;
1191  static const int dimworld = T::dimensionworld;
1192  typedef N NT;
1193  typedef QkDGLocalFiniteElementMap<ctype,NT,degree,dim,QkDGBasisPolynomial::lobatto> FEM;
1195  typedef typename CONB::CON CON;
1196  typedef VBET VBE;
1200  typedef typename GFS::template ConstraintsContainer<N>::Type CC;
1202 
1203  // constructor making the grid function space an all that is needed
1204  DGQkGLSpace (const GV& gridview) : gv(gridview), conb()
1205  {
1206  femp = std::shared_ptr<FEM>(new FEM());
1207  gfsp = std::shared_ptr<GFS>(new GFS(gv,*femp));
1208  // initialize ordering
1209  gfsp->update();
1210  ccp = std::shared_ptr<CC>(new CC());
1211  }
1212 
1213  FEM& getFEM() { return *femp; }
1214  const FEM& getFEM() const { return *femp; }
1215 
1216  // return gfs reference
1217  GFS& getGFS () { return *gfsp; }
1218 
1219  // return gfs reference const version
1220  const GFS& getGFS () const {return *gfsp;}
1221 
1222  // return gfs reference
1223  CC& getCC () { return *ccp;}
1224 
1225  // return gfs reference const version
1226  const CC& getCC () const { return *ccp;}
1227 
1228  template<class BCTYPE>
1229  void assembleConstraints (const BCTYPE& bctype)
1230  {
1231  ccp->clear();
1232  constraints(bctype,*gfsp,*ccp);
1233  }
1234 
1236  {
1237  ccp->clear();
1238  }
1239 
1240  void setConstrainedDOFS (DOF& x, NT nt) const
1241  {
1242  set_constrained_dofs(*ccp,nt,x);
1243  conb.make_consistent(*gfsp,x);
1244  }
1245 
1246  void setNonConstrainedDOFS (DOF& x, NT nt) const
1247  {
1248  set_nonconstrained_dofs(*ccp,nt,x);
1249  conb.make_consistent(*gfsp,x);
1250  }
1251 
1252  void copyConstrainedDOFS (const DOF& xin, DOF& xout) const
1253  {
1254  copy_constrained_dofs(*ccp,xin,xout);
1255  conb.make_consistent(*gfsp,xout);
1256  }
1257 
1258  void copyNonConstrainedDOFS (const DOF& xin, DOF& xout) const
1259  {
1260  copy_nonconstrained_dofs(*ccp,xin,xout);
1261  conb.make_consistent(*gfsp,xout);
1262  }
1263 
1264  private:
1265  GV gv; // need this object here because FEM and GFS store a const reference !!
1266  CONB conb;
1267  std::shared_ptr<FEM> femp;
1268  std::shared_ptr<GFS> gfsp;
1269  std::shared_ptr<CC> ccp;
1270  };
1271 
1272 
1273  // Discontinuous space using Legendre polynomials (use only for cube elements)
1274  template<typename T, typename N, unsigned int degree,
1275  Dune::GeometryType::BasicType gt, SolverCategory::Category st = SolverCategory::sequential,
1276  //typename VBET=ISTL::VectorBackend<ISTL::Blocking::fixed,Dune::QkStuff::QkSize<degree,T::dimension>::value> >
1277  typename VBET=ISTL::VectorBackend<> >
1279  {
1280  public:
1281 
1282  // export types
1283  typedef T Grid;
1284  typedef typename T::LeafGridView GV;
1285  typedef typename T::ctype ctype;
1286  static const int dim = T::dimension;
1287  static const int dimworld = T::dimensionworld;
1288  typedef N NT;
1289  typedef QkDGLocalFiniteElementMap<ctype,NT,degree,dim,QkDGBasisPolynomial::legendre> FEM;
1291  typedef typename CONB::CON CON;
1292  typedef VBET VBE;
1296  typedef typename GFS::template ConstraintsContainer<N>::Type CC;
1298 
1299  // constructor making the grid function space an all that is needed
1300  DGLegendreSpace (const GV& gridview) : gv(gridview), conb()
1301  {
1302  femp = std::shared_ptr<FEM>(new FEM());
1303  gfsp = std::shared_ptr<GFS>(new GFS(gv,*femp));
1304  // initialize ordering
1305  gfsp->update();
1306  ccp = std::shared_ptr<CC>(new CC());
1307  }
1308 
1309  FEM& getFEM() { return *femp; }
1310  const FEM& getFEM() const { return *femp; }
1311 
1312  // return gfs reference
1313  GFS& getGFS () { return *gfsp; }
1314 
1315  // return gfs reference const version
1316  const GFS& getGFS () const {return *gfsp;}
1317 
1318  // return gfs reference
1319  CC& getCC () { return *ccp;}
1320 
1321  // return gfs reference const version
1322  const CC& getCC () const { return *ccp;}
1323 
1324  template<class BCTYPE>
1325  void assembleConstraints (const BCTYPE& bctype)
1326  {
1327  ccp->clear();
1328  constraints(bctype,*gfsp,*ccp);
1329  }
1330 
1332  {
1333  ccp->clear();
1334  }
1335 
1336  void setConstrainedDOFS (DOF& x, NT nt) const
1337  {
1338  set_constrained_dofs(*ccp,nt,x);
1339  conb.make_consistent(*gfsp,x);
1340  }
1341 
1342  void setNonConstrainedDOFS (DOF& x, NT nt) const
1343  {
1344  set_nonconstrained_dofs(*ccp,nt,x);
1345  conb.make_consistent(*gfsp,x);
1346  }
1347 
1348  void copyConstrainedDOFS (const DOF& xin, DOF& xout) const
1349  {
1350  copy_constrained_dofs(*ccp,xin,xout);
1351  conb.make_consistent(*gfsp,xout);
1352  }
1353 
1354  void copyNonConstrainedDOFS (const DOF& xin, DOF& xout) const
1355  {
1356  copy_nonconstrained_dofs(*ccp,xin,xout);
1357  conb.make_consistent(*gfsp,xout);
1358  }
1359 
1360  private:
1361  GV gv; // need this object here because FEM and GFS store a const reference !!
1362  CONB conb;
1363  std::shared_ptr<FEM> femp;
1364  std::shared_ptr<GFS> gfsp;
1365  std::shared_ptr<CC> ccp;
1366  };
1367 
1368 
1369  // Discontinuous P0 space
1370  template<typename T, typename N,
1371  Dune::GeometryType::BasicType gt, SolverCategory::Category st = SolverCategory::sequential,
1372  typename VBET=ISTL::VectorBackend<> >
1373  class P0Space
1374  {
1375  public:
1376 
1377  // export types
1378  typedef T Grid;
1379  typedef typename T::LeafGridView GV;
1380  typedef typename T::ctype ctype;
1381  static const int dim = T::dimension;
1382  static const int dimworld = T::dimensionworld;
1383  typedef N NT;
1386  typedef typename CONB::CON CON;
1387  typedef VBET VBE;
1391  typedef typename GFS::template ConstraintsContainer<N>::Type CC;
1393 
1394  // constructor making the grid function space an all that is needed
1395  P0Space (const GV& gridview) : gv(gridview), conb()
1396  {
1397  femp = std::shared_ptr<FEM>(new FEM(Dune::GeometryType(gt,dim)));
1398  gfsp = std::shared_ptr<GFS>(new GFS(gv,*femp));
1399  // initialize ordering
1400  gfsp->update();
1401  ccp = std::shared_ptr<CC>(new CC());
1402  }
1403 
1404  FEM& getFEM() { return *femp; }
1405  const FEM& getFEM() const { return *femp; }
1406 
1407  // return gfs reference
1408  GFS& getGFS () { return *gfsp; }
1409 
1410  // return gfs reference const version
1411  const GFS& getGFS () const {return *gfsp;}
1412 
1413  // return gfs reference
1414  CC& getCC () { return *ccp;}
1415 
1416  // return gfs reference const version
1417  const CC& getCC () const { return *ccp;}
1418 
1419  template<class BCTYPE>
1420  void assembleConstraints (const BCTYPE& bctype)
1421  {
1422  ccp->clear();
1423  constraints(bctype,*gfsp,*ccp);
1424  }
1425 
1427  {
1428  ccp->clear();
1429  }
1430 
1431  void setConstrainedDOFS (DOF& x, NT nt) const
1432  {
1433  set_constrained_dofs(*ccp,nt,x);
1434  conb.make_consistent(*gfsp,x);
1435  }
1436 
1437  void setNonConstrainedDOFS (DOF& x, NT nt) const
1438  {
1439  set_nonconstrained_dofs(*ccp,nt,x);
1440  conb.make_consistent(*gfsp,x);
1441  }
1442 
1443  void copyConstrainedDOFS (const DOF& xin, DOF& xout) const
1444  {
1445  copy_constrained_dofs(*ccp,xin,xout);
1446  conb.make_consistent(*gfsp,xout);
1447  }
1448 
1449  void copyNonConstrainedDOFS (const DOF& xin, DOF& xout) const
1450  {
1451  copy_nonconstrained_dofs(*ccp,xin,xout);
1452  conb.make_consistent(*gfsp,xout);
1453  }
1454 
1455  private:
1456  GV gv; // need this object here because FEM and GFS store a const reference !!
1457  CONB conb;
1458  std::shared_ptr<FEM> femp;
1459  std::shared_ptr<GFS> gfsp;
1460  std::shared_ptr<CC> ccp;
1461  };
1462 
1463 
1464  // how can we most easily specify a grid function
1465  // pass a function space as parameter
1466  template<typename FS, typename Functor>
1468  : public GridFunctionBase<GridFunctionTraits<typename FS::GV, typename FS::NT,
1469  1,FieldVector<typename FS::NT,1> >
1470  ,UserFunction<FS,Functor> >
1471  {
1472  public:
1473  typedef GridFunctionTraits<typename FS::GV, typename FS::NT,
1474  1,FieldVector<typename FS::NT,1> > Traits;
1475 
1477  UserFunction (const FS& fs_, const Functor& f_)
1478  : fs(fs_), f(f_)
1479  {}
1480 
1482  inline void evaluate (const typename Traits::ElementType& e,
1483  const typename Traits::DomainType& x,
1484  typename Traits::RangeType& y) const
1485  {
1486  typename Traits::DomainType x_ = e.geometry().global(x);
1487  std::vector<double> x__(x.size());
1488  for (size_t i=0; i<x.size(); ++i) x__[i]=x_[i];
1489  y = f(x__);
1490  }
1491 
1492  inline const typename FS::GV& getGridView () const
1493  {
1494  return fs.getGFS().gridView();
1495  }
1496 
1497  private:
1498  const FS fs; // store a copy of the function space
1499  const Functor f;
1500  };
1501 
1502 
1503  template<typename FS, typename LOP, SolverCategory::Category st = SolverCategory::sequential>
1505  {
1506  public:
1507  // export types
1509  typedef Dune::PDELab::GridOperator<typename FS::GFS,typename FS::GFS,LOP,MBE,
1510  typename FS::NT,typename FS::NT,typename FS::NT,
1511  typename FS::CC,typename FS::CC> GO;
1512  typedef typename GO::Jacobian MAT;
1513 
1514  GalerkinGlobalAssembler (const FS& fs, LOP& lop, const std::size_t nonzeros)
1515  {
1516  gop = std::shared_ptr<GO>(new GO(fs.getGFS(),fs.getCC(),fs.getGFS(),fs.getCC(),lop,MBE(nonzeros)));
1517  }
1518 
1519  // return grid reference
1520  GO& getGO ()
1521  {
1522  return *gop;
1523  }
1524 
1525  // return grid reference const version
1526  const GO& getGO () const
1527  {
1528  return *gop;
1529  }
1530 
1532  {
1533  return *gop;
1534  }
1535 
1537  {
1538  return gop.operator->();
1539  }
1540 
1541  const GO& operator*() const
1542  {
1543  return *gop;
1544  }
1545 
1546  const GO* operator->() const
1547  {
1548  return gop.operator->();
1549  }
1550 
1551  private:
1552  std::shared_ptr<GO> gop;
1553  };
1554 
1555 
1556  template<typename FS, typename LOP, SolverCategory::Category st = SolverCategory::sequential>
1558  {
1559  public:
1560  // export types
1562  typedef Dune::PDELab::GridOperator<typename FS::GFS,typename FS::GFS,LOP,MBE,
1563  typename FS::NT,typename FS::NT,typename FS::NT,
1564  typename FS::CC,typename FS::CC> GO;
1565  typedef typename GO::Jacobian MAT;
1566 
1567  GalerkinGlobalAssemblerNewBackend (const FS& fs, LOP& lop, const MBE& mbe)
1568  {
1569  gop = std::shared_ptr<GO>(new GO(fs.getGFS(),fs.getCC(),fs.getGFS(),fs.getCC(),lop,mbe));
1570  }
1571 
1572  // return grid reference
1573  GO& getGO ()
1574  {
1575  return *gop;
1576  }
1577 
1578  // return grid reference const version
1579  const GO& getGO () const
1580  {
1581  return *gop;
1582  }
1583 
1585  {
1586  return *gop;
1587  }
1588 
1590  {
1591  return gop.operator->();
1592  }
1593 
1594  const GO& operator*() const
1595  {
1596  return *gop;
1597  }
1598 
1599  const GO* operator->() const
1600  {
1601  return gop.operator->();
1602  }
1603 
1604  private:
1605  std::shared_ptr<GO> gop;
1606  };
1607 
1608 
1609  // variant with two different function spaces
1610  template<typename FSU, typename FSV, typename LOP, SolverCategory::Category st>
1612  {
1613  public:
1614  // export types
1616  typedef Dune::PDELab::GridOperator<typename FSU::GFS,typename FSV::GFS,LOP,MBE,
1617  typename FSU::NT,typename FSU::NT,typename FSU::NT,
1618  typename FSU::CC,typename FSV::CC> GO;
1619  typedef typename GO::Jacobian MAT;
1620 
1621  GlobalAssembler (const FSU& fsu, const FSV& fsv, LOP& lop, const std::size_t nonzeros)
1622  {
1623  gop = std::shared_ptr<GO>(new GO(fsu.getGFS(),fsu.getCC(),fsv.getGFS(),fsv.getCC(),lop,MBE(nonzeros)));
1624  }
1625 
1626  // return grid reference
1627  GO& getGO ()
1628  {
1629  return *gop;
1630  }
1631 
1632  // return grid reference const version
1633  const GO& getGO () const
1634  {
1635  return *gop;
1636  }
1637 
1639  {
1640  return *gop;
1641  }
1642 
1644  {
1645  return gop.operator->();
1646  }
1647 
1648  const GO& operator*() const
1649  {
1650  return *gop;
1651  }
1652 
1653  const GO* operator->() const
1654  {
1655  return gop.operator->();
1656  }
1657 
1658  private:
1659  std::shared_ptr<GO> gop;
1660  };
1661 
1662 
1663  template<typename GO1, typename GO2, bool implicit = true>
1665  {
1666  public:
1667  // export types
1670  typedef typename GO::Jacobian MAT;
1671 
1672  OneStepGlobalAssembler (GO1& go1, GO2& go2)
1673  {
1674  gop = std::shared_ptr<GO>(new GO(*go1,*go2));
1675  }
1676 
1677  // return grid reference
1678  GO& getGO ()
1679  {
1680  return *gop;
1681  }
1682 
1683  // return grid reference const version
1684  const GO& getGO () const
1685  {
1686  return *gop;
1687  }
1688 
1690  {
1691  return *gop;
1692  }
1693 
1695  {
1696  return gop.operator->();
1697  }
1698 
1699  const GO& operator*() const
1700  {
1701  return *gop;
1702  }
1703 
1704  const GO* operator->() const
1705  {
1706  return gop.operator->();
1707  }
1708 
1709  private:
1710  std::shared_ptr<GO> gop;
1711  };
1712 
1713 
1714  // packaging of the CG_AMG_SSOR solver: default version is sequential
1715  template<typename FS, typename ASS, SolverCategory::Category st = SolverCategory::sequential>
1717  {
1718  public:
1719  // types exported
1721 
1722  ISTLSolverBackend_CG_AMG_SSOR (const FS& fs, const ASS& ass, unsigned maxiter_=5000,
1723  int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
1724  {
1725  lsp = std::shared_ptr<LS>(new LS(maxiter_,verbose_,reuse_,usesuperlu_));
1726  }
1727 
1728  LS& getLS () {return *lsp;}
1729  const LS& getLS () const { return *lsp;}
1730  LS& operator*(){return *lsp;}
1731  LS* operator->() { return lsp.operator->(); }
1732  const LS& operator*() const{return *lsp;}
1733  const LS* operator->() const{ return lsp.operator->();}
1734 
1735  private:
1736  std::shared_ptr<LS> lsp;
1737  };
1738 
1739  // packaging of the CG_AMG_SSOR solver: nonoverlapping version
1740  template<typename FS, typename ASS>
1741  class ISTLSolverBackend_CG_AMG_SSOR<FS,ASS, SolverCategory::nonoverlapping>
1742  {
1743  public:
1744  // types exported
1746 
1747  ISTLSolverBackend_CG_AMG_SSOR (const FS& fs, const ASS& ass, unsigned maxiter_=5000,
1748  int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
1749  {
1750  lsp = std::shared_ptr<LS>(new LS(fs.getGFS(),maxiter_,verbose_,reuse_,usesuperlu_));
1751  }
1752 
1753  LS& getLS () {return *lsp;}
1754  const LS& getLS () const { return *lsp;}
1755  LS& operator*(){return *lsp;}
1756  LS* operator->() { return lsp.operator->(); }
1757  const LS& operator*() const{return *lsp;}
1758  const LS* operator->() const{ return lsp.operator->();}
1759 
1760  private:
1761  std::shared_ptr<LS> lsp;
1762  };
1763 
1764  // packaging of the CG_AMG_SSOR solver: overlapping version
1765  template<typename FS, typename ASS>
1766  class ISTLSolverBackend_CG_AMG_SSOR<FS,ASS, SolverCategory::overlapping>
1767  {
1768  public:
1769  // types exported
1771 
1772  ISTLSolverBackend_CG_AMG_SSOR (const FS& fs, const ASS& ass, unsigned maxiter_=5000,
1773  int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
1774  {
1775  lsp = std::shared_ptr<LS>(new LS(fs.getGFS(),maxiter_,verbose_,reuse_,usesuperlu_));
1776  }
1777 
1778  LS& getLS () {return *lsp;}
1779  const LS& getLS () const { return *lsp;}
1780  LS& operator*(){return *lsp;}
1781  LS* operator->() { return lsp.operator->(); }
1782  const LS& operator*() const{return *lsp;}
1783  const LS* operator->() const{ return lsp.operator->();}
1784 
1785  private:
1786  std::shared_ptr<LS> lsp;
1787  };
1788 
1789  // packaging of the CG_SSOR solver: default version is sequential
1790  template<typename FS, typename ASS, SolverCategory::Category st = SolverCategory::sequential>
1792  {
1793  public:
1794  // types exported
1796 
1797  ISTLSolverBackend_CG_SSOR (const FS& fs, const ASS& ass, unsigned maxiter_=5000,
1798  int steps_=5, int verbose_=1)
1799  {
1800  lsp = std::shared_ptr<LS>(new LS(maxiter_,verbose_));
1801  }
1802 
1803  LS& getLS () {return *lsp;}
1804  const LS& getLS () const { return *lsp;}
1805  LS& operator*(){return *lsp;}
1806  LS* operator->() { return lsp.operator->(); }
1807  const LS& operator*() const{return *lsp;}
1808  const LS* operator->() const{ return lsp.operator->();}
1809 
1810  private:
1811  std::shared_ptr<LS> lsp;
1812  };
1813 
1814  // packaging of the CG_SSOR solver: nonoverlapping version
1815  template<typename FS, typename ASS>
1816  class ISTLSolverBackend_CG_SSOR<FS,ASS,SolverCategory::nonoverlapping>
1817  {
1818  public:
1819  // types exported
1821 
1822  ISTLSolverBackend_CG_SSOR (const FS& fs, const ASS& ass, unsigned maxiter_=5000,
1823  int steps_=5, int verbose_=1)
1824  {
1825  lsp = std::shared_ptr<LS>(new LS(fs.getGFS(),maxiter_,steps_,verbose_));
1826  }
1827 
1828  LS& getLS () {return *lsp;}
1829  const LS& getLS () const { return *lsp;}
1830  LS& operator*(){return *lsp;}
1831  LS* operator->() { return lsp.operator->(); }
1832  const LS& operator*() const{return *lsp;}
1833  const LS* operator->() const{ return lsp.operator->();}
1834 
1835  private:
1836  std::shared_ptr<LS> lsp;
1837  };
1838 
1839  // packaging of the CG_SSOR solver: overlapping version
1840  template<typename FS, typename ASS>
1841  class ISTLSolverBackend_CG_SSOR<FS,ASS,SolverCategory::overlapping>
1842  {
1843  public:
1844  // types exported
1846 
1847  ISTLSolverBackend_CG_SSOR (const FS& fs, const ASS& ass, unsigned maxiter_=5000,
1848  int steps_=5, int verbose_=1)
1849  {
1850  lsp = std::shared_ptr<LS>(new LS(fs.getGFS(),fs.getCC(),maxiter_,steps_,verbose_));
1851  }
1852 
1853  LS& getLS () {return *lsp;}
1854  const LS& getLS () const { return *lsp;}
1855  LS& operator*(){return *lsp;}
1856  LS* operator->() { return lsp.operator->(); }
1857  const LS& operator*() const{return *lsp;}
1858  const LS* operator->() const{ return lsp.operator->();}
1859 
1860  private:
1861  std::shared_ptr<LS> lsp;
1862  };
1863 
1864 
1865  // packaging of a default solver that should always work
1866  // in the sequential case : BCGS SSOR
1867  template<typename FS, typename ASS, SolverCategory::Category st = SolverCategory::sequential>
1869  {
1870  public:
1871  // types exported
1873 
1874  ISTLSolverBackend_IterativeDefault (const FS& fs, const ASS& ass, unsigned maxiter_=5000, int verbose_=1)
1875  {
1876  lsp = std::shared_ptr<LS>(new LS(maxiter_,verbose_));
1877  }
1878 
1879  LS& getLS () {return *lsp;}
1880  const LS& getLS () const { return *lsp;}
1881  LS& operator*(){return *lsp;}
1882  LS* operator->() { return lsp.operator->(); }
1883  const LS& operator*() const{return *lsp;}
1884  const LS* operator->() const{ return lsp.operator->();}
1885 
1886  private:
1887  std::shared_ptr<LS> lsp;
1888  };
1889 
1890  // in the nonoverlapping case : BCGS SSORk
1891  template<typename FS, typename ASS>
1892  class ISTLSolverBackend_IterativeDefault<FS,ASS,SolverCategory::nonoverlapping>
1893  {
1894  public:
1895  // types exported
1897 
1898  ISTLSolverBackend_IterativeDefault (const FS& fs, const ASS& ass, unsigned maxiter_=5000, int verbose_=1)
1899  {
1900  lsp = std::shared_ptr<LS>(new LS(ass.getGO(),maxiter_,3,verbose_));
1901  }
1902 
1903  LS& getLS () {return *lsp;}
1904  const LS& getLS () const { return *lsp;}
1905  LS& operator*(){return *lsp;}
1906  LS* operator->() { return lsp.operator->(); }
1907  const LS& operator*() const{return *lsp;}
1908  const LS* operator->() const{ return lsp.operator->();}
1909 
1910  private:
1911  std::shared_ptr<LS> lsp;
1912  };
1913 
1914  // in the overlapping case : BCGS SSORk
1915  template<typename FS, typename ASS>
1916  class ISTLSolverBackend_IterativeDefault<FS,ASS,SolverCategory::overlapping>
1917  {
1918  public:
1919  // types exported
1921 
1922  ISTLSolverBackend_IterativeDefault (const FS& fs, const ASS& ass, unsigned maxiter_=5000, int verbose_=1)
1923  {
1924  lsp = std::shared_ptr<LS>(new LS(fs.getGFS(),fs.getCC(),maxiter_,3,verbose_));
1925  }
1926 
1927  LS& getLS () {return *lsp;}
1928  const LS& getLS () const { return *lsp;}
1929  LS& operator*(){return *lsp;}
1930  LS* operator->() { return lsp.operator->(); }
1931  const LS& operator*() const{return *lsp;}
1932  const LS* operator->() const{ return lsp.operator->();}
1933 
1934  private:
1935  std::shared_ptr<LS> lsp;
1936  };
1937 
1938  // packaging of a default solver that should always work
1939  // in the sequential case : BCGS SSOR
1940  template<typename FS, typename ASS, SolverCategory::Category st = SolverCategory::sequential>
1942  {
1943  public:
1944  // types exported
1946 
1947  ISTLSolverBackend_ExplicitDiagonal (const FS& fs, const ASS& ass, unsigned maxiter_=5000, int verbose_=1)
1948  {
1949  lsp = std::shared_ptr<LS>(new LS());
1950  }
1951 
1952  LS& getLS () {return *lsp;}
1953  const LS& getLS () const { return *lsp;}
1954  LS& operator*(){return *lsp;}
1955  LS* operator->() { return lsp.operator->(); }
1956  const LS& operator*() const{return *lsp;}
1957  const LS* operator->() const{ return lsp.operator->();}
1958 
1959  private:
1960  std::shared_ptr<LS> lsp;
1961  };
1962 
1963  // packaging of a default solver that should always work
1964  // in the sequential case : BCGS SSOR
1965  template<typename FS, typename ASS>
1966  class ISTLSolverBackend_ExplicitDiagonal<FS,ASS,SolverCategory::overlapping>
1967  {
1968  public:
1969  // types exported
1971 
1972  ISTLSolverBackend_ExplicitDiagonal (const FS& fs, const ASS& ass, unsigned maxiter_=5000, int verbose_=1)
1973  {
1974  lsp = std::shared_ptr<LS>(new LS(fs.getGFS()));
1975  }
1976 
1977  LS& getLS () {return *lsp;}
1978  const LS& getLS () const { return *lsp;}
1979  LS& operator*(){return *lsp;}
1980  LS* operator->() { return lsp.operator->(); }
1981  const LS& operator*() const{return *lsp;}
1982  const LS* operator->() const{ return lsp.operator->();}
1983 
1984  private:
1985  std::shared_ptr<LS> lsp;
1986  };
1987 
1988  // packaging of a default solver that should always work
1989  // in the sequential case : BCGS SSOR
1990  template<typename FS, typename ASS>
1991  class ISTLSolverBackend_ExplicitDiagonal<FS,ASS,SolverCategory::nonoverlapping>
1992  {
1993  public:
1994  // types exported
1996 
1997  ISTLSolverBackend_ExplicitDiagonal (const FS& fs, const ASS& ass, unsigned maxiter_=5000, int verbose_=1)
1998  {
1999  lsp = std::shared_ptr<LS>(new LS(fs.getGFS()));
2000  }
2001 
2002  LS& getLS () {return *lsp;}
2003  const LS& getLS () const { return *lsp;}
2004  LS& operator*(){return *lsp;}
2005  LS* operator->() { return lsp.operator->(); }
2006  const LS& operator*() const{return *lsp;}
2007  const LS* operator->() const{ return lsp.operator->();}
2008 
2009  private:
2010  std::shared_ptr<LS> lsp;
2011  };
2012 
2013 
2014 } // end namespace PDELab
2015  } // end namespace Dune
2016 
2017 #endif // DUNE_PDELAB_BOILERPLATE_PDELAB_HH
Dune::PDELab::NonOverlappingEntitySet< GV > ES
Definition: pdelab.hh:703
DGPkSpace(const GV &gridview)
Definition: pdelab.hh:913
void set_nonconstrained_dofs(const CG &cg, typename XG::ElementType x, XG &xg)
Definition: constraints.hh:962
Solver to be used for explicit time-steppers with (block-)diagonal mass matrix.
Definition: seqistlsolverbackend.hh:503
GridFunctionSpace< ES, FEM, CON, VBE > GFS
Definition: pdelab.hh:714
Overlapping parallel conjugate gradient solver preconditioned with AMG smoothed by SSOR...
Definition: ovlpistlsolverbackend.hh:1258
T & getGrid()
Definition: pdelab.hh:156
T::LeafGridView GV
Definition: pdelab.hh:583
Definition: pdelab.hh:887
Dune::PDELab::P0LocalFiniteElementMap< ctype, NT, dim > FEM
Definition: pdelab.hh:1384
GO * operator->()
Definition: pdelab.hh:1589
Definition: partitionviewentityset.hh:34
std::shared_ptr< T > getSharedPtr()
Definition: pdelab.hh:150
Dune::PDELab::DiscreteGridFunction< GFS, DOF > DGF
Definition: pdelab.hh:1295
periodic boundary intersection (neighbor() == true && boundary() == true)
DGCONBase< st > CONB
Definition: pdelab.hh:1003
void copyNonConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1067
N NT
Definition: pdelab.hh:997
std::shared_ptr< T > getSharedPtr()
Definition: pdelab.hh:342
N NT
Definition: pdelab.hh:1288
void copyNonConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:797
Dune::PDELab::ISTLBackend_CG_AMG_SSOR< typename ASS::GO > LS
Definition: pdelab.hh:1770
T::LeafGridView GV
Definition: pdelab.hh:1379
Grid::ctype ctype
Definition: pdelab.hh:200
const Entity & e
Definition: localfunctionspace.hh:111
static const int dim
Definition: pdelab.hh:93
CONB::CON CON
Definition: pdelab.hh:1099
Dune::PDELab::OneStepGridOperator< typename GO1::GO, typename GO2::GO, implicit > GO
Definition: pdelab.hh:1669
Dune::PDELab::Backend::Matrix< MB, Domain, Range, JF > Jacobian
The type of the jacobian.
Definition: gridoperator.hh:50
DGCONBase< st > CONB
Definition: pdelab.hh:1290
void setNonConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1246
DGQkSpace(const GV &gridview)
Definition: pdelab.hh:1108
DGCONBase< st > CONB
Definition: pdelab.hh:1194
const GFS & getGFS() const
Definition: pdelab.hh:1411
std::enable_if< std::is_base_of< impl::WrapperBase, T >::value, Native< T > &>::type native(T &t)
Definition: backend/interface.hh:192
T::ctype ctype
Definition: pdelab.hh:92
leaf of a function tree
Definition: function.hh:298
T & operator*()
Definition: pdelab.hh:167
const LS & operator*() const
Definition: pdelab.hh:1732
const FEM & getFEM() const
Definition: pdelab.hh:923
Definition: istl/descriptors.hh:50
const GO & getGO() const
Definition: pdelab.hh:1526
GO & operator*()
Definition: pdelab.hh:1638
const FEM & getFEM() const
Definition: pdelab.hh:620
ISTL::BCRSMatrixBackend MBE
Definition: pdelab.hh:1668
std::shared_ptr< Grid > getSharedPtr()
Definition: pdelab.hh:281
CGCONBase(Grid &grid, const BCType &bctype, const GV &gv)
Definition: pdelab.hh:526
void copy_nonconstrained_dofs(const CG &cg, const XG &xgin, XG &xgout)
Definition: constraints.hh:989
const GO & operator*() const
Definition: pdelab.hh:1541
const GO & operator*() const
Definition: pdelab.hh:1699
CC & getCC()
Definition: pdelab.hh:1319
Definition: pdelab.hh:1373
void copyNonConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:678
LS & getLS()
Definition: pdelab.hh:1952
void copyConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1348
LS & getLS()
Definition: pdelab.hh:1728
GO::Jacobian MAT
Definition: pdelab.hh:1512
Parallel P0 constraints for overlapping grids.
Definition: p0.hh:15
VBET VBE
Definition: pdelab.hh:1100
const CC & getCC() const
Definition: pdelab.hh:1035
CC & getCC()
Definition: pdelab.hh:1223
HangingNodesDirichletConstraints< Grid, HangingNodesConstraintsAssemblers::CubeGridQ1Assembler, BCType > CON
Definition: pdelab.hh:472
VTKGridFunctionAdapter< DGF > VTKF
Definition: pdelab.hh:1392
const T * operator->() const
Definition: pdelab.hh:182
void copyConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1443
VTKGridFunctionAdapter< DGF > VTKF
Definition: pdelab.hh:910
CGCONBase< Grid, degree, gt, mt, st, BCType > CONB
Definition: pdelab.hh:589
ISTLSolverBackend_ExplicitDiagonal(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1)
Definition: pdelab.hh:1997
T::ctype ctype
Definition: pdelab.hh:1285
DGLegendreSpace(const GV &gridview)
Definition: pdelab.hh:1300
CC & getCC()
Definition: pdelab.hh:1127
void set_constrained_dofs(const CG &cg, typename XG::ElementType x, XG &xg)
construct constraints from given boundary condition function
Definition: constraints.hh:798
Dune::FieldVector< GV::Grid::ctype, GV::dimension > DomainType
domain type in dim-size coordinates
Definition: function.hh:49
GO::Jacobian MAT
Definition: pdelab.hh:1670
NoConstraints CON
Definition: pdelab.hh:827
GO & operator*()
Definition: pdelab.hh:1689
const LS * operator->() const
Definition: pdelab.hh:1808
const GO & getGO() const
Definition: pdelab.hh:1633
GFS::template ConstraintsContainer< N >::Type CC
Definition: pdelab.hh:1391
P0ParallelConstraints CON
Definition: pdelab.hh:861
QkLocalFiniteElementMap< GV, C, R, degree > FEM
Definition: pdelab.hh:415
Dune::PDELab::ISTLBackend_SEQ_ExplicitDiagonal LS
Definition: pdelab.hh:1945
void clearConstraints()
Definition: pdelab.hh:944
const LS & getLS() const
Definition: pdelab.hh:1729
void setNonConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:666
Dune::PDELab::ISTLBackend_NOVLP_BCGS_SSORk< typename ASS::GO > LS
Definition: pdelab.hh:1896
FEM & getFEM()
Definition: pdelab.hh:615
GridFunctionSpace< GV, FEM, CON, VBE > GFS
Definition: pdelab.hh:906
YaspGrid< dim > Grid
Definition: pdelab.hh:199
N NT
Definition: pdelab.hh:897
ISTL::BCRSMatrixBackend MBE
Definition: pdelab.hh:1615
Definition: pdelab.hh:390
Definition: pdelab.hh:1664
void assembleConstraints(const BCTYPE &bctype)
Definition: pdelab.hh:1133
ISTLBackend_OVLP_BCGS_SSORk< typename FS::GFS, typename FS::CC > LS
Definition: pdelab.hh:1920
GlobalAssembler(const FSU &fsu, const FSV &fsv, LOP &lop, const std::size_t nonzeros)
Definition: pdelab.hh:1621
VTKGridFunctionAdapter< DGF > VTKF
Definition: pdelab.hh:601
N NT
Definition: pdelab.hh:1096
CGSpace(Grid &grid, const BCType &bctype)
Definition: pdelab.hh:604
Dune::PDELab::GridOperator< typename FS::GFS, typename FS::GFS, LOP, MBE, typename FS::NT, typename FS::NT, typename FS::NT, typename FS::CC, typename FS::CC > GO
Definition: pdelab.hh:1564
void setConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1049
VBET VBE
Definition: pdelab.hh:905
GridFunctionSpace< GV, FEM, CON, VBE > GFS
Definition: pdelab.hh:1197
T::LeafGridView GV
Definition: pdelab.hh:1188
T Grid
Definition: pdelab.hh:582
Definition: gridoperator/onestep.hh:17
GridFunctionSpace< GV, FEM, CON, VBE > GFS
Definition: pdelab.hh:1388
const FEM & getFEM() const
Definition: pdelab.hh:1310
const CC & getCC() const
Definition: pdelab.hh:1226
FEM & getFEM()
Definition: pdelab.hh:1117
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:118
Dune::PDELab::ISTLBackend_NOVLP_ExplicitDiagonal< typename FS::GFS > LS
Definition: pdelab.hh:1995
void copyNonConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1258
StructuredGrid(Dune::GeometryType::BasicType meshtype, unsigned int cells, int overlap=1)
Definition: pdelab.hh:204
CC & getCC()
Definition: pdelab.hh:1032
Backend::Vector< GFS, N > DOF
Definition: pdelab.hh:1294
T::LeafGridView GV
Definition: pdelab.hh:1284
void assembleConstraints(const BCType &bctype)
Definition: pdelab.hh:649
void copyNonConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:967
GO & getGO()
Definition: pdelab.hh:1520
T Grid
Definition: pdelab.hh:1187
typename impl::BackendVectorSelector< GridFunctionSpace, FieldType >::Type Vector
alias of the return type of BackendVectorSelector
Definition: backend/interface.hh:106
void make_consistent(const GFS &gfs, DOF &x) const
Definition: pdelab.hh:869
UserFunction(const FS &fs_, const Functor &f_)
constructor
Definition: pdelab.hh:1477
GFS & getGFS()
Definition: pdelab.hh:1121
const GO & operator*() const
Definition: pdelab.hh:1648
QkDGLocalFiniteElementMap< ctype, NT, degree, dim, QkDGBasisPolynomial::lobatto > FEM
Definition: pdelab.hh:1193
Dune::PDELab::GridOperator< typename FS::GFS, typename FS::GFS, LOP, MBE, typename FS::NT, typename FS::NT, typename FS::NT, typename FS::CC, typename FS::CC > GO
Definition: pdelab.hh:1511
HangingNodesDirichletConstraints< Grid, HangingNodesConstraintsAssemblers::SimplexGridP1Assembler, BCType > CON
Definition: pdelab.hh:446
T Grid
Definition: pdelab.hh:328
T Grid
Definition: pdelab.hh:1378
StructuredGrid(Dune::GeometryType::BasicType meshtype, array< double, dimworld > lower_left, array< double, dimworld > upper_right, array< unsigned int, dim > cells)
Definition: pdelab.hh:117
Dune::PDELab::DiscreteGridFunction< GFS, DOF > DGF
Definition: pdelab.hh:1008
GFS & getGFS()
Definition: pdelab.hh:1217
const GFS & getGFS() const
Definition: pdelab.hh:1316
void clearConstraints()
Definition: pdelab.hh:655
void setConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:660
const Grid & operator*() const
Definition: pdelab.hh:308
T & operator*()
Definition: pdelab.hh:359
MeshType
Definition: pdelab.hh:432
GO & operator*()
Definition: pdelab.hh:1531
VTKGridFunctionAdapter< DGF > VTKF
Definition: pdelab.hh:1105
void copyConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1156
DGCONBase< st > CONB
Definition: pdelab.hh:1098
void clearConstraints()
Definition: pdelab.hh:1139
Dune::PDELab::DiscreteGridFunction< GFS, DOF > DGF
Definition: pdelab.hh:908
Dune::PDELab::ISTLBackend_SEQ_CG_AMG_SSOR< typename ASS::GO > LS
Definition: pdelab.hh:1720
Dune::PDELab::DiscreteGridFunction< GFS, DOF > DGF
Definition: pdelab.hh:1103
LS & operator*()
Definition: pdelab.hh:1881
GO & getGO()
Definition: pdelab.hh:1627
OneStepGlobalAssembler(GO1 &go1, GO2 &go2)
Definition: pdelab.hh:1672
const LS & getLS() const
Definition: pdelab.hh:1880
LS & getLS()
Definition: pdelab.hh:1879
static const int dimworld
Definition: pdelab.hh:94
void assembleConstraints(const BCTYPE &bctype)
Definition: pdelab.hh:1325
ISTLSolverBackend_ExplicitDiagonal(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1)
Definition: pdelab.hh:1947
const FS::GV & getGridView() const
Definition: pdelab.hh:1492
CGCONBase(Grid &grid, const BCType &bctype, const GV &gv)
Definition: pdelab.hh:500
GridFunctionSpace< GV, FEM, CON, VBE > GFS
Definition: pdelab.hh:1293
ISTLBackend_SEQ_CG_SSOR LS
Definition: pdelab.hh:1795
ISTLSolverBackend_IterativeDefault(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1)
Definition: pdelab.hh:1898
Backend::Vector< GFS, N > DOF
Definition: pdelab.hh:598
ISTLSolverBackend_IterativeDefault(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1)
Definition: pdelab.hh:1874
StructuredGrid(Dune::GeometryType::BasicType meshtype, unsigned int cells)
Definition: pdelab.hh:97
P0Space(const GV &gridview)
Definition: pdelab.hh:1395
const LS * operator->() const
Definition: pdelab.hh:1957
CGFEMBase< ES, ctype, N, degree, dim, gt > FEMB
Definition: pdelab.hh:707
LS * operator->()
Definition: pdelab.hh:1882
Dune::PDELab::DiscreteGridFunction< GFS, DOF > DGF
Definition: pdelab.hh:599
LS * operator->()
Definition: pdelab.hh:1806
void clearConstraints()
Definition: pdelab.hh:1426
void make_consistent(const GFS &gfs, DOF &x) const
Definition: pdelab.hh:852
VTKGridFunctionAdapter< DGF > VTKF
Definition: pdelab.hh:1010
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
GFS & getGFS()
Definition: pdelab.hh:1313
GO * operator->()
Definition: pdelab.hh:1643
LS & operator*()
Definition: pdelab.hh:1954
DGQkOPBSpace(const GV &gridview)
Definition: pdelab.hh:1013
CONB::CON CON
Definition: pdelab.hh:1386
const LS & getLS() const
Definition: pdelab.hh:1953
GFS::template ConstraintsContainer< N >::Type CC
Definition: pdelab.hh:909
CC & getCC()
Definition: pdelab.hh:932
DGCONBase< st > CONB
Definition: pdelab.hh:1385
ISTLSolverBackend_CG_AMG_SSOR(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Definition: pdelab.hh:1747
FEM & getFEM()
Definition: pdelab.hh:1213
T * operator->()
Definition: pdelab.hh:364
GridFunctionSpace< GV, FEM, CON, VBE > GFS
Definition: pdelab.hh:1101
void copyConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1252
void copyNonConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1354
const GO & getGO() const
Definition: pdelab.hh:1684
Dune::PDELab::ISTLBackend_NOVLP_CG_AMG_SSOR< typename ASS::GO > LS
Definition: pdelab.hh:1745
Backend::Vector< GFS, N > DOF
Definition: pdelab.hh:907
const CON & getCON() const
Definition: pdelab.hh:833
UnstructuredGrid(std::string filename, bool verbose=true, bool insert_boundary_segments=true)
Definition: pdelab.hh:334
Definition: l2orthonormal.hh:257
GalerkinGlobalAssembler(const FS &fs, LOP &lop, const std::size_t nonzeros)
Definition: pdelab.hh:1514
T Grid
Definition: pdelab.hh:1091
DGCONBase< st > CONB
Definition: pdelab.hh:903
ISTLBackend_OVLP_CG_SSORk< typename FS::GFS, typename FS::CC > LS
Definition: pdelab.hh:1845
const FEM & getFEM() const
Definition: pdelab.hh:1023
const LS * operator->() const
Definition: pdelab.hh:1733
T::ctype ctype
Definition: pdelab.hh:1093
void setConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:949
const T & operator*() const
Definition: pdelab.hh:177
void setNonConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1055
T::ctype ctype
Definition: pdelab.hh:994
void copyConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1061
CGCONBase< Grid, degree, gt, mt, SolverCategory::nonoverlapping, BCType > CONB
Definition: pdelab.hh:708
GFS::template ConstraintsContainer< N >::Type CC
Definition: pdelab.hh:1104
CONB::CON CON
Definition: pdelab.hh:1195
const GO * operator->() const
Definition: pdelab.hh:1704
Standard grid operator implementation.
Definition: gridoperator.hh:38
const GFS & getGFS() const
Definition: pdelab.hh:1124
void copyConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:791
const GO * operator->() const
Definition: pdelab.hh:1599
const GO * operator->() const
Definition: pdelab.hh:1546
QkDGLocalFiniteElementMap< ctype, NT, degree, dim > FEM
Definition: pdelab.hh:1097
Traits::Jacobian Jacobian
Definition: gridoperator/onestep.hh:56
VBET VBE
Definition: pdelab.hh:1292
GFS::template ConstraintsContainer< N >::Type CC
Definition: pdelab.hh:719
T * operator->()
Definition: pdelab.hh:172
void copyNonConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1162
Definition: pdelab.hh:1791
Definition: pdelab.hh:1086
const FEM & getFEM() const
Definition: pdelab.hh:1214
const GFS & getGFS() const
Definition: pdelab.hh:1029
GO & getGO()
Definition: pdelab.hh:1573
P0ParallelGhostConstraints CON
Definition: pdelab.hh:844
const T & getGrid() const
Definition: pdelab.hh:162
CGFEMBase< GV, ctype, N, degree, dim, gt > FEMB
Definition: pdelab.hh:588
Grid * operator->()
Definition: pdelab.hh:303
T Grid
Definition: pdelab.hh:1283
void setConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1431
const LS * operator->() const
Definition: pdelab.hh:1884
N NT
Definition: pdelab.hh:1192
const GO & operator*() const
Definition: pdelab.hh:1594
Backend::Vector< GFS, N > DOF
Definition: pdelab.hh:1102
const GFS & getGFS() const
Definition: pdelab.hh:929
GFS::template ConstraintsContainer< N >::Type CC
Definition: pdelab.hh:1296
CONB::CON CON
Definition: pdelab.hh:1004
GO::Jacobian MAT
Definition: pdelab.hh:1565
FEM & getFEM()
Definition: pdelab.hh:1022
T Grid
Definition: pdelab.hh:91
GO::Jacobian MAT
Definition: pdelab.hh:1619
const CC & getCC() const
Definition: pdelab.hh:644
GO * operator->()
Definition: pdelab.hh:1536
ISTL::BCRSMatrixBackend MBE
Definition: pdelab.hh:1508
ISTLBackend_NOVLP_CG_SSORk< typename ASS::GO > LS
Definition: pdelab.hh:1820
GFS::template ConstraintsContainer< N >::Type CC
Definition: pdelab.hh:600
void clearConstraints()
Definition: pdelab.hh:1331
Nonoverlapping parallel CG solver preconditioned by block SSOR.
Definition: novlpistlsolverbackend.hh:859
CC & getCC()
Definition: pdelab.hh:638
const CON & getCON() const
Definition: pdelab.hh:850
void assembleConstraints(const BCTYPE &bctype)
Definition: pdelab.hh:1420
void setNonConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1437
Definition: pdelab.hh:578
GridFunctionTraits< typename FS::GV, typename FS::NT, 1, FieldVector< typename FS::NT, 1 > > Traits
Definition: pdelab.hh:1474
const GFS & getGFS() const
Definition: pdelab.hh:1220
Backend using (possibly nested) ISTL BCRSMatrices.
Definition: bcrsmatrixbackend.hh:190
const CC & getCC() const
Definition: pdelab.hh:1417
QkDGLocalFiniteElementMap< ctype, NT, degree, dim, QkDGBasisPolynomial::legendre > FEM
Definition: pdelab.hh:1289
void assembleConstraints(const BCTYPE &bctype)
Definition: pdelab.hh:938
Overlapping parallel CGS solver with SSOR preconditioner.
Definition: ovlpistlsolverbackend.hh:727
VBET VBE
Definition: pdelab.hh:1387
OPBLocalFiniteElementMap< ctype, NT, degree, dim, gt, N, Dune::PB::BasisType::Qk > FEM
Definition: pdelab.hh:1001
Solver to be used for explicit time-steppers with (block-)diagonal mass matrix.
Definition: novlpistlsolverbackend.hh:634
Definition: pdelab.hh:87
Definition: pdelab.hh:1504
FEM & getFEM()
Definition: pdelab.hh:1309
extend conforming constraints class by processor boundary
Definition: conforming.hh:101
void setConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1240
GalerkinGlobalAssemblerNewBackend(const FS &fs, LOP &lop, const MBE &mbe)
Definition: pdelab.hh:1567
VBET VBE
Definition: pdelab.hh:1005
Overlapping parallel BiCGStab solver with SSOR preconditioner.
Definition: ovlpistlsolverbackend.hh:661
GFS & getGFS()
Definition: pdelab.hh:1408
const T & getGrid() const
Definition: pdelab.hh:354
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Evaluate the GridFunction at given position.
Definition: pdelab.hh:1482
Definition: pdelab.hh:439
const CC & getCC() const
Definition: pdelab.hh:1130
Dune::PDELab::DiscreteGridFunction< GFS, DOF > DGF
Definition: pdelab.hh:1199
ISTLSolverBackend_CG_SSOR(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int steps_=5, int verbose_=1)
Definition: pdelab.hh:1797
T::ctype ctype
Definition: pdelab.hh:329
wrap a GridFunction so it can be used with the VTKWriter from dune-grid.
Definition: vtkexport.hh:22
void make_consistent(const GFS &gfs, DOF &x) const
Definition: pdelab.hh:835
ISTLSolverBackend_CG_SSOR(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int steps_=5, int verbose_=1)
Definition: pdelab.hh:1847
T::ctype ctype
Definition: pdelab.hh:1380
ISTLSolverBackend_CG_AMG_SSOR(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Definition: pdelab.hh:1722
LS & operator*()
Definition: pdelab.hh:1730
const Grid * operator->() const
Definition: pdelab.hh:313
void copyConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:961
const FEM & getFEM() const
Definition: pdelab.hh:1118
VTKGridFunctionAdapter< DGF > VTKF
Definition: pdelab.hh:1201
GFS & getGFS()
Definition: pdelab.hh:1026
GO & getGO()
Definition: pdelab.hh:1678
VBET VBE
Definition: pdelab.hh:1196
GO * operator->()
Definition: pdelab.hh:1694
void copyNonConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:1449
Grid & getGrid()
Definition: pdelab.hh:287
Definition: pdelab.hh:433
void setConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1336
Definition: pdelab.hh:434
T Grid
Definition: pdelab.hh:892
void copy_constrained_dofs(const CG &cg, const XG &xgin, XG &xgout)
Definition: constraints.hh:938
void maskForeignDOFs(X &x) const
Mask out all DOFs not owned by the current process with 0.
Definition: parallelhelper.hh:115
StructuredGrid(Dune::GeometryType::BasicType meshtype, array< double, dimworld > lower_left, array< double, dimworld > upper_right, array< unsigned int, dim > cells, int overlap=1)
Definition: pdelab.hh:220
Nonoverlapping parallel CG solver preconditioned with AMG smoothed by SSOR.
Definition: novlpistlsolverbackend.hh:1072
Hanging Node constraints construction.
Definition: hangingnode.hh:318
Definition: pdelab.hh:820
void setNonConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1150
StructuredGrid(Dune::GeometryType::BasicType meshtype, array< double, dimworld > lower_left, array< double, dimworld > upper_right, array< unsigned int, dim > cells, array< bool, dim > periodic, int overlap=1)
Definition: pdelab.hh:250
GO & operator*()
Definition: pdelab.hh:1584
void assembleConstraints(const BCTYPE &bctype)
Definition: pdelab.hh:1038
LS & operator*()
Definition: pdelab.hh:1805
GFS::template ConstraintsContainer< N >::Type CC
Definition: pdelab.hh:1009
Nonoverlapping parallel BiCGSTAB solver preconditioned by block SSOR.
Definition: novlpistlsolverbackend.hh:834
const GO * operator->() const
Definition: pdelab.hh:1653
Dune::PDELab::ISTLBackend_OVLP_ExplicitDiagonal< typename FS::GFS > LS
Definition: pdelab.hh:1970
ISTLSolverBackend_CG_AMG_SSOR(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Definition: pdelab.hh:1772
Backend for sequential BiCGSTAB solver with SSOR preconditioner.
Definition: seqistlsolverbackend.hh:261
void clearConstraints()
Definition: pdelab.hh:1235
const LS & operator*() const
Definition: pdelab.hh:1956
void setNonConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1342
Dirichlet Constraints construction.
Definition: conforming.hh:36
T & getGrid()
Definition: pdelab.hh:348
N NT
Definition: pdelab.hh:597
void setNonConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:955
LS & getLS()
Definition: pdelab.hh:1803
FEMB::FEM FEM
Definition: pdelab.hh:591
T::LeafGridView GV
Definition: pdelab.hh:993
T::ctype ctype
Definition: pdelab.hh:1189
Definition: l2orthonormal.hh:257
CONB::CON CON
Definition: pdelab.hh:592
Backend::Vector< GFS, N > DOF
Definition: pdelab.hh:1198
GFS::template ConstraintsContainer< N >::Type CC
Definition: pdelab.hh:1200
Dune::PDELab::GridOperator< typename FSU::GFS, typename FSV::GFS, LOP, MBE, typename FSU::NT, typename FSU::NT, typename FSU::NT, typename FSU::CC, typename FSV::CC > GO
Definition: pdelab.hh:1618
T::ctype ctype
Definition: pdelab.hh:584
const GO & getGO() const
Definition: pdelab.hh:1579
void setConstrainedDOFS(DOF &x, NT nt) const
Definition: pdelab.hh:1144
Dune::PDELab::DiscreteGridFunction< GFS, DOF > DGF
Definition: pdelab.hh:1390
N NT
Definition: pdelab.hh:1383
Definition: pdelab.hh:1278
void constraints(const GFS &gfs, CG &cg, const bool verbose=false)
construct constraints
Definition: constraints.hh:751
CC & getCC()
Definition: pdelab.hh:1414
GFS & getGFS()
Definition: pdelab.hh:626
DGQkGLSpace(const GV &gridview)
Definition: pdelab.hh:1204
const Grid & getGrid() const
Definition: pdelab.hh:293
void copyConstrainedDOFS(const DOF &xin, DOF &xout) const
Definition: pdelab.hh:672
Definition: noconstraints.hh:16
LS * operator->()
Definition: pdelab.hh:1731
Definition: pdelab.hh:987
void clearConstraints()
Definition: pdelab.hh:1044
Solver to be used for explicit time-steppers with (block-)diagonal mass matrix.
Definition: ovlpistlsolverbackend.hh:1010
Backend::Vector< GFS, N > DOF
Definition: pdelab.hh:1389
T Grid
Definition: pdelab.hh:992
const CON & getCON() const
Definition: pdelab.hh:867
GridFunctionSpace< GV, FEM, CON, VBE > GFS
Definition: pdelab.hh:1006
Definition: genericdatahandle.hh:622
T::ctype ctype
Definition: pdelab.hh:894
Backend for sequential conjugate gradient solver with SSOR preconditioner.
Definition: seqistlsolverbackend.hh:348
const LS & operator*() const
Definition: pdelab.hh:1883
VTKGridFunctionAdapter< DGF > VTKF
Definition: pdelab.hh:1297
void assembleConstraints(const BCTYPE &bctype)
Definition: pdelab.hh:1229
Grid & operator*()
Definition: pdelab.hh:298
OPBLocalFiniteElementMap< ctype, NT, degree, dim, gt > FEM
Definition: pdelab.hh:901
const FEM & getFEM() const
Definition: pdelab.hh:1405
ISTLSolverBackend_IterativeDefault(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1)
Definition: pdelab.hh:1922
GFS & getGFS()
Definition: pdelab.hh:926
const T * operator->() const
Definition: pdelab.hh:374
GridFunctionSpace< GV, FEM, CON, VBE > GFS
Definition: pdelab.hh:595
convert a grid function space and a coefficient vector into a grid function
Definition: gridfunctionspaceutilities.hh:53
const T & operator*() const
Definition: pdelab.hh:369
VBET VBE
Definition: pdelab.hh:594
ISTLSolverBackend_ExplicitDiagonal(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int verbose_=1)
Definition: pdelab.hh:1972
FEM & getFEM()
Definition: pdelab.hh:922
Definition: pdelab.hh:324
PkLocalFiniteElementMap< GV, C, R, degree > FEM
Definition: pdelab.hh:397
Definition: pdelab.hh:1611
ISTLBackend_SEQ_BCGS_SSOR LS
Definition: pdelab.hh:1872
A grid function space.
Definition: gridfunctionspace.hh:169
CONB::CON CON
Definition: pdelab.hh:1291
FEM & getFEM()
Definition: pdelab.hh:1404
const LS & getLS() const
Definition: pdelab.hh:1804
const GFS & getGFS() const
Definition: pdelab.hh:632
CONB::CON CON
Definition: pdelab.hh:904
Backend::Vector< GFS, N > DOF
Definition: pdelab.hh:1007
Definition: pdelab.hh:1467
T::LeafGridView GV
Definition: pdelab.hh:893
T::LeafGridView GV
Definition: pdelab.hh:1092
Sequential conjugate gradient solver preconditioned with AMG smoothed by SSOR.
Definition: seqistlsolverbackend.hh:698
traits class holding the function signature, same as in local function
Definition: function.hh:176
Dune::PDELab::ISTL::BCRSMatrixBackend MBE
Definition: pdelab.hh:1561
LS * operator->()
Definition: pdelab.hh:1955
Dune::PDELab::DiscreteGridFunction< GFS, DOF > DGF
Definition: pdelab.hh:718
Definition: parallelhelper.hh:53
const CC & getCC() const
Definition: pdelab.hh:1322
ISTLSolverBackend_CG_SSOR(const FS &fs, const ASS &ass, unsigned maxiter_=5000, int steps_=5, int verbose_=1)
Definition: pdelab.hh:1822
Parallel P0 constraints for nonoverlapping grids with ghosts.
Definition: p0ghost.hh:16
const CC & getCC() const
Definition: pdelab.hh:935
const LS & operator*() const
Definition: pdelab.hh:1807
Definition: pdelab.hh:1182