24 #ifndef OptProblemContainer_H_
25 #define OptProblemContainer_H_
49 #include <deal.II/lac/vector.h>
50 #include <deal.II/lac/full_matrix.h>
51 #include <deal.II/grid/tria_iterator.h>
52 #include <deal.II/dofs/dof_handler.h>
53 #include <deal.II/dofs/dof_accessor.h>
54 #include <deal.II/dofs/dof_tools.h>
55 #include <deal.II/fe/fe_system.h>
56 #include <deal.II/fe/fe_values.h>
57 #include <deal.II/fe/mapping.h>
58 #include <deal.II/base/quadrature_lib.h>
59 #include <deal.II/lac/block_sparsity_pattern.h>
60 #include <deal.II/lac/compressed_simple_sparsity_pattern.h>
69 template<
typename VECTOR>
71 template<
typename VECTOR>
96 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
97 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
98 typename VECTOR,
int dopedim,
int dealdim,
99 template<
int,
int>
class FE = dealii::FESystem,
100 template<
int,
int>
class DH = dealii::DoFHandler>
105 CONSTRAINTS& constraints,
126 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>,
127 PDE, DD, SPARSITYPATTERN, VECTOR, dealdim>&
130 if (state_problem_ == NULL)
134 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE,
135 DH>, PDE, DD, SPARSITYPATTERN, VECTOR, dealdim>(
138 return *state_problem_;
144 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>&
159 ReInit(std::string algo_type);
174 ExceptionHandler_ = OH;
187 SetType(std::string type,
unsigned int num = 0);
206 template<
typename DATACONTAINER>
223 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
224 const std::map<std::string, const VECTOR*> &domain_values);
244 template<
typename FACEDATACONTAINER>
256 template<
typename FACEDATACONTAINER>
269 const std::map<std::string,
const dealii::Vector<double>*> &values,
270 const std::map<std::string, const VECTOR*> &block_values);
280 const std::map<std::string,
const dealii::Vector<double>*> &values,
281 const std::map<std::string, const VECTOR*> &block_values);
308 template<
typename DATACONTAINER>
311 dealii::Vector<double> &local_vector,
double scale,
321 template<
typename DATACONTAINER>
324 dealii::Vector<double> &local_vector,
double scale = 1.);
337 template<
typename DATACONTAINER>
340 dealii::Vector<double> &local_vector,
double scale = 1.);
355 template<
typename DATACONTAINER>
358 dealii::Vector<double> &local_vector,
double scale = 1.);
376 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
377 const std::map<std::string, const VECTOR*> &domain_values,
378 VECTOR& rhs_vector,
double scale = 1.);
405 template<
typename DATACONTAINER>
408 dealii::FullMatrix<double> &local_entry_matrix,
double scale = 1.,
409 double scale_ico = 1.);
424 template<
typename DATACONTAINER>
427 dealii::FullMatrix<double> &local_entry_matrix);
440 template<
typename DATACONTAINER>
443 dealii::FullMatrix<double> &local_entry_matrix);
453 template<
typename FACEDATACONTAINER>
456 dealii::Vector<double> &local_vector,
double scale,
468 template<
typename FACEDATACONTAINER>
471 dealii::Vector<double> &local_vector,
double scale,
481 template<
typename FACEDATACONTAINER>
483 FaceRhs(
const FACEDATACONTAINER& dc,
484 dealii::Vector<double> &local_vector,
double scale = 1.);
494 template<
typename FACEDATACONTAINER>
497 dealii::FullMatrix<double> &local_entry_matrix,
double scale = 1.,
498 double scale_ico = 1.);
507 template<
typename FACEDATACONTAINER>
510 dealii::FullMatrix<double> &local_entry_matrix,
double scale = 1.,
511 double scale_ico = 1.);
521 template<
typename FACEDATACONTAINER>
524 dealii::Vector<double> &local_vector,
double scale,
535 template<
typename FACEDATACONTAINER>
538 dealii::Vector<double> &local_vector,
double scale = 1.);
548 template<
typename FACEDATACONTAINER>
551 dealii::FullMatrix<double> &local_matrix,
double scale = 1.,
552 double scale_ico = 1.);
556 const std::map<std::string,
const dealii::Vector<double>*> &values,
557 const std::map<std::string, const VECTOR*> &block_values);
573 const FE<dealdim, dealdim>&
620 const std::vector<bool>& comp_mask,
627 const std::vector<bool>& comp_mask,
const DD* values);
631 const std::vector<unsigned int>&
633 const std::vector<unsigned int>&
635 const std::vector<bool>&
637 const std::vector<bool>&
642 const dealii::Function<dealdim> &
644 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
645 const std::map<std::string, const VECTOR*> &domain_values)
const;
651 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
652 const std::map<std::string, const VECTOR*> &domain_values)
const;
659 initial_values_ = values;
661 const dealii::Function<dealdim>&
664 return *initial_values_;
673 const std::vector<unsigned int>&
677 const std::vector<unsigned int>&
694 aux_functionals_.push_back(F);
695 if (functional_position_.find(F->GetName())
696 != functional_position_.end())
699 "You cant add two functionals with the same name.",
700 "OPTProblemContainer::AddFunctional");
702 functional_position_[F->GetName()] = aux_functionals_.size();
722 functional_for_ee_is_cost_ =
true;
723 functional_for_ee_num_ = dealii::numbers::invalid_unsigned_int;
727 functional_for_ee_is_cost_ =
false;
732 if (aux_functionals_[i]->
GetName() == functional_name)
736 functional_for_ee_num_ = i;
744 "Can't find functional " + functional_name
745 +
" in aux_functionals_",
746 "Optproblem::SetFunctionalForErrorEstimation");
756 return aux_functionals_.size();
781 const std::vector<unsigned int>&
786 const dealii::ConstraintMatrix&
815 assert(ExceptionHandler_);
816 return ExceptionHandler_;
824 assert(OutputHandler_);
825 return OutputHandler_;
841 unsigned int time_dof_number,
916 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
917 auxiliary_constraints_.find(name);
918 if (it == auxiliary_constraints_.end())
921 "OptProblemContainer::GetAuxiliaryConstraint");
934 template<
typename INTEGRATOR>
944 typename std::map<std::string, const ControlVector<VECTOR> *>::iterator it =
945 auxiliary_controls_.begin();
946 for (; it != auxiliary_controls_.end(); it++)
948 if (dopedim == dealdim)
950 integrator.AddDomainData(it->first,
951 &(it->second->GetSpacialVector()));
953 else if (dopedim == 0)
955 integrator.AddParamData(it->first,
956 &(it->second->GetSpacialVectorCopy()));
961 "OptProblemContainer::AddAuxiliaryToIntegrator");
967 typename std::map<std::string, const StateVector<VECTOR> *>::iterator it =
968 auxiliary_state_.begin();
969 for (; it != auxiliary_state_.end(); it++)
971 integrator.AddDomainData(it->first,
972 &(it->second->GetSpacialVector()));
976 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
977 auxiliary_constraints_.begin();
978 for (; it != auxiliary_constraints_.end(); it++)
980 integrator.AddDomainData(it->first +
"_local",
981 &(it->second->GetSpacialVector(
"local")));
982 integrator.AddParamData(it->first +
"_global",
983 &(it->second->GetGlobalConstraints()));
1001 template<
typename INTEGRATOR>
1006 typename std::map<std::string, const StateVector<VECTOR> *>::const_iterator it =
1007 auxiliary_state_.find(
"state");
1008 if (it != auxiliary_state_.end())
1010 integrator.AddDomainData(
"state_i+1",
1011 &(it->second->GetNextSpacialVector()));
1028 template<
typename INTEGRATOR>
1033 typename std::map<std::string, const StateVector<VECTOR> *>::const_iterator it =
1034 auxiliary_state_.find(
"state");
1035 if (it != auxiliary_state_.end())
1037 integrator.AddDomainData(
"state_i-1",
1038 &(it->second->GetPreviousSpacialVector()));
1056 template<
typename INTEGRATOR>
1061 typename std::map<std::string, const StateVector<VECTOR> *>::const_iterator it =
1062 auxiliary_state_.find(
"state");
1063 if (it != auxiliary_state_.end())
1065 integrator.DeleteDomainData(
"state_i+1");
1082 template<
typename INTEGRATOR>
1087 typename std::map<std::string, const StateVector<VECTOR> *>::const_iterator it =
1088 auxiliary_state_.find(
"state");
1089 if (it != auxiliary_state_.end())
1091 integrator.DeleteDomainData(
"state_i-1");
1106 template<
typename INTEGRATOR>
1116 typename std::map<std::string, const ControlVector<VECTOR> *>::iterator it =
1117 auxiliary_controls_.begin();
1118 for (; it != auxiliary_controls_.end(); it++)
1120 if (dopedim == dealdim)
1122 integrator.DeleteDomainData(it->first);
1124 else if (dopedim == 0)
1126 integrator.DeleteParamData(it->first);
1127 it->second->UnLockCopy();
1132 "OptProblemContainer::AddAuxiliaryToIntegrator");
1138 typename std::map<std::string, const StateVector<VECTOR> *>::iterator it =
1139 auxiliary_state_.begin();
1140 for (; it != auxiliary_state_.end(); it++)
1142 integrator.DeleteDomainData(it->first);
1146 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
1147 auxiliary_constraints_.begin();
1148 for (; it != auxiliary_constraints_.end(); it++)
1150 integrator.DeleteDomainData(it->first +
"_local");
1151 integrator.DeleteParamData(it->first +
"_global");
1157 const std::map<std::string, unsigned int>&
1160 return functional_position_;
1166 return this->
GetPDE().GetStateNBlocks();
1171 std::vector<unsigned int>&
1174 return this->
GetPDE().GetControlBlockComponent();
1178 std::vector<unsigned int>&
1181 return this->
GetPDE().GetStateBlockComponent();
1187 template<
typename DATACONTAINER>
1190 dealii::Vector<double> &local_vector,
double scale,
1194 || this->
GetType() ==
"adjoint_hessian")
1196 this->
GetPDE().Init_ElementEquation(edc, local_vector, scale,
1202 "OptProblemContainer::Init_ElementEquation");
1206 template<
typename DATACONTAINER>
1209 dealii::Vector<double> &local_vector,
double scale)
1212 if (this->
GetType() ==
"adjoint")
1217 != std::string::npos)
1220 != std::string::npos)
1227 else if (this->
GetType() ==
"tangent")
1229 this->
GetPDE().Init_ElementRhs_QT(edc, local_vector, scale);
1231 else if (this->
GetType() ==
"adjoint_hessian")
1236 != std::string::npos)
1239 != std::string::npos)
1249 "OptProblemContainer::Init_ElementRhs");
1255 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
1256 const std::map<std::string, const VECTOR*> &domain_values,
1257 VECTOR& rhs_vector,
double scale = 1.)
1259 if (this->
GetType() ==
"adjoint")
1264 != std::string::npos)
1267 != std::string::npos)
1275 else if (this->
GetType() ==
"tangent")
1279 else if (this->
GetType() ==
"adjoint_hessian")
1284 != std::string::npos)
1287 != std::string::npos)
1298 "OptProblemContainer::Init_PointRhs");
1302 template<
typename DATACONTAINER>
1305 dealii::FullMatrix<double> &local_entry_matrix,
double scale,
1309 || this->
GetType() ==
"adjoint_hessian")
1311 this->
GetPDE().Init_ElementMatrix(edc, local_entry_matrix, scale,
1317 "OptProblemContainer::Init_ElementMatrix");
1330 return functional_for_ee_is_cost_;
1333 template<
typename ELEMENTITERATOR>
1334 bool AtInterface(ELEMENTITERATOR& element,
unsigned int face)
const;
1344 return constraints_;
1349 return constraints_;
1356 typename std::map<std::string, const VECTOR*>::const_iterator it =
1358 if (it == values.end())
1361 "OptProblemContainer::GetBlockVector");
1365 const dealii::Vector<double>*
1366 GetVector(
const std::map<std::string,
const Vector<double>*>& values,
1369 typename std::map<std::string, const Vector<double>*>::const_iterator it =
1371 if (it == values.end())
1374 "OptProblemContainer::GetVector");
1383 std::string algo_type_;
1385 bool functional_for_ee_is_cost_;
1386 double c_interval_length_, interval_length_;
1387 unsigned int functional_for_ee_num_;
1388 std::vector<FUNCTIONAL_INTERFACE*> aux_functionals_;
1389 std::map<std::string, unsigned int> functional_position_;
1390 FUNCTIONAL* functional_;
1391 CONSTRAINTS* constraints_;
1394 std::vector<unsigned int> control_dirichlet_colors_;
1395 std::vector<unsigned int> control_transposed_dirichlet_colors_;
1396 std::vector<std::vector<bool> > control_dirichlet_comps_;
1397 std::vector<const DOpEWrapper::Function<dealdim>*> control_dirichlet_values_;
1403 std::vector<unsigned int> dirichlet_colors_;
1404 std::vector<std::vector<bool> > dirichlet_comps_;
1405 std::vector<PrimalDirichletData<DD, VECTOR, dealdim>*> primal_dirichlet_values_;
1406 std::vector<TangentDirichletData<DD, VECTOR, dealdim>*> tangent_dirichlet_values_;
1407 const dealii::Function<dealdim>* zero_dirichlet_values_;
1409 const dealii::Function<dealdim>* initial_values_;
1411 std::vector<unsigned int> control_boundary_equation_colors_;
1412 std::vector<unsigned int> state_boundary_equation_colors_;
1413 std::vector<unsigned int> adjoint_boundary_equation_colors_;
1415 std::vector<unsigned int> boundary_functional_colors_;
1417 std::map<std::string, const ControlVector<VECTOR>*> auxiliary_controls_;
1418 std::map<std::string, const StateVector<VECTOR>*> auxiliary_state_;
1419 std::map<std::string, const ConstraintVector<VECTOR>*> auxiliary_constraints_;
1425 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>,
1426 PDE, DD, SPARSITYPATTERN, VECTOR, dealdim> * state_problem_;
1430 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>,
1431 PDE, DD, SPARSITYPATTERN, VECTOR, dealdim> ;
1435 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1436 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1437 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1438 template<
int,
int>
class DH>
1441 FUNCTIONAL& functional, PDE& pde, CONSTRAINTS& constraints,
1444 &constraints), STH_(&STH), state_problem_(NULL)
1446 ExceptionHandler_ = NULL;
1447 OutputHandler_ = NULL;
1448 zero_dirichlet_values_ =
new ZeroFunction<dealdim>(
1449 this->
GetPDE().GetStateNComponents());
1451 functional_position_[functional_->GetName()] = 0;
1453 functional_for_ee_num_ = dealii::numbers::invalid_unsigned_int;
1454 c_interval_length_ = 1.;
1455 interval_length_ = 1.;
1460 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1461 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1462 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1463 template<
int,
int>
class DH>
1465 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::~OptProblemContainer()
1467 if (zero_dirichlet_values_ != NULL)
1469 delete zero_dirichlet_values_;
1472 for (
unsigned int i = 0;
1473 i < transposed_control_gradient_dirichlet_values_.size(); i++)
1475 if (transposed_control_gradient_dirichlet_values_[i] != NULL)
1476 delete transposed_control_gradient_dirichlet_values_[i];
1478 for (
unsigned int i = 0;
1479 i < transposed_control_hessian_dirichlet_values_.size(); i++)
1481 if (transposed_control_hessian_dirichlet_values_[i] != NULL)
1482 delete transposed_control_hessian_dirichlet_values_[i];
1484 for (
unsigned int i = 0; i < primal_dirichlet_values_.size(); i++)
1486 if (primal_dirichlet_values_[i] != NULL)
1487 delete primal_dirichlet_values_[i];
1489 for (
unsigned int i = 0; i < tangent_dirichlet_values_.size(); i++)
1491 if (tangent_dirichlet_values_[i] != NULL)
1492 delete tangent_dirichlet_values_[i];
1494 if (state_problem_ != NULL)
1496 delete state_problem_;
1502 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1503 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1504 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1505 template<
int,
int>
class DH>
1508 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ReInit(
1509 std::string algo_type)
1511 if (state_problem_ != NULL)
1513 delete state_problem_;
1514 state_problem_ = NULL;
1517 if (algo_type_ != algo_type && algo_type_ !=
"")
1520 "OptProblemContainer::ReInit");
1524 algo_type_ = algo_type;
1525 this->SetTypeInternal(
"");
1527 if (algo_type_ ==
"reduced")
1529 GetSpaceTimeHandler()->ReInit(this->GetPDE().GetControlNBlocks(),
1530 this->GetPDE().GetControlBlockComponent(),
1531 this->GetPDE().GetStateNBlocks(),
1532 this->GetPDE().GetStateBlockComponent());
1537 "OptProblemContainer::ReInit");
1544 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1545 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1546 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1547 template<
int,
int>
class DH>
1550 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetType(
1551 std::string type,
unsigned int num)
1553 if (this->GetType() != type || this->GetTypeNum() != num)
1555 this->SetTypeNumInternal(num);
1556 this->SetTypeInternal(type);
1557 this->GetPDE().SetProblemType(type);
1558 if (functional_for_ee_num_ != dealii::numbers::invalid_unsigned_int)
1559 aux_functionals_[functional_for_ee_num_]->SetProblemType(type);
1560 this->GetConstraints()->SetProblemType(type, num);
1562 #if dope_dimension > 0
1563 if(dealdim == dopedim)
1568 if(this->GetType() ==
"state" ||this->GetType() ==
"adjoint"
1569 || this->GetType() ==
"adjoint_for_ee" || this->GetType() ==
"cost_functional"
1570 || this->GetType() ==
"aux_functional" || this->GetType() ==
"functional_for_ee"
1571 || this->GetType() ==
"tangent" || this->GetType() ==
"adjoint_hessian"
1572 || this->GetType() ==
"error_evaluation"
1573 || this->GetType().find(
"constraints") != std::string::npos)
1575 GetSpaceTimeHandler()->SetDoFHandlerOrdering(1,0);
1577 else if (this->GetType() ==
"gradient"||this->GetType() ==
"hessian"||this->GetType() ==
"hessian_inverse" || this->GetType() ==
"global_constraint_gradient"|| this->GetType() ==
"global_constraint_hessian")
1579 GetSpaceTimeHandler()->SetDoFHandlerOrdering(0,1);
1583 throw DOpEException(
"problem_type_ : "+this->GetType()+
" not implemented!",
"OptProblemContainer::SetType");
1589 throw DOpEException(
"dopedim not implemented",
"OptProblemContainer::SetType");
1597 if (this->GetType() ==
"state" || this->GetType() ==
"adjoint"
1598 || this->GetType() ==
"adjoint_for_ee"
1599 || this->GetType() ==
"functional_for_ee"
1600 || this->GetType() ==
"cost_functional"
1601 || this->GetType() ==
"aux_functional"
1602 || this->GetType() ==
"tangent"
1603 || this->GetType() ==
"error_evaluation"
1604 || this->GetType() ==
"adjoint_hessian")
1606 GetSpaceTimeHandler()->SetDoFHandlerOrdering(0, 0);
1608 else if (this->GetType() ==
"gradient"
1609 || this->GetType() ==
"hessian_inverse"
1610 || this->GetType() ==
"hessian")
1612 GetSpaceTimeHandler()->SetDoFHandlerOrdering(0, 0);
1617 "problem_type_ : " + this->GetType() +
" not implemented!",
1618 "OptProblemContainer::SetType");
1628 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1629 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1630 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1631 template<
int,
int>
class DH>
1632 template<
typename DATACONTAINER>
1635 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementFunctional(
1636 const DATACONTAINER& edc)
1639 if (this->GetType() ==
"cost_functional")
1642 return GetFunctional()->ElementValue(edc);
1644 else if (this->GetType() ==
"aux_functional")
1647 return aux_functionals_[this->GetTypeNum()]->ElementValue(edc);
1649 else if (this->GetType() ==
"functional_for_ee")
1651 return aux_functionals_[functional_for_ee_num_]->ElementValue(edc);
1653 else if (this->GetType().find(
"constraints") != std::string::npos)
1655 return GetConstraints()->ElementValue(edc);
1660 "OptProblemContainer::ElementFunctional");
1665 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1666 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1667 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1668 template<
int,
int>
class DH>
1671 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::PointFunctional(
1672 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
1673 const std::map<std::string, const VECTOR*> &domain_values)
1675 if (this->GetType() ==
"cost_functional")
1678 return GetFunctional()->PointValue(
1679 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
1680 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
1684 else if (this->GetType() ==
"aux_functional")
1687 return aux_functionals_[this->GetTypeNum()]->PointValue(
1688 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
1689 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
1693 else if (this->GetType() ==
"functional_for_ee")
1696 return aux_functionals_[functional_for_ee_num_]->PointValue(
1697 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
1698 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
1701 else if (this->GetType().find(
"constraints") != std::string::npos)
1703 return GetConstraints()->PointValue(
1704 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
1705 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
1712 "OptProblemContainer::PointFunctional");
1718 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1719 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1720 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1721 template<
int,
int>
class DH>
1722 template<
typename FACEDATACONTAINER>
1725 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::BoundaryFunctional(
1726 const FACEDATACONTAINER& fdc)
1728 if (this->GetType() ==
"cost_functional")
1731 return GetFunctional()->BoundaryValue(fdc);
1733 else if (this->GetType() ==
"aux_functional")
1736 return aux_functionals_[this->GetTypeNum()]->BoundaryValue(fdc);
1738 else if (this->GetType() ==
"functional_for_ee")
1741 return aux_functionals_[functional_for_ee_num_]->BoundaryValue(fdc);
1743 else if (this->GetType().find(
"constraints") != std::string::npos)
1745 return GetConstraints()->BoundaryValue(fdc);
1750 "OptProblemContainer::BoundaryFunctional");
1756 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1757 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1758 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1759 template<
int,
int>
class DH>
1760 template<
typename FACEDATACONTAINER>
1763 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::FaceFunctional(
1764 const FACEDATACONTAINER& fdc)
1766 if (this->GetType() ==
"cost_functional")
1769 return GetFunctional()->FaceValue(fdc);
1771 else if (this->GetType() ==
"aux_functional")
1774 return aux_functionals_[this->GetTypeNum()]->FaceValue(fdc);
1776 else if (this->GetType() ==
"functional_for_ee")
1779 return aux_functionals_[functional_for_ee_num_]->FaceValue(fdc);
1784 "OptProblemContainer::FaceFunctional");
1790 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1791 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1792 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1793 template<
int,
int>
class DH>
1796 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AlgebraicFunctional(
1797 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
1798 const std::map<std::string, const VECTOR*> &domain_values)
1800 if (this->GetType() ==
"cost_functional")
1803 return GetFunctional()->AlgebraicValue(param_values, domain_values);
1805 else if (this->GetType() ==
"aux_functional")
1808 return aux_functionals_[this->GetTypeNum()]->AlgebraicValue(
1809 param_values, domain_values);
1811 else if (this->GetType() ==
"functional_for_ee")
1814 return aux_functionals_[functional_for_ee_num_]->AlgebraicValue(
1815 param_values, domain_values);
1820 "OptProblemContainer::AlgebraicFunctional");
1826 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1827 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1828 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1829 template<
int,
int>
class DH>
1830 template<
typename DATACONTAINER>
1833 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementEquation(
1834 const DATACONTAINER& edc, dealii::Vector<double> &local_vector,
1835 double scale,
double scale_ico)
1838 if (this->GetType() ==
"state")
1841 this->GetPDE().
ElementEquation(edc, local_vector, scale*interval_length_, scale_ico*interval_length_);
1843 else if ((this->GetType() ==
"adjoint")
1844 || (this->GetType() ==
"adjoint_for_ee"))
1847 this->GetPDE().ElementEquation_U(edc, local_vector, scale*interval_length_,
1848 scale_ico*interval_length_);
1850 else if (this->GetType() ==
"adjoint_hessian")
1853 this->GetPDE().ElementEquation_UTT(edc, local_vector, scale*interval_length_,
1854 scale_ico*interval_length_);
1856 else if (this->GetType() ==
"tangent")
1859 this->GetPDE().ElementEquation_UT(edc, local_vector, scale*interval_length_,
1860 scale_ico*interval_length_);
1862 else if ((this->GetType() ==
"gradient")
1863 || (this->GetType() ==
"hessian"))
1866 this->GetPDE().ControlElementEquation(edc, local_vector, scale*c_interval_length_);
1871 "OptProblemContainer::ElementEquation");
1877 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1878 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1879 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1880 template<
int,
int>
class DH>
1883 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AlgebraicResidual(
1885 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
1886 const std::map<std::string, const VECTOR*> &domain_values)
1888 if (this->GetType() ==
"gradient")
1891 return GetFunctional()->AlgebraicGradient_Q(residual, param_values,
1897 "OptProblemContainer::AlgebraicFunctional");
1903 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1904 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1905 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1906 template<
int,
int>
class DH>
1907 template<
typename DATACONTAINER>
1910 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementTimeEquation(
1911 const DATACONTAINER& edc, dealii::Vector<double> &local_vector,
1915 if (this->GetType() ==
"state")
1919 else if (this->GetType() ==
"adjoint"
1920 || this->GetType() ==
"adjoint_for_ee")
1922 this->GetPDE().ElementTimeEquation_U(edc, local_vector, scale);
1924 else if (this->GetType() ==
"adjoint_hessian")
1926 this->GetPDE().ElementTimeEquation_UTT(edc, local_vector, scale);
1928 else if (this->GetType() ==
"tangent")
1930 this->GetPDE().ElementTimeEquation_UT(edc, local_vector, scale);
1932 else if ((this->GetType() ==
"gradient")
1933 || (this->GetType() ==
"hessian"))
1936 "OptProblemContainer::ElementTimeEquation");
1941 "OptProblemContainer::ElementTimeEquation");
1947 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1948 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1949 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1950 template<
int,
int>
class DH>
1951 template<
typename DATACONTAINER>
1954 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementTimeEquationExplicit(
1955 const DATACONTAINER& edc, dealii::Vector<double> &local_vector,
1959 if (this->GetType() ==
"state")
1964 else if (this->GetType() ==
"adjoint"
1965 || this->GetType() ==
"adjoint_for_ee")
1967 this->GetPDE().ElementTimeEquationExplicit_U(edc, local_vector,
1970 else if (this->GetType() ==
"adjoint_hessian")
1972 this->GetPDE().ElementTimeEquationExplicit_UTT(edc, local_vector,
1975 else if (this->GetType() ==
"tangent")
1977 this->GetPDE().ElementTimeEquationExplicit_UT(edc, local_vector,
1980 else if ((this->GetType() ==
"gradient")
1981 || (this->GetType() ==
"hessian"))
1984 "OptProblemContainer::ElementTimeEquationExplicit");
1989 "OptProblemContainer::ElementTimeEquationExplicit");
1995 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1996 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1997 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1998 template<
int,
int>
class DH>
1999 template<
typename FACEDATACONTAINER>
2002 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::FaceEquation(
2003 const FACEDATACONTAINER& fdc,
2004 dealii::Vector<double> &local_vector,
double scale,
2007 if (this->GetType() ==
"state")
2010 this->GetPDE().
FaceEquation(fdc, local_vector, scale*interval_length_, scale_ico*interval_length_);
2012 else if (this->GetType() ==
"adjoint"
2013 || this->GetType() ==
"adjoint_for_ee")
2016 this->GetPDE().FaceEquation_U(fdc, local_vector, scale*interval_length_,
2017 scale_ico*interval_length_);
2019 else if (this->GetType() ==
"adjoint_hessian")
2022 this->GetPDE().FaceEquation_UTT(fdc, local_vector, scale*interval_length_,
2023 scale_ico*interval_length_);
2025 else if (this->GetType() ==
"tangent")
2028 this->GetPDE().FaceEquation_UT(fdc, local_vector, scale*interval_length_,
2029 scale_ico*interval_length_);
2039 "OptProblemContainer::FaceEquation");
2045 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2046 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2047 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2048 template<
int,
int>
class DH>
2049 template<
typename FACEDATACONTAINER>
2052 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::InterfaceEquation(
2053 const FACEDATACONTAINER& fdc,
2054 dealii::Vector<double> &local_vector,
double scale,
2057 if (this->GetType() ==
"state")
2060 scale_ico*interval_length_);
2062 else if (this->GetType() ==
"adjoint"
2063 || this->GetType() ==
"adjoint_for_ee")
2066 this->GetPDE().InterfaceEquation_U(fdc, local_vector, scale*interval_length_,
2067 scale_ico*interval_length_);
2072 "OptProblemContainer::InterfaceEquation");
2077 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2078 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2079 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2080 template<
int,
int>
class DH>
2081 template<
typename FACEDATACONTAINER>
2084 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::BoundaryEquation(
2085 const FACEDATACONTAINER& fdc,
2086 dealii::Vector<double> &local_vector,
double scale,
2089 if (this->GetType() ==
"state")
2093 scale_ico*interval_length_);
2095 else if (this->GetType() ==
"adjoint"
2096 || this->GetType() ==
"adjoint_for_ee")
2099 this->GetPDE().BoundaryEquation_U(fdc, local_vector, scale*interval_length_,
2100 scale_ico*interval_length_);
2102 else if (this->GetType() ==
"adjoint_hessian")
2105 this->GetPDE().BoundaryEquation_UTT(fdc, local_vector, scale*interval_length_,
2106 scale_ico*interval_length_);
2108 else if (this->GetType() ==
"tangent")
2111 this->GetPDE().BoundaryEquation_UT(fdc, local_vector, scale*interval_length_,
2112 scale_ico*interval_length_);
2114 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian"))
2117 this->GetPDE().ControlBoundaryEquation(fdc, local_vector, scale*c_interval_length_);
2122 "OptProblemContainer::ElementBoundaryEquation");
2128 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2129 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2130 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2131 template<
int,
int>
class DH>
2132 template<
typename DATACONTAINER>
2135 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementRhs(
2136 const DATACONTAINER& edc, dealii::Vector<double> &local_vector,
2139 if (this->GetType() ==
"state")
2142 this->GetPDE().ElementRightHandSide(edc, local_vector, scale*interval_length_);
2144 else if (this->GetType() ==
"adjoint")
2147 if(GetFunctional()->NeedTime())
2149 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2151 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2153 GetFunctional()->ElementValue_U(edc, local_vector, scale*interval_length_);
2157 GetFunctional()->ElementValue_U(edc, local_vector, scale);
2160 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2162 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2163 "OptProblemContainer::ElementRhs");
2168 else if (this->GetType() ==
"adjoint_for_ee")
2171 if (aux_functionals_[functional_for_ee_num_]->NeedTime())
2173 if (aux_functionals_[functional_for_ee_num_]->GetType().find(
"domain") != std::string::npos)
2175 if(aux_functionals_[functional_for_ee_num_]->GetType().find(
"timedistributed") != std::string::npos)
2177 aux_functionals_[functional_for_ee_num_]->ElementValue_U(edc,
2178 local_vector, scale*interval_length_);
2182 aux_functionals_[functional_for_ee_num_]->ElementValue_U(edc, local_vector, scale);
2184 if(aux_functionals_[functional_for_ee_num_]->GetType().find(
"timedistributed") != std::string::npos && aux_functionals_[functional_for_ee_num_]->GetType().find(
"timelocal") != std::string::npos)
2186 throw DOpEException(
"Conflicting functional types: "+ aux_functionals_[functional_for_ee_num_]->GetType(),
2187 "OptProblemContainer::ElementRhs");
2192 else if (this->GetType() ==
"tangent")
2196 this->GetPDE().ElementEquation_QT(edc, local_vector, scale*interval_length_, scale*interval_length_);
2198 else if (this->GetType() ==
"adjoint_hessian")
2201 if(GetFunctional()->NeedTime())
2203 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2205 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2207 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2209 GetFunctional()->ElementValue_UU(edc, local_vector, scale*interval_length_);
2210 GetFunctional()->ElementValue_QU(edc, local_vector, scale*interval_length_);
2214 GetFunctional()->ElementValue_UU(edc, local_vector, scale);
2215 GetFunctional()->ElementValue_QU(edc, local_vector, scale);
2217 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2219 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2220 "OptProblemContainer::ElementRhs");
2226 this->GetPDE().ElementEquation_UU(edc, local_vector, scale*interval_length_, scale*interval_length_);
2227 this->GetPDE().ElementEquation_QU(edc, local_vector, scale*interval_length_, scale*interval_length_);
2229 this->GetPDE().ElementTimeEquationExplicit_UU(edc, local_vector,
2232 else if (this->GetType() ==
"gradient")
2234 if (GetSpaceTimeHandler()->GetControlType()
2237 this->GetPDE().Init_ElementRhs_Q(edc, local_vector, scale);
2240 if(GetFunctional()->NeedTime())
2242 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2244 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2246 GetFunctional()->ElementValue_Q(edc, local_vector, scale*interval_length_);
2250 GetFunctional()->ElementValue_Q(edc, local_vector, scale);
2252 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2254 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2255 "OptProblemContainer::ElementRhs");
2260 this->GetPDE().ElementEquation_Q(edc, local_vector, scale*interval_length_, scale*interval_length_);
2262 else if (this->GetType() ==
"hessian")
2264 if (GetSpaceTimeHandler()->GetControlType()
2267 this->GetPDE().Init_ElementRhs_QTT(edc, local_vector, scale);
2268 this->GetPDE().Init_ElementRhs_QQ(edc, local_vector, scale);
2270 if(GetFunctional()->NeedTime())
2272 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2274 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2276 GetFunctional()->ElementValue_QQ(edc, local_vector, scale*interval_length_);
2277 GetFunctional()->ElementValue_UQ(edc, local_vector, scale*interval_length_);
2281 GetFunctional()->ElementValue_QQ(edc, local_vector, scale);
2282 GetFunctional()->ElementValue_UQ(edc, local_vector, scale);
2284 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2286 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2287 "OptProblemContainer::ElementRhs");
2293 this->GetPDE().ElementEquation_QTT(edc, local_vector, scale*interval_length_, scale*interval_length_);
2294 this->GetPDE().ElementEquation_UQ(edc, local_vector, scale*interval_length_, scale*interval_length_);
2295 this->GetPDE().ElementEquation_QQ(edc, local_vector, scale*interval_length_, scale*interval_length_);
2297 else if (this->GetType() ==
"global_constraint_gradient")
2299 assert(interval_length_==1.);
2300 GetConstraints()->ElementValue_Q(edc, local_vector, scale);
2302 else if (this->GetType() ==
"global_constraint_hessian")
2304 assert(interval_length_==1.);
2305 GetConstraints()->ElementValue_QQ(edc, local_vector, scale);
2310 "OptProblemContainer::ElementRhs");
2317 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2318 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2319 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2320 template<
int,
int>
class DH>
2323 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::PointRhs(
2324 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
2325 const std::map<std::string, const VECTOR*> &domain_values,
2326 VECTOR& rhs_vector,
double scale)
2329 if (this->GetType() ==
"adjoint")
2332 if(GetFunctional()->NeedTime())
2334 if (GetFunctional()->GetType().find(
"point") != std::string::npos)
2336 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2338 GetFunctional()->PointValue_U(
2339 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2340 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2341 domain_values, rhs_vector, scale*interval_length_);
2345 GetFunctional()->PointValue_U(
2346 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2347 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2348 domain_values, rhs_vector, scale);
2350 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2352 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2353 "OptProblemContainer::PointRhs");
2358 else if (this->GetType() ==
"adjoint_for_ee")
2361 if (aux_functionals_[functional_for_ee_num_]->NeedTime())
2363 if (aux_functionals_[functional_for_ee_num_]->GetType().find(
"point") != std::string::npos)
2365 if(aux_functionals_[functional_for_ee_num_]->GetType().find(
"timedistributed") != std::string::npos)
2367 aux_functionals_[functional_for_ee_num_]->PointValue_U(
2368 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2369 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2370 domain_values, rhs_vector, scale*interval_length_);
2374 aux_functionals_[functional_for_ee_num_]->PointValue_U(
2375 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2376 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2377 domain_values, rhs_vector, scale);
2379 if(aux_functionals_[functional_for_ee_num_]->GetType().find(
"timedistributed") != std::string::npos && aux_functionals_[functional_for_ee_num_]->GetType().find(
"timelocal") != std::string::npos)
2381 throw DOpEException(
"Conflicting functional types: "+ aux_functionals_[functional_for_ee_num_]->GetType(),
2382 "OptProblemContainer::PointRhs");
2387 else if (this->GetType() ==
"adjoint_hessian")
2390 if(GetFunctional()->NeedTime())
2392 if (GetFunctional()->GetType().find(
"point") != std::string::npos)
2394 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2396 GetFunctional()->PointValue_UU(
2397 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2398 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2399 domain_values, rhs_vector, scale*interval_length_);
2400 GetFunctional()->PointValue_QU(
2401 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2402 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2403 domain_values, rhs_vector, scale*interval_length_);
2407 GetFunctional()->PointValue_UU(
2408 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2409 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2410 domain_values, rhs_vector, scale);
2411 GetFunctional()->PointValue_QU(
2412 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2413 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2414 domain_values, rhs_vector, scale);
2416 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2418 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2419 "OptProblemContainer::PointRhs");
2424 else if (this->GetType() ==
"gradient")
2427 if(GetFunctional()->NeedTime())
2429 if (GetFunctional()->GetType().find(
"point") != std::string::npos)
2431 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2433 GetFunctional()->PointValue_Q(
2434 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2435 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2436 domain_values, rhs_vector, scale*interval_length_);
2440 GetFunctional()->PointValue_Q(
2441 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2442 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2443 domain_values, rhs_vector, scale);
2445 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2447 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2448 "OptProblemContainer::PointRhs");
2453 else if (this->GetType() ==
"hessian")
2456 if(GetFunctional()->NeedTime())
2458 if (GetFunctional()->GetType().find(
"point") != std::string::npos)
2460 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2462 GetFunctional()->PointValue_QQ(
2463 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2464 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2465 domain_values, rhs_vector, scale*interval_length_);
2466 GetFunctional()->PointValue_UQ(
2467 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2468 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2469 domain_values, rhs_vector, scale*interval_length_);
2473 GetFunctional()->PointValue_QQ(
2474 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2475 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2476 domain_values, rhs_vector, scale);
2477 GetFunctional()->PointValue_UQ(
2478 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2479 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2480 domain_values, rhs_vector, scale);
2482 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2484 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2485 "OptProblemContainer::PointRhs");
2492 throw DOpEException(
"Not implemented",
"OptProblem::PointRhs");
2499 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2500 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2501 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2502 template<
int,
int>
class DH>
2503 template<
typename FACEDATACONTAINER>
2506 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::FaceRhs(
2507 const FACEDATACONTAINER& fdc,
2508 dealii::Vector<double> &local_vector,
double scale)
2511 if (this->GetType() ==
"state")
2514 this->GetPDE().FaceRightHandSide(fdc, local_vector, scale*interval_length_);
2516 else if (this->GetType() ==
"adjoint")
2519 if(GetFunctional()->NeedTime())
2521 if (GetFunctional()->GetType().find(
"face") != std::string::npos)
2523 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2525 GetFunctional()->FaceValue_U(fdc, local_vector, scale*interval_length_);
2529 GetFunctional()->FaceValue_U(fdc, local_vector, scale);
2532 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2534 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2535 "OptProblemContainer::FaceRhs");
2540 else if (this->GetType() ==
"adjoint_for_ee")
2543 if (aux_functionals_[functional_for_ee_num_]->NeedTime())
2545 if (aux_functionals_[functional_for_ee_num_]->GetType().find(
"face")
2546 != std::string::npos)
2548 if(aux_functionals_[functional_for_ee_num_]->GetType().find(
"timedistributed") != std::string::npos)
2550 aux_functionals_[functional_for_ee_num_]->FaceValue_U(fdc,
2551 local_vector, scale*interval_length_);
2555 aux_functionals_[functional_for_ee_num_]->FaceValue_U(fdc,
2556 local_vector, scale);
2558 if(aux_functionals_[functional_for_ee_num_]->GetType().find(
"timedistributed") != std::string::npos && aux_functionals_[functional_for_ee_num_]->GetType().find(
"timelocal") != std::string::npos)
2560 throw DOpEException(
"Conflicting functional types: "+ aux_functionals_[functional_for_ee_num_]->GetType(),
2561 "OptProblemContainer::FaceRhs");
2567 else if (this->GetType() ==
"tangent")
2571 this->GetPDE().FaceEquation_QT(fdc, local_vector, scale*interval_length_, scale*interval_length_);
2573 else if (this->GetType() ==
"adjoint_hessian")
2576 if(GetFunctional()->NeedTime())
2578 if (GetFunctional()->GetType().find(
"face") != std::string::npos)
2580 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2582 GetFunctional()->FaceValue_UU(fdc, local_vector, scale*interval_length_);
2583 GetFunctional()->FaceValue_QU(fdc, local_vector, scale*interval_length_);
2587 GetFunctional()->FaceValue_UU(fdc, local_vector, scale);
2588 GetFunctional()->FaceValue_QU(fdc, local_vector, scale);
2590 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2592 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2593 "OptProblemContainer::FaceRhs");
2599 this->GetPDE().FaceEquation_UU(fdc, local_vector, scale*interval_length_, scale*interval_length_);
2600 this->GetPDE().FaceEquation_QU(fdc, local_vector, scale*interval_length_, scale*interval_length_);
2602 else if (this->GetType() ==
"gradient")
2605 if(GetFunctional()->NeedTime())
2607 if (GetFunctional()->GetType().find(
"face") != std::string::npos)
2609 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2611 GetFunctional()->FaceValue_Q(fdc, local_vector, scale*interval_length_);
2615 GetFunctional()->FaceValue_Q(fdc, local_vector, scale);
2617 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2619 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2620 "OptProblemContainer::FaceRhs");
2626 this->GetPDE().FaceEquation_Q(fdc, local_vector, scale*interval_length_, scale*interval_length_);
2628 else if (this->GetType() ==
"hessian")
2631 if(GetFunctional()->NeedTime())
2633 if (GetFunctional()->GetType().find(
"face") != std::string::npos)
2635 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2637 GetFunctional()->FaceValue_QQ(fdc, local_vector, scale*interval_length_);
2638 GetFunctional()->FaceValue_UQ(fdc, local_vector, scale*interval_length_);
2642 GetFunctional()->FaceValue_QQ(fdc, local_vector, scale);
2643 GetFunctional()->FaceValue_UQ(fdc, local_vector, scale);
2645 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2647 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2648 "OptProblemContainer::FaceRhs");
2654 this->GetPDE().FaceEquation_QTT(fdc, local_vector, scale*interval_length_, scale*interval_length_);
2655 this->GetPDE().FaceEquation_UQ(fdc, local_vector, scale*interval_length_, scale*interval_length_);
2656 this->GetPDE().FaceEquation_QQ(fdc, local_vector, scale*interval_length_, scale*interval_length_);
2661 "OptProblemContainer::FaceRhs");
2668 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2669 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2670 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2671 template<
int,
int>
class DH>
2672 template<
typename FACEDATACONTAINER>
2675 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::BoundaryRhs(
2676 const FACEDATACONTAINER& fdc,
2677 dealii::Vector<double> &local_vector,
double scale)
2680 if (this->GetType() ==
"state")
2683 this->GetPDE().BoundaryRightHandSide(fdc, local_vector, scale*interval_length_);
2685 else if (this->GetType() ==
"adjoint")
2688 if(GetFunctional()->NeedTime())
2690 if (GetFunctional()->GetType().find(
"boundary") != std::string::npos)
2692 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2694 GetFunctional()->BoundaryValue_U(fdc, local_vector, scale*interval_length_);
2698 GetFunctional()->BoundaryValue_U(fdc, local_vector, scale);
2700 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2702 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2703 "OptProblemContainer::BoundaryRhs");
2708 else if (this->GetType() ==
"adjoint_for_ee")
2711 if (aux_functionals_[functional_for_ee_num_]->NeedTime())
2713 if (aux_functionals_[functional_for_ee_num_]->GetType().find(
2714 "boundary") != std::string::npos)
2716 if(aux_functionals_[functional_for_ee_num_]->GetType().find(
"timedistributed") != std::string::npos)
2718 aux_functionals_[functional_for_ee_num_]->BoundaryValue_U(fdc,
2719 local_vector, scale*interval_length_);
2723 aux_functionals_[functional_for_ee_num_]->BoundaryValue_U(fdc,
2724 local_vector, scale);
2726 if(aux_functionals_[functional_for_ee_num_]->GetType().find(
"timedistributed") != std::string::npos && aux_functionals_[functional_for_ee_num_]->GetType().find(
"timelocal") != std::string::npos)
2728 throw DOpEException(
"Conflicting functional types: "+ aux_functionals_[functional_for_ee_num_]->GetType(),
2729 "OptProblemContainer::BoundaryRhs");
2734 else if (this->GetType() ==
"tangent")
2738 this->GetPDE().BoundaryEquation_QT(fdc, local_vector, scale*interval_length_,
2739 scale*interval_length_);
2741 else if (this->GetType() ==
"adjoint_hessian")
2744 if(GetFunctional()->NeedTime())
2746 if (GetFunctional()->GetType().find(
"boundary") != std::string::npos)
2748 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2750 GetFunctional()->BoundaryValue_UU(fdc, local_vector, scale*interval_length_);
2751 GetFunctional()->BoundaryValue_QU(fdc, local_vector, scale*interval_length_);
2755 GetFunctional()->BoundaryValue_UU(fdc, local_vector, scale);
2756 GetFunctional()->BoundaryValue_QU(fdc, local_vector, scale);
2758 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2760 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2761 "OptProblemContainer::BoundaryRhs");
2767 this->GetPDE().BoundaryEquation_UU(fdc, local_vector, scale*interval_length_,
2768 scale*interval_length_);
2769 this->GetPDE().BoundaryEquation_QU(fdc, local_vector, scale*interval_length_,
2770 scale*interval_length_);
2772 else if (this->GetType() ==
"gradient")
2775 if(GetFunctional()->NeedTime())
2777 if (GetFunctional()->GetType().find(
"boundary") != std::string::npos)
2779 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2781 GetFunctional()->BoundaryValue_Q(fdc, local_vector, scale*interval_length_);
2785 GetFunctional()->BoundaryValue_Q(fdc, local_vector, scale);
2787 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2789 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2790 "OptProblemContainer::BoundaryRhs");
2796 this->GetPDE().BoundaryEquation_Q(fdc, local_vector, scale*interval_length_,
2797 scale*interval_length_);
2799 else if (this->GetType() ==
"hessian")
2802 if(GetFunctional()->NeedTime())
2804 if (GetFunctional()->GetType().find(
"boundary") != std::string::npos)
2806 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos)
2808 GetFunctional()->BoundaryValue_QQ(fdc, local_vector, scale*interval_length_);
2809 GetFunctional()->BoundaryValue_UQ(fdc, local_vector, scale*interval_length_);
2813 GetFunctional()->BoundaryValue_QQ(fdc, local_vector, scale);
2814 GetFunctional()->BoundaryValue_UQ(fdc, local_vector, scale);
2816 if(GetFunctional()->GetType().find(
"timedistributed") != std::string::npos && GetFunctional()->GetType().find(
"timelocal") != std::string::npos)
2818 throw DOpEException(
"Conflicting functional types: "+ GetFunctional()->GetType(),
2819 "OptProblemContainer::BoundaryRhs");
2825 this->GetPDE().BoundaryEquation_QTT(fdc, local_vector, scale*interval_length_,
2826 scale*interval_length_);
2827 this->GetPDE().BoundaryEquation_UQ(fdc, local_vector, scale*interval_length_,
2828 scale*interval_length_);
2829 this->GetPDE().BoundaryEquation_QQ(fdc, local_vector, scale*interval_length_,
2830 scale*interval_length_);
2835 "OptProblemContainer::BoundaryRhs");
2842 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2843 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2844 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2845 template<
int,
int>
class DH>
2846 template<
typename DATACONTAINER>
2849 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementMatrix(
2850 const DATACONTAINER& edc,
2851 dealii::FullMatrix<double> &local_entry_matrix,
double scale,
2855 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2858 this->GetPDE().
ElementMatrix(edc, local_entry_matrix, scale*interval_length_, scale_ico*interval_length_);
2860 else if (this->GetType() ==
"adjoint"
2861 || this->GetType() ==
"adjoint_for_ee"
2862 || this->GetType() ==
"adjoint_hessian")
2865 this->GetPDE().ElementMatrix_T(edc, local_entry_matrix, scale*interval_length_,
2866 scale_ico*interval_length_);
2868 else if ((this->GetType() ==
"gradient")
2869 || (this->GetType() ==
"hessian"))
2872 this->GetPDE().ControlElementMatrix(edc, local_entry_matrix, scale*c_interval_length_);
2877 "OptProblemContainer::ElementMatrix");
2884 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2885 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2886 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2887 template<
int,
int>
class DH>
2888 template<
typename DATACONTAINER>
2891 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementTimeMatrix(
2892 const DATACONTAINER& edc, FullMatrix<double> &local_entry_matrix)
2895 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2900 else if (this->GetType() ==
"adjoint"
2901 || this->GetType() ==
"adjoint_for_ee"
2902 || this->GetType() ==
"adjoint_hessian")
2904 this->GetPDE().ElementTimeMatrix_T(edc, local_entry_matrix);
2906 else if ((this->GetType() ==
"gradient")
2907 || (this->GetType() ==
"hessian"))
2910 "OptProblemContainer::ElementTimeMatrix");
2915 "OptProblemContainer::ElementTimeMatrix");
2922 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2923 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2924 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2925 template<
int,
int>
class DH>
2926 template<
typename DATACONTAINER>
2929 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementTimeMatrixExplicit(
2930 const DATACONTAINER& edc,
2931 dealii::FullMatrix<double> &local_entry_matrix)
2934 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2938 else if (this->GetType() ==
"adjoint"
2939 || this->GetType() ==
"adjoint_hessian")
2941 this->GetPDE().ElementTimeMatrixExplicit_T(edc, local_entry_matrix);
2943 else if ((this->GetType() ==
"gradient")
2944 || (this->GetType() ==
"hessian"))
2947 "OptProblemContainer::ElementTimeMatrixExplicit");
2952 "OptProblemContainer::ElementTimeMatrixExplicit");
2959 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2960 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2961 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2962 template<
int,
int>
class DH>
2963 template<
typename FACEDATACONTAINER>
2966 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::FaceMatrix(
2967 const FACEDATACONTAINER& fdc, FullMatrix<double> &local_entry_matrix,
2968 double scale,
double scale_ico)
2970 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2973 this->GetPDE().
FaceMatrix(fdc, local_entry_matrix, scale*interval_length_, scale_ico*interval_length_);
2975 else if (this->GetType() ==
"adjoint"
2976 || this->GetType() ==
"adjoint_for_ee"
2977 || this->GetType() ==
"adjoint_hessian")
2980 this->GetPDE().FaceMatrix_T(fdc, local_entry_matrix, scale*interval_length_,
2981 scale_ico*interval_length_);
2991 "OptProblemContainer::NewtonFaceMatrix");
2998 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2999 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3000 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3001 template<
int,
int>
class DH>
3002 template<
typename FACEDATACONTAINER>
3005 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::InterfaceMatrix(
3006 const FACEDATACONTAINER& fdc, FullMatrix<double> &local_entry_matrix,
3007 double scale,
double scale_ico)
3009 if (this->GetType() ==
"state")
3011 this->GetPDE().
InterfaceMatrix(fdc, local_entry_matrix, scale*interval_length_,
3012 scale_ico*interval_length_);
3014 else if (this->GetType() ==
"adjoint"
3015 || this->GetType() ==
"adjoint_for_ee"
3016 || this->GetType() ==
"adjoint_hessian")
3018 this->GetPDE().InterfaceMatrix_T(fdc, local_entry_matrix, scale*interval_length_,
3019 scale_ico*interval_length_);
3024 "OptProblemContainer::NewtonInterfaceMatrix");
3030 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3031 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3032 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3033 template<
int,
int>
class DH>
3034 template<
typename FACEDATACONTAINER>
3037 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::BoundaryMatrix(
3038 const FACEDATACONTAINER& fdc, FullMatrix<double> &local_matrix,
3039 double scale,
double scale_ico)
3041 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
3044 this->GetPDE().
BoundaryMatrix(fdc, local_matrix, scale*interval_length_,
3045 scale_ico*interval_length_);
3047 else if (this->GetType() ==
"adjoint"
3048 || this->GetType() ==
"adjoint_for_ee"
3049 || this->GetType() ==
"adjoint_hessian")
3052 this->GetPDE().BoundaryMatrix_T(fdc, local_matrix, scale*interval_length_,
3053 scale_ico*interval_length_);
3055 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian"))
3058 this->GetPDE().ControlBoundaryMatrix(fdc, local_matrix, scale*c_interval_length_);
3063 "OptProblemContainer::ElementBoundaryMatrix");
3068 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3069 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3070 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3071 template<
int,
int>
class DH>
3074 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ComputeLocalControlConstraints(
3075 VECTOR& constraints,
3076 const std::map<std::string,
const dealii::Vector<double>*> &,
3077 const std::map<std::string, const VECTOR*> &block_values)
3079 if (this->GetType() ==
"constraints")
3081 if (this->GetSpaceTimeHandler()->GetNLocalConstraints() != 0)
3083 const VECTOR& control = *GetBlockVector(block_values,
"control");
3084 this->GetConstraints()->EvaluateLocalControlConstraints(control,
3091 "OptProblemContainer::ComputeLocalConstraints");
3097 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3098 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3099 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3100 template<
int,
int>
class DH>
3103 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDoFType()
const
3105 if (this->GetType() ==
"state" || this->GetType() ==
"adjoint"
3106 || this->GetType() ==
"adjoint_for_ee" || this->GetType() ==
"tangent"
3107 || this->GetType() ==
"adjoint_hessian")
3111 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian")
3112 || (this->GetType() ==
"hessian_inverse"))
3119 "OptProblemContainer::GetDoFType");
3125 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3126 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3127 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3128 template<
int,
int>
class DH>
3129 const FE<dealdim, dealdim>&
3131 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFESystem()
const
3133 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
3134 || this->GetType() ==
"adjoint_for_ee" || this->GetType() ==
"tangent"
3135 || this->GetType() ==
"adjoint_hessian")
3137 return this->GetSpaceTimeHandler()->
GetFESystem(
"state");
3139 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian")
3140 || (this->GetType() ==
"global_constraint_gradient"))
3142 #if dope_dimension > 0
3143 if(dopedim == dealdim)
3144 return this->GetSpaceTimeHandler()->GetFESystem(
"control");
3146 throw DOpEException(
"Non matching dimensions!",
"OptProblemContainer::GetFESystem");
3148 return this->GetSpaceTimeHandler()->GetFESystem(
"state");
3154 "OptProblemContainer::GetFESystem");
3160 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3161 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3162 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3163 template<
int,
int>
class DH>
3166 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetUpdateFlags()
const
3170 if (this->GetType().find(
"aux_functional") != std::string::npos)
3174 else if (this->GetType().find(
"functional") != std::string::npos)
3176 r = this->GetFunctional()->GetUpdateFlags();
3178 else if (this->GetType().find(
"constraints") != std::string::npos)
3180 r = this->GetConstraints()->GetUpdateFlags();
3182 else if (this->GetType() ==
"functional_for_ee")
3184 r = aux_functionals_[functional_for_ee_num_]->GetUpdateFlags();
3188 r = this->GetPDE().GetUpdateFlags();
3189 if (this->GetType() ==
"adjoint_hessian" || this->GetType() ==
"adjoint"
3190 || (this->GetType() ==
"hessian")
3191 || (this->GetType() ==
"gradient"))
3193 r = r | this->GetFunctional()->GetUpdateFlags();
3195 else if (this->GetType() ==
"adjoint_for_ee")
3197 r = r | aux_functionals_[functional_for_ee_num_]->GetUpdateFlags();
3200 return r | update_JxW_values;
3205 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3206 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3207 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3208 template<
int,
int>
class DH>
3211 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFaceUpdateFlags()
const
3214 if (this->GetType().find(
"aux_functional") != std::string::npos)
3218 else if (this->GetType().find(
"functional") != std::string::npos)
3220 r = this->GetFunctional()->GetFaceUpdateFlags();
3222 else if (this->GetType().find(
"constraints") != std::string::npos)
3224 r = this->GetConstraints()->GetFaceUpdateFlags();
3226 else if (this->GetType() ==
"functional_for_ee")
3228 r = aux_functionals_[functional_for_ee_num_]->GetUpdateFlags();
3232 r = this->GetPDE().GetFaceUpdateFlags();
3233 if (this->GetType() ==
"adjoint_hessian" || this->GetType() ==
"adjoint"
3234 || (this->GetType() ==
"hessian"))
3236 r = r | this->GetFunctional()->GetFaceUpdateFlags();
3238 else if (this->GetType() ==
"adjoint_for_ee")
3241 | aux_functionals_[functional_for_ee_num_]->GetFaceUpdateFlags();
3244 return r | update_JxW_values;
3249 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3250 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3251 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3252 template<
int,
int>
class DH>
3255 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFunctionalType()
const
3257 if (this->GetType() ==
"aux_functional")
3259 return aux_functionals_[this->GetTypeNum()]->
GetType();
3261 else if (this->GetType() ==
"functional_for_ee")
3263 return aux_functionals_[functional_for_ee_num_]->GetType();
3265 return GetFunctional()->GetType();
3270 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3271 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3272 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3273 template<
int,
int>
class DH>
3276 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFunctionalName()
const
3278 if (this->GetType() ==
"aux_functional")
3280 return aux_functionals_[this->GetTypeNum()]->
GetName();
3282 else if (this->GetType() ==
"functional_for_ee")
3284 return aux_functionals_[functional_for_ee_num_]->GetName();
3286 return GetFunctional()->GetName();
3291 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3292 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3293 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3294 template<
int,
int>
class DH>
3297 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetConstraintType()
const
3299 return GetConstraints()->
GetType();
3304 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3305 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3306 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3307 template<
int,
int>
class DH>
3310 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetTime(
double time,
3311 unsigned int time_dof_number,
3314 GetSpaceTimeHandler()->SetInterval(interval);
3317 interval_length_ = GetSpaceTimeHandler()->GetStepSize();
3321 c_interval_length_ = 1.;
3325 c_interval_length_ = GetSpaceTimeHandler()->GetStepSize();
3329 for (
unsigned int i = 0;
3330 i < transposed_control_gradient_dirichlet_values_.size(); i++)
3331 transposed_control_gradient_dirichlet_values_[i]->SetTime(time);
3332 for (
unsigned int i = 0;
3333 i < transposed_control_hessian_dirichlet_values_.size(); i++)
3334 transposed_control_hessian_dirichlet_values_[i]->SetTime(time);
3335 for (
unsigned int i = 0; i < primal_dirichlet_values_.size(); i++)
3336 primal_dirichlet_values_[i]->SetTime(time);
3337 for (
unsigned int i = 0; i < tangent_dirichlet_values_.size(); i++)
3338 tangent_dirichlet_values_[i]->SetTime(time);
3339 for (
unsigned int i = 0; i < control_dirichlet_values_.size(); i++)
3340 control_dirichlet_values_[i]->SetTime(time);
3342 GetFunctional()->SetTime(time);
3343 for (
unsigned int i = 0; i < aux_functionals_.size(); i++)
3344 aux_functionals_[i]->SetTime(time);
3346 this->GetPDE().SetTime(time);
3350 typename std::map<std::string, const ControlVector<VECTOR> *>::iterator it =
3351 auxiliary_controls_.begin();
3352 for (; it != auxiliary_controls_.end(); it++)
3354 it->second->SetTimeDoFNumber(time_dof_number);
3358 typename std::map<std::string, const StateVector<VECTOR> *>::iterator it =
3359 auxiliary_state_.begin();
3360 for (; it != auxiliary_state_.end(); it++)
3362 it->second->SetTimeDoFNumber(time_dof_number, interval);
3366 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
3367 auxiliary_constraints_.begin();
3368 for (; it != auxiliary_constraints_.end(); it++)
3370 it->second->SetTimeDoFNumber(time_dof_number);
3378 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3379 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3380 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3381 template<
int,
int>
class DH>
3384 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ComputeSparsityPattern(
3385 SPARSITYPATTERN & sparsity)
const
3387 if (this->GetType() ==
"state" || this->GetType() ==
"tangent"
3388 || this->GetType() ==
"adjoint_for_ee" || this->GetType() ==
"adjoint"
3389 || this->GetType() ==
"adjoint_hessian")
3391 this->GetSpaceTimeHandler()->ComputeStateSparsityPattern(sparsity);
3393 else if ((this->GetType() ==
"gradient")
3394 || (this->GetType() ==
"hessian"))
3396 #if dope_dimension > 0
3397 this->GetSpaceTimeHandler()->ComputeControlSparsityPattern(sparsity);
3400 "OptProblemContainer::ComputeSparsityPattern");
3406 "OptProblemContainer::ComputeSparsityPattern");
3412 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3413 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3414 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3415 template<
int,
int>
class DH>
3418 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::PostProcessConstraints(
3425 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3426 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3427 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3428 template<
int,
int>
class DH>
3431 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AddAuxiliaryControl(
3434 if (auxiliary_controls_.find(name) != auxiliary_controls_.end())
3437 "Adding multiple Data with name " + name +
" is prohibited!",
3438 "OptProblemContainer::AddAuxiliaryControl");
3440 auxiliary_controls_.insert(
3446 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3447 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3448 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3449 template<
int,
int>
class DH>
3452 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AddAuxiliaryState(
3455 if (auxiliary_state_.find(name) != auxiliary_state_.end())
3458 "Adding multiple Data with name " + name +
" is prohibited!",
3459 "OptProblemContainer::AddAuxiliaryState");
3461 auxiliary_state_.insert(
3466 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3467 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3468 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3469 template<
int,
int>
class DH>
3472 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AddAuxiliaryConstraint(
3475 if (auxiliary_constraints_.find(name) != auxiliary_constraints_.end())
3478 "Adding multiple Data with name " + name +
" is prohibited!",
3479 "OptProblemContainer::AddAuxiliaryConstraint");
3481 auxiliary_constraints_.insert(
3486 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3487 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3488 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3489 template<
int,
int>
class DH>
3492 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetAuxiliaryControl(
3493 std::string name)
const
3495 typename std::map<std::string, const ControlVector<VECTOR> *>::const_iterator it =
3496 auxiliary_controls_.find(name);
3497 if (it == auxiliary_controls_.end())
3499 throw DOpEException(
"Could not find Data with name " + name,
3500 "OptProblemContainer::GetAuxiliaryControl");
3507 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3508 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3509 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3510 template<
int,
int>
class DH>
3513 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetAuxiliaryState(
3514 std::string name)
const
3516 typename std::map<std::string, const StateVector<VECTOR> *>::const_iterator it =
3517 auxiliary_state_.find(name);
3518 if (it == auxiliary_state_.end())
3520 throw DOpEException(
"Could not find Data with name " + name,
3521 "OptProblemContainer::GetAuxiliaryState");
3528 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3529 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3530 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3531 template<
int,
int>
class DH>
3534 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::DeleteAuxiliaryControl(
3537 typename std::map<std::string, const ControlVector<VECTOR> *>::iterator it =
3538 auxiliary_controls_.find(name);
3539 if (it == auxiliary_controls_.end())
3542 "Deleting Data " + name +
" is impossible! Data not found",
3543 "OptProblemContainer::DeleteAuxiliaryControl");
3545 auxiliary_controls_.erase(it);
3550 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3551 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3552 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3553 template<
int,
int>
class DH>
3556 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::DeleteAuxiliaryState(
3559 typename std::map<std::string, const StateVector<VECTOR> *>::iterator it =
3560 auxiliary_state_.find(name);
3561 if (it == auxiliary_state_.end())
3564 "Deleting Data " + name +
" is impossible! Data not found",
3565 "OptProblemContainer::DeleteAuxiliaryState");
3567 auxiliary_state_.erase(it);
3572 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3573 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3574 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3575 template<
int,
int>
class DH>
3578 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::DeleteAuxiliaryConstraint(
3581 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
3582 auxiliary_constraints_.find(name);
3583 if (it == auxiliary_constraints_.end())
3586 "Deleting Data " + name +
" is impossible! Data not found",
3587 "OptProblemContainer::DeleteAuxiliaryConstraint");
3589 auxiliary_constraints_.erase(it);
3594 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3595 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3596 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3597 template<
int,
int>
class DH>
3600 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFunctional()
3602 if (this->GetType() ==
"aux_functional"
3603 || this->GetType() ==
"functional_for_ee")
3615 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3616 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3617 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3618 template<
int,
int>
class DH>
3621 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFunctional()
const
3623 if (this->GetType() ==
"aux_functional"
3624 || this->GetType() ==
"functional_for_ee")
3635 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3636 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3637 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3638 template<
int,
int>
class DH>
3641 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::HasFaces()
const
3643 if (this->GetType().find(
"aux_functional") != std::string::npos)
3645 return aux_functionals_[this->GetTypeNum()]->
HasFaces();
3647 else if (this->GetType().find(
"functional") != std::string::npos)
3649 return this->GetFunctional()->HasFaces();
3651 else if (this->GetType().find(
"constraint") != std::string::npos)
3653 return this->GetConstraints()->HasFaces();
3657 if ((this->GetType() ==
"state") || (this->GetType() ==
"tangent")
3658 || (this->GetType() ==
"gradient"))
3660 return this->GetPDE().HasFaces();
3662 else if ((this->GetType() ==
"adjoint")
3663 || (this->GetType() ==
"adjoint_hessian")
3664 || (this->GetType() ==
"hessian"))
3666 return this->GetPDE().HasFaces() || this->GetFunctional()->HasFaces();
3668 else if (this->GetType() ==
"adjoint_for_ee")
3670 return this->GetPDE().HasFaces()
3671 || aux_functionals_[functional_for_ee_num_]->HasFaces();
3675 throw DOpEException(
"Unknown Type: '" + this->GetType() +
"'!",
3676 "OptProblemContainer::HasFaces");
3683 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3684 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3685 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3686 template<
int,
int>
class DH>
3689 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::HasPoints()
const
3691 if (this->GetType().find(
"constraint") != std::string::npos
3692 || (this->GetType() ==
"functional")
3693 || this->GetType() ==
"aux_functional" || (this->GetType() ==
"state")
3694 || (this->GetType() ==
"tangent"))
3699 else if ((this->GetType() ==
"adjoint")
3700 || (this->GetType() ==
"adjoint_hessian")
3701 || (this->GetType() ==
"hessian"))
3703 return this->GetFunctional()->
HasPoints();
3705 else if (this->GetType() ==
"adjoint_for_ee")
3707 return aux_functionals_[functional_for_ee_num_]->HasPoints();
3709 else if (this->GetType() ==
"gradient")
3711 return this->GetFunctional()->HasPoints();
3715 throw DOpEException(
"Unknown Type: '" + this->GetType() +
"'!",
3716 "OptProblem::HasPoints");
3723 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3724 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3725 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3726 template<
int,
int>
class DH>
3729 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::HasInterfaces()
const
3731 if (this->GetType().find(
"aux_functional") != std::string::npos)
3735 else if (this->GetType().find(
"functional") != std::string::npos)
3739 else if (this->GetType().find(
"constraint") != std::string::npos)
3745 if ((this->GetType() ==
"state") || this->GetType() ==
"adjoint_for_ee"
3746 || (this->GetType() ==
"tangent") || (this->GetType() ==
"gradient")
3747 || (this->GetType() ==
"adjoint")
3748 || (this->GetType() ==
"adjoint_hessian")
3749 || (this->GetType() ==
"hessian"))
3755 throw DOpEException(
"Unknown Type: '" + this->GetType() +
"'!",
3756 "OptProblemContainer::HasInterfaces");
3763 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3764 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3765 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3766 template<
int,
int>
class DH>
3767 template<
typename ELEMENTITERATOR>
3770 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AtInterface(ELEMENTITERATOR& element,
unsigned int face)
const
3772 if (this->GetType().find(
"aux_functional") != std::string::npos)
3776 else if (this->GetType().find(
"functional") != std::string::npos)
3780 else if (this->GetType().find(
"constraint") != std::string::npos)
3786 if ((this->GetType() ==
"state") || this->GetType() ==
"adjoint_for_ee"
3787 || (this->GetType() ==
"tangent") || (this->GetType() ==
"gradient")
3788 || (this->GetType() ==
"adjoint")
3789 || (this->GetType() ==
"adjoint_hessian")
3790 || (this->GetType() ==
"hessian"))
3796 throw DOpEException(
"Unknown Type: '" + this->GetType() +
"'!",
3797 "OptProblemContainer::HasFaces");
3803 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3804 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3805 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3806 template<
int,
int>
class DH>
3809 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetControlDirichletBoundaryColors(
3810 unsigned int color,
const std::vector<bool>& comp_mask,
3815 unsigned int comp = control_dirichlet_colors_.size();
3816 for (
unsigned int i = 0; i < control_dirichlet_colors_.size(); ++i)
3818 if (control_dirichlet_colors_[i] == color)
3824 if (comp != control_dirichlet_colors_.size())
3826 std::stringstream s;
3827 s <<
"ControlDirichletColor" << color <<
" has multiple occurences !";
3829 "OptProblemContainer::SetControlDirichletBoundary");
3831 control_dirichlet_colors_.push_back(color);
3832 control_dirichlet_comps_.push_back(comp_mask);
3833 control_dirichlet_values_.push_back(values);
3838 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3839 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3840 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3841 template<
int,
int>
class DH>
3844 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetDirichletBoundaryColors(
3845 unsigned int color,
const std::vector<bool>& comp_mask,
3849 assert(values->n_components() == comp_mask.size());
3851 unsigned int comp = dirichlet_colors_.size();
3852 for (
unsigned int i = 0; i < dirichlet_colors_.size(); ++i)
3854 if (dirichlet_colors_[i] == color)
3860 if (comp != dirichlet_colors_.size())
3862 std::stringstream s;
3863 s <<
"DirichletColor" << color <<
" has multiple occurrences !";
3865 "OptProblemContainer::SetDirichletBoundary");
3867 dirichlet_colors_.push_back(color);
3868 dirichlet_comps_.push_back(comp_mask);
3871 primal_dirichlet_values_.push_back(data);
3874 tangent_dirichlet_values_.push_back(tdata);
3876 if (values->NeedsControl())
3878 control_transposed_dirichlet_colors_.push_back(color);
3882 transposed_control_gradient_dirichlet_values_.push_back(gdata);
3886 transposed_control_hessian_dirichlet_values_.push_back(hdata);
3892 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3893 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3894 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3895 template<
int,
int>
class DH>
3896 const std::vector<unsigned int>&
3898 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDirichletColors()
const
3900 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
3901 || this->GetType() ==
"adjoint_for_ee"
3902 || (this->GetType() ==
"tangent")
3903 || (this->GetType() ==
"adjoint_hessian"))
3905 return dirichlet_colors_;
3907 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian")
3908 || (this->GetType() ==
"global_constraint_gradient"))
3910 return control_dirichlet_colors_;
3915 "OptProblemContainer::GetDirichletColors");
3920 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3921 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3922 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3923 template<
int,
int>
class DH>
3924 const std::vector<unsigned int>&
3926 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetTransposedDirichletColors()
const
3928 if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian"))
3930 return control_transposed_dirichlet_colors_;
3935 "OptProblemContainer::GetTransposedDirichletColors");
3941 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3942 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3943 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3944 template<
int,
int>
class DH>
3945 const std::vector<bool>&
3947 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDirichletCompMask(
3948 unsigned int color)
const
3950 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
3951 || this->GetType() ==
"adjoint_for_ee"
3952 || (this->GetType() ==
"tangent")
3953 || (this->GetType() ==
"adjoint_hessian"))
3955 unsigned int comp = dirichlet_colors_.size();
3956 for (
unsigned int i = 0; i < dirichlet_colors_.size(); ++i)
3958 if (dirichlet_colors_[i] == color)
3964 if (comp == dirichlet_colors_.size())
3966 std::stringstream s;
3967 s <<
"DirichletColor" << color <<
" has not been found !";
3969 "OptProblemContainer::GetDirichletCompMask");
3971 return dirichlet_comps_[comp];
3973 else if ((this->GetType() ==
"gradient")
3974 || (this->GetType() ==
"hessian"))
3976 unsigned int comp = control_dirichlet_colors_.size();
3977 for (
unsigned int i = 0; i < control_dirichlet_colors_.size(); ++i)
3979 if (control_dirichlet_colors_[i] == color)
3985 if (comp == control_dirichlet_colors_.size())
3987 std::stringstream s;
3988 s <<
"ControlDirichletColor" << color <<
" has not been found !";
3990 "OptProblemContainer::GetDirichletCompMask");
3992 return control_dirichlet_comps_[comp];
3997 "OptProblemContainer::GetDirichletCompMask");
4002 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4003 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4004 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4005 template<
int,
int>
class DH>
4006 const std::vector<bool>&
4008 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetTransposedDirichletCompMask(
4009 unsigned int color)
const
4011 if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian"))
4013 unsigned int comp = dirichlet_colors_.size();
4014 for (
unsigned int i = 0; i < dirichlet_colors_.size(); ++i)
4016 if (dirichlet_colors_[i] == color)
4022 if (comp == dirichlet_colors_.size())
4024 std::stringstream s;
4025 s <<
"DirichletColor" << color <<
" has not been found !";
4027 "OptProblemContainer::GetDirichletCompMask");
4029 return dirichlet_comps_[comp];
4034 "OptProblemContainer::GetTransposedDirichletCompMask");
4040 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4041 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4042 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4043 template<
int,
int>
class DH>
4044 const Function<dealdim>&
4046 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDirichletValues(
4048 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
4049 const std::map<std::string, const VECTOR*> &domain_values)
const
4052 unsigned int col = dirichlet_colors_.size();
4053 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
4054 || this->GetType() ==
"adjoint_for_ee"
4055 || (this->GetType() ==
"tangent")
4056 || (this->GetType() ==
"adjoint_hessian"))
4058 for (
unsigned int i = 0; i < dirichlet_colors_.size(); ++i)
4060 if (dirichlet_colors_[i] == color)
4066 if (col == dirichlet_colors_.size())
4068 std::stringstream s;
4069 s <<
"DirichletColor" << color <<
" has not been found !";
4071 "OptProblemContainer::GetDirichletValues");
4074 else if (this->GetType() ==
"gradient" || (this->GetType() ==
"hessian"))
4076 col = control_dirichlet_colors_.size();
4077 for (
unsigned int i = 0; i < control_dirichlet_colors_.size(); ++i)
4079 if (control_dirichlet_colors_[i] == color)
4085 if (col == control_dirichlet_colors_.size())
4087 std::stringstream s;
4088 s <<
"ControlDirichletColor" << color <<
" has not been found !";
4090 "OptProblemContainer::GetDirichletValues");
4096 "OptProblemContainer::GetDirichletValues");
4099 if (this->GetType() ==
"state")
4101 primal_dirichlet_values_[col]->ReInit(param_values, domain_values,
4103 return *(primal_dirichlet_values_[col]);
4105 else if (this->GetType() ==
"tangent")
4107 tangent_dirichlet_values_[col]->ReInit(param_values, domain_values,
4109 return *(tangent_dirichlet_values_[col]);
4111 else if (this->GetType() ==
"adjoint"
4112 || this->GetType() ==
"adjoint_for_ee"
4113 || (this->GetType() ==
"adjoint_hessian"))
4115 return *(zero_dirichlet_values_);
4117 else if (this->GetType() ==
"gradient" || (this->GetType() ==
"hessian"))
4119 return *(control_dirichlet_values_[col]);
4124 "OptProblemContainer::GetDirichletValues");
4129 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4130 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4131 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4132 template<
int,
int>
class DH>
4135 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetTransposedDirichletValues(
4137 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
4138 const std::map<std::string, const VECTOR*> &domain_values)
const
4140 unsigned int col = control_transposed_dirichlet_colors_.size();
4141 if (this->GetType() ==
"gradient" || (this->GetType() ==
"hessian"))
4143 for (
unsigned int i = 0;
4144 i < control_transposed_dirichlet_colors_.size(); ++i)
4146 if (control_transposed_dirichlet_colors_[i] == color)
4152 if (col == control_transposed_dirichlet_colors_.size())
4154 std::stringstream s;
4155 s <<
"TransposedControlDirichletColor" << color
4156 <<
" has not been found !";
4158 "OptProblemContainer::GetTransposedDirichletValues");
4164 "OptProblemContainer::GetTransposedDirichletValues");
4167 if (this->GetType() ==
"gradient")
4169 transposed_control_gradient_dirichlet_values_[col]->ReInit(param_values,
4170 domain_values, color);
4171 return *(transposed_control_gradient_dirichlet_values_[col]);
4173 else if (this->GetType() ==
"hessian")
4175 transposed_control_hessian_dirichlet_values_[col]->ReInit(param_values,
4176 domain_values, color);
4177 return *(transposed_control_hessian_dirichlet_values_[col]);
4182 "OptProblemContainer::GetTransposedDirichletValues");
4188 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4189 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4190 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4191 template<
int,
int>
class DH>
4192 const std::vector<unsigned int>&
4194 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetBoundaryEquationColors()
const
4196 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
4198 return state_boundary_equation_colors_;
4200 else if (this->GetType() ==
"adjoint"
4201 || this->GetType() ==
"adjoint_for_ee"
4202 || this->GetType() ==
"adjoint_hessian")
4204 return adjoint_boundary_equation_colors_;
4206 else if (this->GetType() ==
"gradient" || (this->GetType() ==
"hessian")
4207 || (this->GetType() ==
"global_constraint_gradient"))
4209 return control_boundary_equation_colors_;
4214 "OptProblemContainer::GetBoundaryEquationColors");
4220 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4221 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4222 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4223 template<
int,
int>
class DH>
4226 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetControlBoundaryEquationColors(
4230 unsigned int comp = control_boundary_equation_colors_.size();
4231 for (
unsigned int i = 0; i < control_boundary_equation_colors_.size();
4234 if (control_boundary_equation_colors_[i] == color)
4240 if (comp != control_boundary_equation_colors_.size())
4242 std::stringstream s;
4243 s <<
"Boundary Equation Color" << color
4244 <<
" has multiple occurences !";
4246 "OptProblemContainer::SetControlBoundaryEquationColors");
4248 control_boundary_equation_colors_.push_back(color);
4253 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4254 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4255 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4256 template<
int,
int>
class DH>
4259 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetBoundaryEquationColors(
4263 unsigned int comp = state_boundary_equation_colors_.size();
4264 for (
unsigned int i = 0; i < state_boundary_equation_colors_.size();
4267 if (state_boundary_equation_colors_[i] == color)
4273 if (comp != state_boundary_equation_colors_.size())
4275 std::stringstream s;
4276 s <<
"Boundary Equation Color" << color
4277 <<
" has multiple occurences !";
4279 "OptProblemContainer::SetBoundaryEquationColors");
4281 state_boundary_equation_colors_.push_back(color);
4284 unsigned int comp = adjoint_boundary_equation_colors_.size();
4285 for (
unsigned int i = 0; i < adjoint_boundary_equation_colors_.size();
4288 if (adjoint_boundary_equation_colors_[i] == color)
4294 if (comp != adjoint_boundary_equation_colors_.size())
4301 adjoint_boundary_equation_colors_.push_back(color);
4308 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4309 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4310 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4311 template<
int,
int>
class DH>
4312 const std::vector<unsigned int>&
4314 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetBoundaryFunctionalColors()
const
4316 if (this->GetType() ==
"cost_functional"
4317 || this->GetType() ==
"aux_functional"
4318 || this->GetType() ==
"functional_for_ee")
4320 return boundary_functional_colors_;
4325 "OptProblemContainer::GetBoundaryFunctionalColors");
4331 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4332 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4333 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4334 template<
int,
int>
class DH>
4337 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetBoundaryFunctionalColors(
4341 unsigned int comp = boundary_functional_colors_.size();
4342 for (
unsigned int i = 0; i < boundary_functional_colors_.size(); ++i)
4344 if (boundary_functional_colors_[i] == color)
4350 if (comp != boundary_functional_colors_.size())
4352 std::stringstream s;
4353 s <<
"Boundary Functional Color" << color
4354 <<
" has multiple occurences !";
4356 "OptProblemContainer::SetBoundaryFunctionalColors");
4358 boundary_functional_colors_.push_back(color);
4361 unsigned int comp = adjoint_boundary_equation_colors_.size();
4362 for (
unsigned int i = 0; i < adjoint_boundary_equation_colors_.size();
4365 if (adjoint_boundary_equation_colors_[i] == color)
4371 if (comp != adjoint_boundary_equation_colors_.size())
4378 adjoint_boundary_equation_colors_.push_back(color);
4385 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4386 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4387 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4388 template<
int,
int>
class DH>
4391 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetControlNBlocks()
const
4398 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4399 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4400 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4401 template<
int,
int>
class DH>
4404 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetStateNBlocks()
const
4411 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4412 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4413 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4414 template<
int,
int>
class DH>
4417 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetNBlocks()
const
4419 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint_for_ee")
4420 || (this->GetType() ==
"adjoint") || (this->GetType() ==
"tangent")
4421 || (this->GetType() ==
"adjoint_hessian"))
4423 return this->GetStateNBlocks();
4425 else if ((this->GetType() ==
"gradient")
4426 || (this->GetType() ==
"hessian"))
4428 return this->GetControlNBlocks();
4433 "OptProblemContainer::GetNBlocks");
4439 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4440 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4441 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4442 template<
int,
int>
class DH>
4445 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDoFsPerBlock(
4446 unsigned int b)
const
4448 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
4449 || (this->GetType() ==
"adjoint_for_ee")
4450 || (this->GetType() ==
"tangent")
4451 || (this->GetType() ==
"adjoint_hessian"))
4453 return GetSpaceTimeHandler()->GetStateDoFsPerBlock(b);
4455 else if ((this->GetType() ==
"gradient")
4456 || (this->GetType() ==
"hessian"))
4458 return GetSpaceTimeHandler()->GetControlDoFsPerBlock(b);
4463 "OptProblemContainer::GetDoFsPerBlock");
4469 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4470 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4471 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4472 template<
int,
int>
class DH>
4473 const std::vector<unsigned int>&
4475 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDoFsPerBlock()
const
4477 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
4478 || (this->GetType() ==
"adjoint_for_ee")
4479 || (this->GetType() ==
"tangent")
4480 || (this->GetType() ==
"adjoint_hessian"))
4482 return GetSpaceTimeHandler()->GetStateDoFsPerBlock();
4484 else if ((this->GetType() ==
"gradient")
4485 || (this->GetType() ==
"hessian"))
4487 return GetSpaceTimeHandler()->GetControlDoFsPerBlock();
4492 "OptProblemContainer::GetDoFsPerBlock");
4498 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4499 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4500 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4501 template<
int,
int>
class DH>
4502 const dealii::ConstraintMatrix&
4504 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDoFConstraints()
const
4506 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
4507 || (this->GetType() ==
"adjoint_for_ee")
4508 || (this->GetType() ==
"tangent")
4509 || (this->GetType() ==
"adjoint_hessian"))
4511 return GetSpaceTimeHandler()->GetStateDoFConstraints();
4513 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian")
4514 || (this->GetType() ==
"global_constraint_gradient"))
4516 return GetSpaceTimeHandler()->GetControlDoFConstraints();
4521 "OptProblemContainer::GetDoFConstraints");
4527 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4528 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4529 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4530 template<
int,
int>
class DH>
4533 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::NeedTimeFunctional()
const
4535 if (this->GetType() ==
"cost_functional")
4536 return GetFunctional()->NeedTime();
4537 else if (this->GetType() ==
"aux_functional")
4538 return aux_functionals_[this->GetTypeNum()]->NeedTime();
4539 else if (this->GetType() ==
"functional_for_ee")
4540 return aux_functionals_[functional_for_ee_num_]->NeedTime();
4543 "OptProblemContainer::NeedTimeFunctional");
4548 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4549 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4550 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4551 template<
int,
int>
class DH>
4554 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::HasControlInDirichletData()
const
4556 return (!control_transposed_dirichlet_colors_.empty());
void ElementTimeMatrix(const DATACONTAINER &dc, dealii::FullMatrix< double > &local_entry_matrix)
void ElementMatrix(const DATACONTAINER &dc, dealii::FullMatrix< double > &local_entry_matrix, double scale=1., double scale_ico=1.)
Definition: optproblemcontainer.h:2849
void DeleteAuxiliaryState(std::string name)
Definition: optproblemcontainer.h:3556
DOpEOutputHandler< VECTOR > * GetOutputHandler()
Definition: optproblemcontainer.h:822
void Init_PointRhs(const std::map< std::string, const dealii::Vector< double > * > ¶m_values, const std::map< std::string, const VECTOR * > &domain_values, VECTOR &rhs_vector, double scale=1.)
Definition: optproblemcontainer.h:1254
OptProblemContainer(FUNCTIONAL &functional, PDE &pde, CONSTRAINTS &constraints, SpaceTimeHandler< FE, DH, SPARSITYPATTERN, VECTOR, dopedim, dealdim > &STH)
Definition: optproblemcontainer.h:1440
void BoundaryEquation(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:2084
dealii::UpdateFlags GetUpdateFlags() const
Definition: optproblemcontainer.h:3166
Definition: stateproblem.h:48
const ConstraintVector< VECTOR > * GetAuxiliaryConstraint(std::string name)
Definition: optproblemcontainer.h:914
unsigned int GetNFunctionals() const
Definition: optproblemcontainer.h:754
double FaceFunctional(const FACEDATACONTAINER &fdc)
Definition: optproblemcontainer.h:1763
void Init_ElementEquation(const DATACONTAINER &edc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:1189
void RegisterOutputHandler(DOpEOutputHandler< VECTOR > *OH)
Definition: optproblemcontainer.h:164
void BoundaryRhs(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:2675
Definition: constraintvector.h:48
void AddPreviousAuxiliaryToIntegrator(INTEGRATOR &integrator)
Definition: optproblemcontainer.h:1030
double AlgebraicFunctional(const std::map< std::string, const dealii::Vector< double > * > &values, const std::map< std::string, const VECTOR * > &block_values)
Definition: optproblemcontainer.h:1796
void ComputeLocalControlConstraints(VECTOR &constraints, const std::map< std::string, const dealii::Vector< double > * > &values, const std::map< std::string, const VECTOR * > &block_values)
Definition: optproblemcontainer.h:3074
void ElementTimeMatrixExplicit(const DATACONTAINER &dc, dealii::FullMatrix< double > &local_entry_matrix)
Definition: optproblemcontainer.h:2929
void ElementTimeEquationExplicit(const DATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:1954
const std::vector< unsigned int > & GetBoundaryFunctionalColors() const
Definition: optproblemcontainer.h:4314
void ElementRhs(const DATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:2135
void AddNextAuxiliaryToIntegrator(INTEGRATOR &integrator)
Definition: optproblemcontainer.h:1003
void DeletePreviousAuxiliaryFromIntegrator(INTEGRATOR &integrator)
Definition: optproblemcontainer.h:1084
void ReInit(std::string algo_type)
Definition: optproblemcontainer.h:1508
const VECTOR * GetBlockVector(const std::map< std::string, const VECTOR * > &values, std::string name)
Definition: optproblemcontainer.h:1353
Definition: dopetypes.h:106
const dealii::Function< dealdim > & GetInitialValues() const
Definition: optproblemcontainer.h:662
const FE< dealdim, dealdim > & GetFESystem() const
Definition: optproblemcontainer.h:3131
void PostProcessConstraints(ConstraintVector< VECTOR > &g) const
Definition: optproblemcontainer.h:3418
dealii::UpdateFlags GetFaceUpdateFlags() const
Definition: optproblemcontainer.h:3211
std::string GetFunctionalType() const
Definition: optproblemcontainer.h:3255
void AddFunctional(FUNCTIONAL_INTERFACE *F)
Definition: optproblemcontainer.h:692
FUNCTIONAL * GetFunctional()
Definition: optproblemcontainer.h:3600
Definition: tangentdirichletdata.h:39
bool HasInterfaces() const
Definition: optproblemcontainer.h:3729
double BoundaryFunctional(const FACEDATACONTAINER &fdc)
Definition: optproblemcontainer.h:1725
double ElementFunctional(const DATACONTAINER &edc)
Definition: optproblemcontainer.h:1635
std::string GetType() const
Definition: problemcontainer_internal.h:109
const std::vector< unsigned int > & GetBoundaryEquationColors() const
Definition: optproblemcontainer.h:4194
void SetDirichletBoundaryColors(unsigned int color, const std::vector< bool > &comp_mask, const DD *values)
Definition: optproblemcontainer.h:3844
const std::vector< unsigned int > & GetDoFsPerBlock() const
Definition: optproblemcontainer.h:4475
void SetControlBoundaryEquationColors(unsigned int color)
Definition: optproblemcontainer.h:4226
void PointRhs(const std::map< std::string, const dealii::Vector< double > * > ¶m_values, const std::map< std::string, const VECTOR * > &domain_values, VECTOR &rhs_vector, double scale=1.)
Definition: optproblemcontainer.h:2323
Definition: problemcontainer_internal.h:38
Definition: optproblemcontainer.h:70
void GetControlBoxConstraints(VECTOR &lb, VECTOR &ub) const
Definition: optproblemcontainer.h:566
void AddAuxiliaryControl(const ControlVector< VECTOR > *c, std::string name)
Definition: optproblemcontainer.h:3431
const std::vector< unsigned int > & GetDirichletColors() const
Definition: optproblemcontainer.h:3898
bool HasPoints() const
Definition: optproblemcontainer.h:3689
std::string GetDoFType() const
Definition: optproblemcontainer.h:3103
virtual std::string GetName() const
Definition: optproblemcontainer.h:115
void ElementEquation(const DATACONTAINER &edc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:1833
void ElementTimeEquation(const DATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:1910
const std::vector< bool > & GetDirichletCompMask(unsigned int color) const
Definition: optproblemcontainer.h:3947
void SetType(std::string type, unsigned int num=0)
Definition: optproblemcontainer.h:1550
double PointFunctional(const std::map< std::string, const dealii::Vector< double > * > ¶m_values, const std::map< std::string, const VECTOR * > &domain_values)
Definition: optproblemcontainer.h:1671
Definition: timeiterator.h:62
Definition: dopetypes.h:105
unsigned int GetNBlocks() const
Definition: optproblemcontainer.h:4417
const StateVector< VECTOR > * GetAuxiliaryState(std::string name) const
Definition: optproblemcontainer.h:3513
const dealii::Function< dealdim > & GetDirichletValues(unsigned int color, const std::map< std::string, const dealii::Vector< double > * > ¶m_values, const std::map< std::string, const VECTOR * > &domain_values) const
Definition: optproblemcontainer.h:4046
void SetTime(double time, unsigned int time_dof_number, const TimeIterator &interval, bool initial=false)
Definition: optproblemcontainer.h:3310
Definition: controlvector.h:49
void Init_ElementMatrix(const DATACONTAINER &edc, dealii::FullMatrix< double > &local_entry_matrix, double scale, double scale_ico)
Definition: optproblemcontainer.h:1304
StateProblem< OptProblemContainer< FUNCTIONAL_INTERFACE, FUNCTIONAL, PDE, DD, CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH >, PDE, DD, SPARSITYPATTERN, VECTOR, dealdim > & GetStateProblem()
Definition: optproblemcontainer.h:128
const PDE & GetPDE() const
Definition: problemcontainer_internal.h:103
bool EEFunctionalIsCost() const
Definition: optproblemcontainer.h:1328
const dealii::ConstraintMatrix & GetDoFConstraints() const
Definition: optproblemcontainer.h:4504
std::string GetConstraintType() const
Definition: optproblemcontainer.h:3297
Definition: optproblemcontainer.h:101
unsigned int GetStateNBlocks()
Definition: optproblemcontainer.h:1164
void FaceEquation(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:2002
void AddAuxiliaryConstraint(const ConstraintVector< VECTOR > *c, std::string name)
Definition: optproblemcontainer.h:3472
const ControlVector< VECTOR > * GetAuxiliaryControl(std::string name) const
Definition: optproblemcontainer.h:3492
DOpEExceptionHandler< VECTOR > * GetExceptionHandler()
Definition: optproblemcontainer.h:813
void FaceRhs(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:2506
const SpaceTimeHandler< FE, DH, SPARSITYPATTERN, VECTOR, dopedim, dealdim > * GetSpaceTimeHandler() const
Definition: optproblemcontainer.h:847
void RegisterExceptionHandler(DOpEExceptionHandler< VECTOR > *OH)
Definition: optproblemcontainer.h:172
Definition: transposedhessiandirichletdata.h:41
CONSTRAINTS * GetConstraints()
Definition: optproblemcontainer.h:1342
void FaceMatrix(const FACEDATACONTAINER &dc, dealii::FullMatrix< double > &local_entry_matrix, double scale=1., double scale_ico=1.)
void DeleteAuxiliaryFromIntegrator(INTEGRATOR &integrator)
Definition: optproblemcontainer.h:1108
const dealii::Vector< double > * GetVector(const std::map< std::string, const Vector< double > * > &values, std::string name)
Definition: optproblemcontainer.h:1366
SpaceTimeHandler< FE, DH, SPARSITYPATTERN, VECTOR, dopedim, dealdim > * GetSpaceTimeHandler()
Definition: optproblemcontainer.h:855
const CONSTRAINTS * GetConstraints() const
Definition: optproblemcontainer.h:1347
bool HasFaces() const
Definition: optproblemcontainer.h:3641
Definition: primaldirichletdata.h:41
const std::vector< unsigned int > & GetTransposedDirichletColors() const
Definition: optproblemcontainer.h:3926
Definition: statevector.h:50
const TransposedDirichletDataInterface< dealdim > & GetTransposedDirichletValues(unsigned int color, const std::map< std::string, const dealii::Vector< double > * > ¶m_values, const std::map< std::string, const VECTOR * > &domain_values) const
Definition: optproblemcontainer.h:4135
void DeleteNextAuxiliaryFromIntegrator(INTEGRATOR &integrator)
Definition: optproblemcontainer.h:1058
void ComputeSparsityPattern(SPARSITYPATTERN &sparsity) const
Definition: optproblemcontainer.h:3384
bool AtInterface(ELEMENTITERATOR &element, unsigned int face) const
Definition: optproblemcontainer.h:3770
void AlgebraicResidual(VECTOR &residual, const std::map< std::string, const dealii::Vector< double > * > &values, const std::map< std::string, const VECTOR * > &block_values)
Definition: optproblemcontainer.h:1883
void InterfaceEquation(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:2052
Definition: spacetimehandler.h:71
OptProblemContainer< FUNCTIONAL_INTERFACE, FUNCTIONAL, PDE, DD, CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH > & GetBaseProblem()
Definition: optproblemcontainer.h:145
void SetFunctionalForErrorEstimation(std::string functional_name)
Definition: optproblemcontainer.h:718
unsigned int GetStateNBlocks() const
Definition: optproblemcontainer.h:4404
std::vector< unsigned int > & GetControlBlockComponent()
Definition: optproblemcontainer.h:1172
void AddAuxiliaryState(const StateVector< VECTOR > *c, std::string name)
Definition: optproblemcontainer.h:3452
bool NeedTimeFunctional() const
Definition: optproblemcontainer.h:4533
std::string GetFunctionalName() const
Definition: optproblemcontainer.h:3276
Definition: transposeddirichletdatainterface.h:37
unsigned int GetControlNBlocks() const
Definition: optproblemcontainer.h:4391
const std::vector< bool > & GetTransposedDirichletCompMask(unsigned int color) const
Definition: optproblemcontainer.h:4008
virtual ~OptProblemContainer()
Definition: optproblemcontainer.h:1465
bool HasControlInDirichletData() const
Definition: optproblemcontainer.h:4554
std::vector< unsigned int > & GetStateBlockComponent()
Definition: optproblemcontainer.h:1179
void SetInitialValues(const dealii::Function< dealdim > *values)
Definition: optproblemcontainer.h:657
Definition: dopeexception.h:35
Definition: transposedgradientdirichletdata.h:41
void AddAuxiliaryToIntegrator(INTEGRATOR &integrator)
Definition: optproblemcontainer.h:936
void SetBoundaryEquationColors(unsigned int color)
Definition: optproblemcontainer.h:4259
void SetControlDirichletBoundaryColors(unsigned int color, const std::vector< bool > &comp_mask, const DOpEWrapper::Function< dealdim > *values)
Definition: optproblemcontainer.h:3809
void DeleteAuxiliaryConstraint(std::string name)
Definition: optproblemcontainer.h:3578
const std::map< std::string, unsigned int > & GetFunctionalPosition() const
Definition: optproblemcontainer.h:1158
void SetBoundaryFunctionalColors(unsigned int color)
Definition: optproblemcontainer.h:4337
void DeleteAuxiliaryControl(std::string name)
Definition: optproblemcontainer.h:3534
void BoundaryMatrix(const FACEDATACONTAINER &dc, dealii::FullMatrix< double > &local_matrix, double scale=1., double scale_ico=1.)
void Init_ElementRhs(const DATACONTAINER &edc, dealii::Vector< double > &local_vector, double scale)
Definition: optproblemcontainer.h:1208
void InterfaceMatrix(const FACEDATACONTAINER &dc, dealii::FullMatrix< double > &local_entry_matrix, double scale=1., double scale_ico=1.)
Definition: optproblemcontainer.h:72