24 #ifndef _STATE_PROBLEM_H_
25 #define _STATE_PROBLEM_H_
29 using namespace dealii;
46 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
47 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
52 _pde(pde), _opt_problem(OP)
54 _dirichlet_colors = _opt_problem._dirichlet_colors;
55 _dirichlet_comps = _opt_problem._dirichlet_comps;
56 _primal_dirichlet_values = _opt_problem._primal_dirichlet_values;
57 _state_boundary_equation_colors
58 = _opt_problem._state_boundary_equation_colors;
64 return "StateProblem";
78 template<
typename EDC>
80 dealii::Vector<double> &local_vector,
double scale,
83 _pde.Init_ElementEquation(edc, local_vector, scale, scale_ico);
90 template<
typename EDC>
93 dealii::Vector<double> &local_vector,
double scale)
95 _pde.Init_ElementRhs(& GetInitialValues(), edc, local_vector, scale);
104 const std::map<std::string,
const dealii::Vector<double>*> &,
105 const std::map<std::string, const VECTOR*> &,
116 template<
typename EDC>
118 dealii::FullMatrix<double> &local_entry_matrix,
double scale,
121 _pde.Init_ElementMatrix(edc, local_entry_matrix, scale, scale_ico);
130 template<
typename EDC>
132 ElementEquation(
const EDC& edc,
133 dealii::Vector<double> &local_vector,
double scale,
140 template<
typename EDC>
142 ElementTimeEquation(
const EDC& edc,
143 dealii::Vector<double> &local_vector,
double scale = 1.);
149 template<
typename EDC>
151 ElementTimeEquationExplicit(
const EDC& edc,
152 dealii::Vector<double> &local_vector,
double scale = 1.);
158 template<
typename EDC>
160 ElementRhs(
const EDC& edc,
161 dealii::Vector<double> &local_vector,
double scale = 1.);
169 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
170 const std::map<std::string, const VECTOR*> &domain_values,
171 VECTOR& rhs_vector,
double scale);
177 template<
typename EDC>
179 ElementMatrix(
const EDC& edc,
180 dealii::FullMatrix<double> &local_entry_matrix,
double scale = 1.,
181 double scale_ico = 1.);
187 template<
typename EDC>
189 ElementTimeMatrix(
const EDC& edc,
190 dealii::FullMatrix<double> &local_entry_matrix);
196 template<
typename EDC>
198 ElementTimeMatrixExplicit(
const EDC& edc,
199 dealii::FullMatrix<double> &local_entry_matrix);
205 template<
typename FDC>
207 FaceEquation(
const FDC& fdc,
208 dealii::Vector<double> &local_vector,
double scale = 1.,
double scale_ico = 1.);
214 template<
typename FDC>
216 InterfaceEquation(
const FDC& fdc,
217 dealii::Vector<double> &local_vector,
double scale = 1.,
double scale_ico = 1.);
223 template<
typename FDC>
225 FaceRhs(
const FDC& fdc,
226 dealii::Vector<double> &local_vector,
double scale = 1.);
232 template<
typename FDC>
234 FaceMatrix(
const FDC& fdc,
235 dealii::FullMatrix<double> &local_entry_matrix,
double scale = 1.,
double scale_ico = 1.);
237 template<
typename FDC>
239 InterfaceMatrix(
const FDC& fdc,
240 dealii::FullMatrix<double> &local_entry_matrix,
double scale = 1.,
double scale_ico = 1.);
246 template<
typename FDC>
248 BoundaryEquation(
const FDC& fdc,
249 dealii::Vector<double> &local_vector,
double scale = 1.,
double scale_ico = 1.);
255 template<
typename FDC>
257 BoundaryRhs(
const FDC& fdc,
258 dealii::Vector<double> &local_vector,
double scale = 1.);
264 template<
typename FDC>
266 BoundaryMatrix(
const FDC& fdc,
267 dealii::FullMatrix<double> &local_matrix,
double scale = 1.,
double scale_ico = 1.);
273 inline const dealii::SmartPointer<const dealii::FESystem<dim> >
280 inline const dealii::SmartPointer<
281 const dealii::hp::FECollection<dim> >
282 GetFECollection()
const;
308 HasInterfaces()
const;
314 inline dealii::UpdateFlags
315 GetUpdateFlags()
const;
321 inline dealii::UpdateFlags
322 GetFaceUpdateFlags()
const;
337 ComputeSparsityPattern(SPARSITYPATTERN & sparsity)
const;
342 ComputeMGSparsityPattern(dealii::MGLevelObject<dealii::BlockSparsityPattern> & mg_sparsity_patterns,
343 unsigned int n_levels)
const;
346 ComputeMGSparsityPattern(dealii::MGLevelObject<dealii::SparsityPattern> & mg_sparsity_patterns,
347 unsigned int n_levels)
const;
353 inline const std::vector<unsigned int>&
354 GetDirichletColors()
const;
359 inline const std::vector<bool>&
360 GetDirichletCompMask(
unsigned int color)
const;
365 inline const Function<dim>
369 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
370 const std::map<std::string, const VECTOR*> &domain_values)
const;
375 inline const std::vector<unsigned int>&
376 GetBoundaryEquationColors()
const;
381 inline const dealii::ConstraintMatrix&
382 GetDoFConstraints()
const;
387 const dealii::Function<dim>&
388 GetInitialValues()
const;
393 return _opt_problem.GetOutputHandler();
404 OPTPROBLEM& _opt_problem;
406 std::vector<unsigned int> _dirichlet_colors;
407 std::vector<std::vector<bool> > _dirichlet_comps;
408 std::vector<PrimalDirichletData<DD, VECTOR, dim>*>
409 _primal_dirichlet_values;
410 std::vector<unsigned int> _state_boundary_equation_colors;
418 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
419 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
420 template<
typename EDC>
422 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
423 dim>::ElementEquation(
const EDC& edc,
424 dealii::Vector<double> &local_vector,
double scale,
427 _pde.ElementEquation(edc, local_vector, scale, scale_ico);
432 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
433 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
434 template<
typename EDC>
436 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
437 dim>::ElementTimeEquation(
const EDC& edc,
438 dealii::Vector<double> &local_vector,
double scale)
445 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
446 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
447 template<
typename EDC>
449 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
450 dim>::ElementTimeEquationExplicit(
const EDC& edc,
451 dealii::Vector<double> &local_vector,
double scale)
458 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
459 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
460 template<
typename FDC>
462 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
463 dim>::FaceEquation(
const FDC& fdc,
464 dealii::Vector<double> &local_vector,
double scale,
double scale_ico)
471 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
472 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
473 template<
typename FDC>
475 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
476 dim>::InterfaceEquation(
const FDC& fdc,
477 dealii::Vector<double> &local_vector,
double scale,
double scale_ico)
483 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
484 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
485 template<
typename FDC>
487 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
488 dim>::BoundaryEquation(
const FDC& fdc,
489 dealii::Vector<double> &local_vector,
double scale,
double scale_ico)
496 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
497 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
498 template<
typename EDC>
500 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
501 dim>::ElementRhs(
const EDC& edc,
502 dealii::Vector<double> &local_vector,
double scale)
504 _pde.ElementRightHandSide(edc, local_vector, scale);
509 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
510 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
513 const std::map<std::string,
const dealii::Vector<double>*> &,
514 const std::map<std::string, const VECTOR*> &,
522 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
523 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
524 template<
typename FDC>
526 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
527 dim>::FaceRhs(
const FDC& fdc,
528 dealii::Vector<double> &local_vector,
double scale)
530 _pde.FaceRightHandSide(fdc, local_vector, scale);
535 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
536 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
537 template<
typename FDC>
539 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
540 dim>::BoundaryRhs(
const FDC& fdc,
541 dealii::Vector<double> &local_vector,
double scale)
543 _pde.BoundaryRightHandSide(fdc, local_vector, scale);
548 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
549 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
550 template<
typename EDC>
552 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
553 dim>::ElementMatrix(
const EDC& edc,
554 dealii::FullMatrix<double> &local_entry_matrix,
double scale,
557 _pde.
ElementMatrix(edc, local_entry_matrix, scale, scale_ico);
562 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
563 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
564 template<
typename EDC>
566 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
567 dim>::ElementTimeMatrix(
const EDC& edc,
568 FullMatrix<double> &local_entry_matrix)
575 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
576 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
577 template<
typename EDC>
579 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
580 dim>::ElementTimeMatrixExplicit(
const EDC& edc,
581 dealii::FullMatrix<double> &local_entry_matrix)
588 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
589 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
590 template<
typename FDC>
592 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
593 dim>::FaceMatrix(
const FDC& fdc,
594 FullMatrix<double> &local_entry_matrix,
double scale,
597 _pde.
FaceMatrix(fdc, local_entry_matrix, scale, scale_ico);
602 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
603 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
604 template<
typename FDC>
606 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
607 dim>::InterfaceMatrix(
const FDC& fdc,
608 FullMatrix<double> &local_entry_matrix,
double scale,
616 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
617 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
618 template<
typename FDC>
620 StateProblem<OPTPROBLEM, PDE, DD, SPARSITYPATTERN, VECTOR,
621 dim>::BoundaryMatrix(
const FDC& fdc,
622 FullMatrix<double> &local_matrix,
double scale,
630 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
631 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
640 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
641 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
642 const SmartPointer<const dealii::FESystem<dim> >
645 return _opt_problem.GetSpaceTimeHandler()->
GetFESystem(
"state");
649 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
650 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
651 const SmartPointer<const dealii::hp::FECollection<dim> >
659 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
660 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
666 return r | update_JxW_values;
671 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
672 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
678 return r | update_JxW_values;
683 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
684 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
689 _opt_problem.
SetTime(time, interval);
694 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
695 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
698 SPARSITYPATTERN & sparsity)
const
700 _opt_problem.GetSpaceTimeHandler()->ComputeStateSparsityPattern(sparsity);
705 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
706 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
709 dealii::MGLevelObject<dealii::BlockSparsityPattern> & mg_sparsity_patterns,
710 unsigned int n_levels)
const
712 _opt_problem.GetSpaceTimeHandler()->ComputeMGStateSparsityPattern(mg_sparsity_patterns, n_levels);
717 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
718 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
721 dealii::MGLevelObject<dealii::SparsityPattern> & mg_sparsity_patterns,
722 unsigned int n_levels)
const
724 _opt_problem.GetSpaceTimeHandler()->ComputeMGStateSparsityPattern(mg_sparsity_patterns, n_levels);
731 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
732 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
741 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
742 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
752 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
753 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
762 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
763 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
764 const std::vector<unsigned int>&
767 return _dirichlet_colors;
772 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
773 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
774 const std::vector<bool>&
776 unsigned int color)
const
778 unsigned int comp = _dirichlet_colors.size();
779 for (
unsigned int i = 0; i < _dirichlet_colors.size(); ++i)
781 if (_dirichlet_colors[i] == color)
787 if (comp == _dirichlet_colors.size())
790 s <<
"DirichletColor" << color <<
" has not been found !";
791 throw DOpEException(s.str(),
"OptProblem::GetDirichletCompMask");
793 return _dirichlet_comps[comp];
798 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
799 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
803 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
804 const std::map<std::string, const VECTOR*> &domain_values)
const
806 unsigned int col = _dirichlet_colors.size();
807 for (
unsigned int i = 0; i < _dirichlet_colors.size(); ++i)
809 if (_dirichlet_colors[i] == color)
815 if (col == _dirichlet_colors.size())
818 s <<
"DirichletColor" << color <<
" has not been found !";
819 throw DOpEException(s.str(),
"OptProblem::GetDirichletValues");
821 _primal_dirichlet_values[col]->ReInit(param_values, domain_values, color);
822 return *(_primal_dirichlet_values[col]);
827 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
828 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
829 const std::vector<unsigned int>&
832 return _state_boundary_equation_colors;
837 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
838 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
839 const dealii::ConstraintMatrix&
842 return _opt_problem.GetSpaceTimeHandler()->GetStateDoFConstraints();
844 template<
typename OPTPROBLEM,
typename PDE,
typename DD,
845 typename SPARSITYPATTERN,
typename VECTOR,
int dim>
const dealii::Function<dim>&
Definition: stateproblem.h:48
void FaceMatrix(const FDC &fdc, dealii::FullMatrix< double > &local_entry_matrix, double scale=1., double scale_ico=1.)
void InterfaceEquation(const FDC &fdc, dealii::Vector< double > &local_vector, double scale=1., double scale_ico=1.)
Definition: stateproblem.h:476
dealii::UpdateFlags GetFaceUpdateFlags() const
Definition: stateproblem.h:674
void Init_ElementEquation(const EDC &edc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: stateproblem.h:79
OPTPROBLEM & GetBaseProblem()
Definition: stateproblem.h:396
void ElementTimeEquationExplicit(const EDC &edc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: stateproblem.h:450
void BoundaryEquation(const FDC &fdc, dealii::Vector< double > &local_vector, double scale=1., double scale_ico=1.)
Definition: stateproblem.h:488
StateProblem(OPTPROBLEM &OP, PDE &pde)
Definition: stateproblem.h:51
const dealii::SmartPointer< const dealii::FESystem< dim > > GetFESystem() const
Definition: stateproblem.h:643
Definition: optproblemcontainer.h:70
void Init_PointRhs(const std::map< std::string, const dealii::Vector< double > * > &, const std::map< std::string, const VECTOR * > &, VECTOR &, double)
Definition: stateproblem.h:103
std::string GetName() const
Definition: stateproblem.h:62
const dealii::SmartPointer< const dealii::hp::FECollection< dim > > GetFECollection() const
Definition: stateproblem.h:652
void FaceEquation(const FDC &fdc, dealii::Vector< double > &local_vector, double scale=1., double scale_ico=1.)
Definition: stateproblem.h:463
DOpEOutputHandler< VECTOR > * GetOutputHandler()
Definition: stateproblem.h:391
Definition: timeiterator.h:63
void ElementMatrix(const EDC &edc, dealii::FullMatrix< double > &local_entry_matrix, double scale=1., double scale_ico=1.)
Definition: stateproblem.h:553
void SetTime(double time, const TimeIterator &interval)
Definition: stateproblem.h:686
bool HasInterfaces() const
Definition: stateproblem.h:755
void ElementTimeEquation(const EDC &edc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: stateproblem.h:437
dealii::UpdateFlags GetUpdateFlags() const
Definition: stateproblem.h:662
void Init_ElementRhs(const EDC &edc, dealii::Vector< double > &local_vector, double scale)
Definition: stateproblem.h:92
bool HasFaces() const
Definition: stateproblem.h:734
void InterfaceMatrix(const FDC &fdc, dealii::FullMatrix< double > &local_entry_matrix, double scale=1., double scale_ico=1.)
void BoundaryMatrix(const FDC &fdc, dealii::FullMatrix< double > &local_matrix, double scale=1., double scale_ico=1.)
std::string GetType() const
Definition: stateproblem.h:67
void ElementTimeMatrixExplicit(const EDC &edc, dealii::FullMatrix< double > &local_entry_matrix)
Definition: stateproblem.h:580
void Init_ElementMatrix(const EDC &edc, dealii::FullMatrix< double > &local_entry_matrix, double scale, double scale_ico)
Definition: stateproblem.h:117
void ElementTimeMatrix(const EDC &edc, dealii::FullMatrix< double > &local_entry_matrix)
const dealii::Function< dim > & GetInitialValues() const
Definition: stateproblem.h:846
Definition: dopeexception.h:35