DOpE
integratormixeddims.h
Go to the documentation of this file.
1 
24 #ifndef IntegratorMixed_H_
25 #define IntegratorMixed_H_
26 
27 #include <deal.II/lac/vector.h>
28 #include <deal.II/lac/block_sparsity_pattern.h>
29 #include <deal.II/lac/block_sparse_matrix.h>
30 #include <deal.II/numerics/matrix_tools.h>
31 #include <deal.II/numerics/vector_tools.h>
32 #include <deal.II/base/function.h>
33 #include <deal.II/dofs/dof_tools.h>
34 #include <deal.II/fe/mapping_q1.h>
35 
36 #include <vector>
37 
38 #include "elementdatacontainer.h"
39 #include "facedatacontainer.h"
40 #include "optproblemcontainer.h"
41 #if DEAL_II_VERSION_GTE(7,3,0)
42  #include <deal.II/base/types.h>
43  #endif
44 
45 namespace DOpE
46 {
64 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
65  int dimhigh>
67 {
68  public:
69  IntegratorMixedDimensions(INTEGRATORDATACONT& idc);
70 
72 
73  void ReInit();
74 
75  template<typename PROBLEM>
76  void ComputeNonlinearResidual(PROBLEM& pde, VECTOR &residual, bool apply_boundary_values = true);
77  template<typename PROBLEM, typename MATRIX>
78  void ComputeMatrix(PROBLEM& pde, MATRIX &matrix);
79  template<typename PROBLEM>
80  void
81  ComputeNonlinearRhs(PROBLEM& pde, VECTOR &residual, bool apply_boundary_values = true);
82 
83  template<typename PROBLEM>
84  void ComputeLocalControlConstraints (PROBLEM& pde, VECTOR &constraints);
85  template<typename PROBLEM>
86  SCALAR ComputeDomainScalar(PROBLEM& pde);
87  template<typename PROBLEM>
88  SCALAR ComputePointScalar(PROBLEM& pde);
89  template<typename PROBLEM>
90  SCALAR ComputeBoundaryScalar(PROBLEM& pde);
91  template<typename PROBLEM>
92  SCALAR ComputeFaceScalar(PROBLEM& pde);
93  template<typename PROBLEM>
94  SCALAR ComputeAlgebraicScalar(PROBLEM& pde);
95 
96  template<typename PROBLEM>
97  void ApplyInitialBoundaryValues(PROBLEM& pde, VECTOR &u);
98  template<typename PROBLEM>
99  void ApplyTransposedInitialBoundaryValues(PROBLEM& pde, VECTOR &u, SCALAR scale);
100  template<typename PROBLEM>
101  void ApplyNewtonBoundaryValues(PROBLEM& pde, VECTOR &u);
102  template<typename PROBLEM, typename MATRIX>
103  void ApplyNewtonBoundaryValues(PROBLEM& pde, MATRIX &matrix, VECTOR &rhs, VECTOR &sol);
104 
105  inline void AddDomainData(std::string name, const VECTOR* new_data);
106  inline void DeleteDomainData(std::string name);
107 
108  inline void AddParamData(std::string name, const dealii::Vector<SCALAR>* new_data);
109  inline void DeleteParamData(std::string name);
110 
111  inline const INTEGRATORDATACONT& GetIntegratorDataContainer() const;
112 
113  protected:
114  inline const std::map<std::string, const VECTOR*>& GetDomainData() const;
115  inline const std::map<std::string, const dealii::Vector<SCALAR>*>& GetParamData() const;
116 
117  inline void AddPresetRightHandSide(double s, dealii::Vector<SCALAR> &residual) const;
118 
119  private:
120  INTEGRATORDATACONT & idc_;
121 
122  std::map<std::string, const VECTOR*> domain_data_;
123  std::map<std::string, const dealii::Vector<SCALAR>*> param_data_;
124 };
125 
126 /**********************************Implementation*******************************************/
127 
128  template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR,
129  int dimlow, int dimhigh>
130  IntegratorMixedDimensions<INTEGRATORDATACONT, VECTOR, SCALAR, dimlow,
131  dimhigh>::IntegratorMixedDimensions(INTEGRATORDATACONT& idc) :
132  idc_(idc)
133  {
134  }
135 
136 /**********************************Implementation*******************************************/
137 
138 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
139  int dimhigh>
141 {
142 
143 }
144 
145 /*******************************************************************************************/
146 
147 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
148  int dimhigh>
150 {
151 
152 }
153 
154 /*******************************************************************************************/
155 
156 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
157  int dimhigh>
158 template<typename PROBLEM>
160  VECTOR &residual,
161  bool apply_boundary_values)
162 {
163  {
164  residual = 0.;
165  // Begin integration
166  const unsigned int dofs =
167  pde.GetBaseProblem().GetSpaceTimeHandler()->GetControlNDoFs();
168 
169  dealii::Vector<SCALAR> local_vector(dofs);
170  const auto& dof_handler =
171  pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandler();
172  auto element = pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandlerBeginActive();
173  auto endc = pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandlerEnd();
174 
175  // Initialize the data containers.
176  idc_.InitializeEDC(pde.GetUpdateFlags(),
177  *(pde.GetBaseProblem().GetSpaceTimeHandler()), element,
178  this->GetParamData(), this->GetDomainData());
179  auto& edc = idc_.GetElementDataContainer();
180 
181  bool need_faces = pde.HasFaces();
182  bool need_interfaces = pde.HasInterfaces();
183  std::vector<unsigned int> boundary_equation_colors = pde.GetBoundaryEquationColors();
184  bool need_boundary_integrals = (boundary_equation_colors.size() > 0);
185  idc_.InitializeFDC(pde.GetFaceUpdateFlags(),
186  *(pde.GetBaseProblem().GetSpaceTimeHandler()),
187  element,
188  this->GetParamData(),
189  this->GetDomainData());
190  auto & fdc = idc_.GetFaceDataContainer();
191 
192  for (; element[0] != endc[0]; element[0]++)
193  {
194  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
195  {
196  if (element[dh] == endc[dh])
197  {
198  throw DOpEException("Elementnumbers in DoFHandlers are not matching!",
199  "IntegratorMixedDimensions::ComputeNonlinearResidual");
200  }
201  }
202 
203  local_vector = 0;
204  edc.ReInit();
205 
206  pde.ElementRhs(edc,local_vector, -1.);
207 
208  if(need_boundary_integrals)
209  {
210  for (unsigned int face=0; face < dealii::GeometryInfo<dimhigh>::faces_per_cell; ++face)
211  {
212 #if DEAL_II_VERSION_GTE(8,3,0)
213  if (element[0]->face(face)->at_boundary()
214  &&
215  (find(boundary_equation_colors.begin(),boundary_equation_colors.end(),element[0]->face(face)->boundary_id()) != boundary_equation_colors.end()))
216 #else
217  if (element[0]->face(face)->at_boundary()
218  &&
219  (find(boundary_equation_colors.begin(),boundary_equation_colors.end(),element[0]->face(face)->boundary_indicator()) != boundary_equation_colors.end()))
220 #endif
221  {
222  fdc.ReInit(face);
223  pde.BoundaryRhs(fdc,local_vector,-1.);
224  }
225  }
226  }
227  if(need_faces)
228  {
229  for (unsigned int face=0; face < dealii::GeometryInfo<dimhigh>::faces_per_cell; ++face)
230  {
231  if (element[0]->neighbor_index(face) != -1)
232  {
233  fdc.ReInit(face);
234  pde.FaceRhs(fdc,local_vector,-1.);
235  }
236  }
237  }
238  if( need_interfaces)
239  {
240  throw DOpEException("Interfaces not implemented!",
241  "IntegratorMixedDimensions::ComputeNonlinearResidual");
242  }
243  //LocalToGlobal
244  for (unsigned int i = 0; i < dofs; ++i)
245  {
246  residual(i) += local_vector(i);
247  }
248 
249  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
250  {
251  element[dh]++;
252  }
253  }
254  //The Equation should not be space dependend.
255  local_vector = 0;
256  pde.ElementEquation(edc, local_vector, 1., 1.);
257 
258  for (unsigned int i = 0; i < dofs; ++i)
259  {
260  residual(i) += local_vector(i);
261  }
262 
263  if (pde.HasControlInDirichletData())
264  {
265  ApplyTransposedInitialBoundaryValues(pde,residual, -1.);
266  }
267  //Check if some preset righthandside exists.
268  local_vector = 0;
269  AddPresetRightHandSide(-1.,local_vector);
270  for (unsigned int i = 0; i < dofs; ++i)
271  {
272  residual(i) += local_vector(i);
273  }
274 
275  if (apply_boundary_values)
276  {
277  ApplyNewtonBoundaryValues(pde,residual);
278  }
279  }
280 }
281 /*******************************************************************************************/
282 
283 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
284  int dimhigh>
285 template<typename PROBLEM>
287  VECTOR &residual,
288  bool apply_boundary_values)
289 {
290  {
291  residual = 0.;
292  // Begin integration
293  const unsigned int dofs =
294  pde.GetBaseProblem().GetSpaceTimeHandler()->GetControlNDoFs();
295 
296  dealii::Vector<SCALAR> local_vector(dofs);
297  const auto& dof_handler =
298  pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandler();
299  auto element = pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandlerBeginActive();
300  auto endc = pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandlerEnd();
301 
302  // Initialize the data containers.
303  idc_.InitializeEDC(pde.GetUpdateFlags(),
304  *(pde.GetBaseProblem().GetSpaceTimeHandler()), element,
305  this->GetParamData(), this->GetDomainData());
306  auto& edc = idc_.GetElementDataContainer();
307 
308  bool need_faces = pde.HasFaces();
309  bool need_interfaces = pde.HasInterfaces();
310  std::vector<unsigned int> boundary_equation_colors = pde.GetBoundaryEquationColors();
311  bool need_boundary_integrals = (boundary_equation_colors.size() > 0);
312  idc_.InitializeFDC(pde.GetFaceUpdateFlags(),
313  *(pde.GetBaseProblem().GetSpaceTimeHandler()),
314  element,
315  this->GetParamData(),
316  this->GetDomainData());
317  auto & fdc = idc_.GetFaceDataContainer();
318 
319  for (; element[0] != endc[0]; element[0]++)
320  {
321  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
322  {
323  if (element[dh] == endc[dh])
324  {
325  throw DOpEException("Elementnumbers in DoFHandlers are not matching!",
326  "IntegratorMixedDimensions::ComputeNonlinearResidual");
327  }
328  }
329 
330  local_vector = 0;
331  edc.ReInit();
332 
333  pde.ElementRhs(edc,local_vector, 1.);
334 
335  if(need_boundary_integrals)
336  {
337  for (unsigned int face=0; face < dealii::GeometryInfo<dimhigh>::faces_per_cell; ++face)
338  {
339 #if DEAL_II_VERSION_GTE(8,3,0)
340  if (element[0]->face(face)->at_boundary()
341  &&
342  (find(boundary_equation_colors.begin(),boundary_equation_colors.end(),element[0]->face(face)->boundary_id()) != boundary_equation_colors.end()))
343 #else
344  if (element[0]->face(face)->at_boundary()
345  &&
346  (find(boundary_equation_colors.begin(),boundary_equation_colors.end(),element[0]->face(face)->boundary_indicator()) != boundary_equation_colors.end()))
347 #endif
348  {
349  fdc.ReInit(face);
350  pde.BoundaryRhs(fdc,local_vector,1.);
351  }
352  }
353  }
354  if(need_faces)
355  {
356  for (unsigned int face=0; face < dealii::GeometryInfo<dimhigh>::faces_per_cell; ++face)
357  {
358  if (element[0]->neighbor_index(face) != -1)
359  {
360  fdc.ReInit(face);
361  pde.FaceRhs(fdc,local_vector,1.);
362  }
363  }
364  }
365  if( need_interfaces)
366  {
367  throw DOpEException("Interfaces not implemented!",
368  "IntegratorMixedDimensions::ComputeNonlinearRhs");
369  }
370  //LocalToGlobal
371  for (unsigned int i = 0; i < dofs; ++i)
372  {
373  residual(i) += local_vector(i);
374  }
375 
376  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
377  {
378  element[dh]++;
379  }
380  }
381 
382  if (pde.HasControlInDirichletData())
383  {
384  ApplyTransposedInitialBoundaryValues(pde,residual, -1.);
385  }
386  //Check if some preset righthandside exists.
387  local_vector = 0;
388  AddPresetRightHandSide(-1.,local_vector);
389  for (unsigned int i = 0; i < dofs; ++i)
390  {
391  residual(i) += local_vector(i);
392  }
393 
394  if (apply_boundary_values)
395  {
396  ApplyNewtonBoundaryValues(pde,residual);
397  }
398  }
399 }
400 
401 /*******************************************************************************************/
402 
403 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
404  int dimhigh>
405 template<typename PROBLEM, typename MATRIX>
407 {
408  throw DOpEException("You should not use this function, try VoidLinearSolver instead.",
409  "IntegratorMixedDimensions::ComputeMatrix");
410 }
411 
412 /*******************************************************************************************/
413 
414 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
415  int dimhigh>
416 template<typename PROBLEM>
418 {
419  constraints = 0.;
420  pde.ComputeLocalControlConstraints(constraints,this->GetParamData(),this->GetDomainData());
421 }
422 /*******************************************************************************************/
423 
424  template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR,
425  int dimlow, int dimhigh>
426  template<typename PROBLEM>
427  SCALAR
428  IntegratorMixedDimensions<INTEGRATORDATACONT, VECTOR, SCALAR, dimlow,
429  dimhigh>::ComputeDomainScalar(PROBLEM& pde)
430  {
431  {
432  SCALAR ret = 0.;
433  const unsigned int n_q_points = this->GetQuadratureFormula()->size();
434 
435  const auto& dof_handler =
436  pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandler();
437  auto element = pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandlerBeginActive();
438  auto endc = pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandlerEnd();
439 
440  idc_.InitializeEDC(pde.GetUpdateFlags(),
441  *(pde.GetBaseProblem().GetSpaceTimeHandler()), element,
442  this->GetParamData(), this->GetDomainData());
443  auto& edc = idc_.GetElementDataContainer();
444 
445  for (; element[0] != endc[0]; element[0]++)
446  {
447  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
448  {
449  if (element[dh] == endc[dh])
450  {
451  throw DOpEException("Elementnumbers in DoFHandlers are not matching!",
452  "IntegratorMixedDimensions::ComputeDomainScalar");
453  }
454  }
455 
456  ret += pde.ElementFunctional(edc);
457 
458  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
459  {
460  element[dh]++;
461  }
462  }
463  return ret;
464  }
465 }
466 /*******************************************************************************************/
467 
468 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
469  int dimhigh>
470 template<typename PROBLEM>
472 {
473  if (pde.GetFEValuesNeededToBeInitialized())
474  {
475  this->InitializeFEValues();
476  }
477 
478  {
479  SCALAR ret = 0.;
480 
481  ret += pde.PointFunctional(this->GetParamData(), this->GetDomainData());
482 
483  return ret;
484  }
485 }
486 /*******************************************************************************************/
487 
488 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
489  int dimhigh>
490 template<typename PROBLEM>
492 {
493 
494  {
495  SCALAR ret = 0.;
496  // Begin integration
497 
498  const std::vector<const DOpEWrapper::DoFHandler<dimhigh, dealii::DoFHandler >*>& dof_handler =
499  pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandler();
500  std::vector<typename DOpEWrapper::DoFHandler<dimhigh, dealii::DoFHandler >::active_element_iterator>
501  element(dof_handler.size());
502  std::vector<typename DOpEWrapper::DoFHandler<dimhigh, dealii::DoFHandler>::active_element_iterator>
503  endc(dof_handler.size());
504 
505  for (unsigned int dh = 0; dh < dof_handler.size(); dh++)
506  {
507  element[dh] = dof_handler[dh]->begin_active();
508  endc[dh] = dof_handler[dh]->end();
509  }
510 
511  // Generate the data containers.
512  FaceDataContainer<dealii::DoFHandler, VECTOR, dimhigh> fdc(*(this->GetFaceQuadratureFormula()),
513  pde.GetFaceUpdateFlags(),
514  *(pde.GetBaseProblem().GetSpaceTimeHandler()), element,
515  this->GetParamData(), this->GetDomainData());
516 
517  std::vector<unsigned int> boundary_functional_colors =
518  pde.GetBoundaryFunctionalColors();
519  bool need_boundary_integrals = (boundary_functional_colors.size() > 0);
520  if (!need_boundary_integrals)
521  {
522  throw DOpEException("No boundary colors given!",
523  "IntegratorMixedDimensions::ComputeBoundaryScalar");
524  }
525 
526  for (; element[0] != endc[0]; element[0]++)
527  {
528  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
529  {
530  if (element[dh] == endc[dh])
531  {
532  throw DOpEException("Elementnumbers in DoFHandlers are not matching!",
533  "IntegratorMixedDimensions::ComputeBoundaryScalar");
534  }
535  }
536 
537  if(need_boundary_integrals)
538  {
539  for (unsigned int face=0; face < dealii::GeometryInfo<dimhigh>::faces_per_cell; ++face)
540  {
541 #if DEAL_II_VERSION_GTE(8,3,0)
542  if (element[0]->face(face)->at_boundary()
543  &&
544  (find(boundary_functional_colors.begin(),boundary_functional_colors.end(),
545  element[0]->face(face)->boundary_id()) != boundary_functional_colors.end()))
546 #else
547  if (element[0]->face(face)->at_boundary()
548  &&
549  (find(boundary_functional_colors.begin(),boundary_functional_colors.end(),
550  element[0]->face(face)->boundary_indicator()) != boundary_functional_colors.end()))
551 #endif
552  {
553 // pde.GetBaseProblem().GetSpaceTimeHandler()->ComputeFaceFEValues(element, face, pde.GetType());
554  fdc.ReInit(face);
555  ret += pde.BoundaryFunctional(fdc);
556  }
557  }
558  }
559  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
560  {
561  element[dh]++;
562  }
563  }
564  return ret;
565  }
566 }
567 /*******************************************************************************************/
568 
569 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
570  int dimhigh>
571 template<typename PROBLEM>
573 {
574  {
575  SCALAR ret = 0.;
576 
577  // Begin integration
578  const std::vector<const DOpEWrapper::DoFHandler<dimhigh, dealii::DoFHandler >*>& dof_handler =
579  pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandler();
580  std::vector<typename DOpEWrapper::DoFHandler<dimhigh, dealii::DoFHandler>::active_element_iterator>
581  element(dof_handler.size());
582  std::vector<typename DOpEWrapper::DoFHandler<dimhigh, dealii::DoFHandler>::active_element_iterator>
583  endc(dof_handler.size());
584 
585  for (unsigned int dh = 0; dh < dof_handler.size(); dh++)
586  {
587  element[dh] = dof_handler[dh]->begin_active();
588  endc[dh] = dof_handler[dh]->end();
589  }
590  // Generate the data containers.
591  FaceDataContainer<dealii::DoFHandler, VECTOR, dimhigh> fdc(*(this->GetFaceQuadratureFormula()),
592  pde.GetFaceUpdateFlags(),
593  *(pde.GetBaseProblem().GetSpaceTimeHandler()), element,
594  this->GetParamData(), this->GetDomainData());
595 
596  bool need_faces = pde.HasFaces();
597  if (!need_faces)
598  {
599  throw DOpEException("No faces required!", "IntegratorMixedDimensions::ComputeFaceScalar");
600  }
601 
602  for (; element[0] != endc[0]; element[0]++)
603  {
604  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
605  {
606  if (element[dh] == endc[dh])
607  {
608  throw DOpEException("Elementnumbers in DoFHandlers are not matching!",
609  "IntegratorMixedDimensions::ComputeFaceScalar");
610  }
611  }
612 
613  if(need_faces)
614  {
615  for (unsigned int face=0; face < dealii::GeometryInfo<dimhigh>::faces_per_cell; ++face)
616  {
617  fdc.ReInit(face);
618  ret +=pde.FaceFunctional(fdc);
619  }
620  }
621  for (unsigned int dh = 1; dh < dof_handler.size(); dh++)
622  {
623  element[dh]++;
624  }
625  }
626  return ret;
627  }
628 }
629 
630 /*******************************************************************************************/
631 
632 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
633  int dimhigh>
634 template<typename PROBLEM>
636 {
637  SCALAR ret = 0.;
638  ret = pde.AlgebraicFunctional(this->GetParamData(), this->GetDomainData());
639  return ret;
640 }
641 /*******************************************************************************************/
642 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
643  int dimhigh>
644 template<typename PROBLEM>
646  VECTOR &/*u*/)
647 {
648 }
649 /*******************************************************************************************/
650 
651 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
652  int dimhigh>
653 template<typename PROBLEM>
656  VECTOR &u,
657  SCALAR scale)
658 {
659  //Das macht nur sinn, wenn es um "Transponierte Dirichletdaten geht.
660  unsigned int dofs =
661  pde.GetBaseProblem().GetSpaceTimeHandler()->GetControlNDoFs();
662  dealii::Vector<SCALAR> local_vector(dofs);
663 
664  std::vector<unsigned int> dirichlet_colors = pde.GetTransposedDirichletColors();
665  std::vector<bool> selected_components;
666  if (dirichlet_colors.size() > 0)
667  {
668  selected_components.resize(
669  pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandler()[0]->n_dofs());
670  const std::vector<Point<dimhigh> >& support_points =
671  pde.GetBaseProblem().GetSpaceTimeHandler()->GetMapDoFToSupportPoints();
672 
673  for (unsigned int i = 0; i < dirichlet_colors.size(); i++)
674  {
675  unsigned int color = dirichlet_colors[i];
676  std::vector<bool> comp_mask = pde.GetTransposedDirichletCompMask(color);
677  std::vector<bool> current_comp(comp_mask.size(), false);
678 #if DEAL_II_VERSION_GTE(7,3,0)
679  std::set<types::boundary_id> boundary_indicators;
680 #else
681  std::set<unsigned char> boundary_indicators;
682 #endif
683  boundary_indicators.insert(color);
684  for (unsigned int j = 0; j < comp_mask.size(); j++)
685  {
686  if (j > 0)
687  current_comp[j - 1] = false;
688  if (comp_mask[j])
689  {
690  current_comp[j] = true;
691  //Hole eine Liste der DoFs auf dem Rand und die zugehoerigen Knoten
692  DoFTools::extract_boundary_dofs(pde.GetBaseProblem().GetSpaceTimeHandler()->GetDoFHandler()[0]->GetDEALDoFHandler(),
693  current_comp, selected_components, boundary_indicators);
694  }
696  pde.GetTransposedDirichletValues(color,
697  this->GetParamData(),
698  this->GetDomainData());
699  for (unsigned int k = 0; k < selected_components.size(); k++)
700  {
701  if (selected_components[k])
702  {
703  local_vector = 0.;
704  DD.value(support_points[k], j, k, local_vector);
705  for (unsigned int l = 0; l < dofs; ++l)
706  {
707  u(l) += scale * local_vector(l);
708  }
709  }
710  }
711  }
712  //end loop over components
713  }
714  }
715 }
716 
717 /*******************************************************************************************/
718 
719 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
720  int dimhigh>
721 template<typename PROBLEM>
723  VECTOR &/*u*/)
724 {
725  //We don't need those in the mixed case...
726 }
727 /*******************************************************************************************/
728 
729 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
730  int dimhigh>
731 template<typename PROBLEM, typename MATRIX>
733  MATRIX &/*matrix*/,
734  VECTOR &/*rhs*/,
735  VECTOR &/*sol*/)
736 {
737  //We don't need those in the mixed case...
738 }
739 
740 /*******************************************************************************************/
741 
742 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
743  int dimhigh>
745  std::string name,
746  const VECTOR* new_data)
747 {
748  if (domain_data_.find(name) != domain_data_.end())
749  {
750  throw DOpEException("Adding multiple Data with name " + name + " is prohibited!",
751  "IntegratorMixedDimensions::AddDomainData");
752  }
753  domain_data_.insert(std::pair<std::string, const VECTOR*>(name, new_data));
754 }
755 
756 /*******************************************************************************************/
757 
758 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
759  int dimhigh>
761  std::string name)
762 {
763  typename std::map<std::string, const VECTOR *>::iterator it = domain_data_.find(name);
764  if (it == domain_data_.end())
765  {
766  throw DOpEException("Deleting Data " + name + " is impossible! Data not found",
767  "IntegratorMixedDimensions::DeleteDomainData");
768  }
769  domain_data_.erase(it);
770 }
771 
772 /*******************************************************************************************/
773 
774 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
775  int dimhigh>
776 const std::map<std::string, const VECTOR*>& IntegratorMixedDimensions<INTEGRATORDATACONT, VECTOR,
777  SCALAR, dimlow, dimhigh>::GetDomainData() const
778 {
779  return domain_data_;
780 }
781 
782 /*******************************************************************************************/
783 
784 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
785  int dimhigh>
787  std::string name,
788  const dealii::Vector<
789  SCALAR>* new_data)
790 {
791  if (param_data_.find(name) != param_data_.end())
792  {
793  throw DOpEException("Adding multiple Data with name " + name + " is prohibited!",
794  "IntegratorMixedDimensions::AddParamData");
795  }
796  param_data_.insert(std::pair<std::string, const dealii::Vector<SCALAR>*>(name, new_data));
797 }
798 
799 /*******************************************************************************************/
800 
801 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
802  int dimhigh>
804  std::string name)
805 {
806  typename std::map<std::string, const dealii::Vector<SCALAR>*>::iterator it =
807  param_data_.find(name);
808  if (it == param_data_.end())
809  {
810  throw DOpEException("Deleting Data " + name + " is impossible! Data not found",
811  "IntegratorMixedDimensions::DeleteParamData");
812  }
813  param_data_.erase(it);
814 }
815 
816 /*******************************************************************************************/
817 
818 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR, int dimlow,
819  int dimhigh>
820 const std::map<std::string, const dealii::Vector<SCALAR>*>& IntegratorMixedDimensions<
821  INTEGRATORDATACONT, VECTOR, SCALAR, dimlow, dimhigh>::GetParamData() const
822 {
823  return param_data_;
824 }
825 /*******************************************************************************************/
826 
827 template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR,
828  int dimlow, int dimhigh>
829  const INTEGRATORDATACONT&
831  {
832  return idc_;
833  }
834 
835  /*******************************************************************************************/
836 
837  template<typename INTEGRATORDATACONT, typename VECTOR, typename SCALAR,
838  int dimlow, int dimhigh>
839  void
841  dealii::Vector<SCALAR> &residual) const
842  {
843  typename std::map<std::string, const dealii::Vector<SCALAR>*>::const_iterator it =
844  param_data_.find("fixed_rhs");
845  if (it != param_data_.end())
846  {
847  assert(residual.size() == it->second->size());
848  residual.add(s,*(it->second));
849  }
850  }
851 
852 /*******************************************************************************************/
853 }
854 #endif
855 
void ComputeMatrix(PROBLEM &pde, MATRIX &matrix)
Definition: integratormixeddims.h:406
const std::map< std::string, const VECTOR * > & GetDomainData() const
Definition: integratormixeddims.h:777
IntegratorMixedDimensions(INTEGRATORDATACONT &idc)
Definition: integratormixeddims.h:131
const INTEGRATORDATACONT & GetIntegratorDataContainer() const
Definition: integratormixeddims.h:830
~IntegratorMixedDimensions()
Definition: integratormixeddims.h:140
const std::map< std::string, const dealii::Vector< SCALAR > * > & GetParamData() const
Definition: integratormixeddims.h:821
void ApplyNewtonBoundaryValues(PROBLEM &pde, VECTOR &u)
Definition: integratormixeddims.h:722
void ComputeNonlinearRhs(PROBLEM &pde, VECTOR &residual, bool apply_boundary_values=true)
Definition: integratormixeddims.h:286
virtual void value(const dealii::Point< dealdim > &p, const unsigned int component, const unsigned int dof_number, dealii::Vector< double > &local_vector) const =0
void ReInit()
Definition: integratormixeddims.h:149
void DeleteDomainData(std::string name)
Definition: integratormixeddims.h:760
void ComputeLocalControlConstraints(PROBLEM &pde, VECTOR &constraints)
Definition: integratormixeddims.h:417
Definition: facedatacontainer.h:50
SCALAR ComputeAlgebraicScalar(PROBLEM &pde)
Definition: integratormixeddims.h:635
void AddPresetRightHandSide(double s, dealii::Vector< SCALAR > &residual) const
Definition: integratormixeddims.h:840
SCALAR ComputeDomainScalar(PROBLEM &pde)
Definition: integratormixeddims.h:429
void DeleteParamData(std::string name)
Definition: integratormixeddims.h:803
void ApplyInitialBoundaryValues(PROBLEM &pde, VECTOR &u)
Definition: integratormixeddims.h:645
Definition: integratormixeddims.h:66
void ApplyTransposedInitialBoundaryValues(PROBLEM &pde, VECTOR &u, SCALAR scale)
Definition: integratormixeddims.h:655
void ComputeNonlinearResidual(PROBLEM &pde, VECTOR &residual, bool apply_boundary_values=true)
Definition: integratormixeddims.h:159
SCALAR ComputeFaceScalar(PROBLEM &pde)
Definition: integratormixeddims.h:572
Definition: transposeddirichletdatainterface.h:37
void AddDomainData(std::string name, const VECTOR *new_data)
Definition: integratormixeddims.h:744
Definition: dopeexception.h:35
SCALAR ComputeBoundaryScalar(PROBLEM &pde)
Definition: integratormixeddims.h:491
SCALAR ComputePointScalar(PROBLEM &pde)
Definition: integratormixeddims.h:471
void AddParamData(std::string name, const dealii::Vector< SCALAR > *new_data)
Definition: integratormixeddims.h:786