24 #ifndef _OptProblemContainer_H_
25 #define _OptProblemContainer_H_
49 #include <lac/vector.h>
50 #include <lac/full_matrix.h>
51 #include <grid/tria_iterator.h>
52 #include <dofs/dof_handler.h>
53 #include <dofs/dof_accessor.h>
54 #include <dofs/dof_tools.h>
55 #include <fe/fe_system.h>
56 #include <fe/fe_values.h>
57 #include <fe/mapping.h>
58 #include <base/quadrature_lib.h>
59 #include <lac/block_sparsity_pattern.h>
60 #include <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;
912 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
913 _auxiliary_constraints.find(name);
914 if (it == _auxiliary_constraints.end())
917 "OptProblemContainer::GetAuxiliaryConstraint");
923 template<
typename INTEGRATOR>
928 typename std::map<std::string, const ControlVector<VECTOR> *>::iterator it =
929 _auxiliary_controls.begin();
930 for (; it != _auxiliary_controls.end(); it++)
932 if (dopedim == dealdim)
934 integrator.AddDomainData(it->first,
935 &(it->second->GetSpacialVector()));
937 else if (dopedim == 0)
939 integrator.AddParamData(it->first,
940 &(it->second->GetSpacialVectorCopy()));
945 "OptProblemContainer::AddAuxiliaryToIntegrator");
950 typename std::map<std::string, const StateVector<VECTOR> *>::iterator it =
951 _auxiliary_state.begin();
952 for (; it != _auxiliary_state.end(); it++)
954 integrator.AddDomainData(it->first,
955 &(it->second->GetSpacialVector()));
959 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
960 _auxiliary_constraints.begin();
961 for (; it != _auxiliary_constraints.end(); it++)
963 integrator.AddDomainData(it->first +
"_local",
964 &(it->second->GetSpacialVector(
"local")));
965 integrator.AddParamData(it->first +
"_global",
966 &(it->second->GetGlobalConstraints()));
973 template<
typename INTEGRATOR>
978 typename std::map<std::string, const ControlVector<VECTOR> *>::iterator it =
979 _auxiliary_controls.begin();
980 for (; it != _auxiliary_controls.end(); it++)
982 if (dopedim == dealdim)
984 integrator.DeleteDomainData(it->first);
986 else if (dopedim == 0)
988 integrator.DeleteParamData(it->first);
989 it->second->UnLockCopy();
994 "OptProblemContainer::AddAuxiliaryToIntegrator");
999 typename std::map<std::string, const StateVector<VECTOR> *>::iterator it =
1000 _auxiliary_state.begin();
1001 for (; it != _auxiliary_state.end(); it++)
1003 integrator.DeleteDomainData(it->first);
1007 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
1008 _auxiliary_constraints.begin();
1009 for (; it != _auxiliary_constraints.end(); it++)
1011 integrator.DeleteDomainData(it->first +
"_local");
1012 integrator.DeleteParamData(it->first +
"_global");
1018 const std::map<std::string, unsigned int>&
1021 return _functional_position;
1027 return this->
GetPDE().GetStateNBlocks();
1032 std::vector<unsigned int>&
1035 return this->
GetPDE().GetControlBlockComponent();
1039 std::vector<unsigned int>&
1042 return this->
GetPDE().GetStateBlockComponent();
1048 template<
typename DATACONTAINER>
1051 dealii::Vector<double> &local_vector,
double scale,
1055 || this->
GetType() ==
"adjoint_hessian")
1057 this->
GetPDE().Init_ElementEquation(edc, local_vector, scale,
1063 "OptProblemContainer::Init_ElementEquation");
1067 template<
typename DATACONTAINER>
1070 dealii::Vector<double> &local_vector,
double scale)
1073 if (this->
GetType() ==
"adjoint")
1078 != std::string::npos)
1081 != std::string::npos)
1088 else if (this->
GetType() ==
"tangent")
1090 this->
GetPDE().Init_ElementRhs_QT(edc, local_vector, scale);
1092 else if (this->
GetType() ==
"adjoint_hessian")
1097 != std::string::npos)
1100 != std::string::npos)
1110 "OptProblemContainer::Init_ElementRhs");
1116 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
1117 const std::map<std::string, const VECTOR*> &domain_values,
1118 VECTOR& rhs_vector,
double scale = 1.)
1120 if (this->
GetType() ==
"adjoint")
1125 != std::string::npos)
1128 != std::string::npos)
1136 else if (this->
GetType() ==
"tangent")
1140 else if (this->
GetType() ==
"adjoint_hessian")
1145 != std::string::npos)
1148 != std::string::npos)
1159 "OptProblemContainer::Init_PointRhs");
1163 template<
typename DATACONTAINER>
1166 dealii::FullMatrix<double> &local_entry_matrix,
double scale,
1170 || this->
GetType() ==
"adjoint_hessian")
1172 this->
GetPDE().Init_ElementMatrix(edc, local_entry_matrix, scale,
1178 "OptProblemContainer::Init_ElementMatrix");
1191 return _functional_for_ee_is_cost;
1202 return _constraints;
1207 return _constraints;
1214 typename std::map<std::string, const VECTOR*>::const_iterator it =
1216 if (it == values.end())
1219 "OptProblemContainer::GetBlockVector");
1223 const dealii::Vector<double>*
1224 GetVector(
const std::map<std::string,
const Vector<double>*>& values,
1227 typename std::map<std::string, const Vector<double>*>::const_iterator it =
1229 if (it == values.end())
1232 "OptProblemContainer::GetVector");
1240 std::string _algo_type;
1242 bool _functional_for_ee_is_cost;
1243 unsigned int _functional_for_ee_num;
1244 std::vector<FUNCTIONAL_INTERFACE*> _aux_functionals;
1245 std::map<std::string, unsigned int> _functional_position;
1246 FUNCTIONAL* _functional;
1247 CONSTRAINTS* _constraints;
1250 std::vector<unsigned int> _control_dirichlet_colors;
1251 std::vector<unsigned int> _control_transposed_dirichlet_colors;
1252 std::vector<std::vector<bool> > _control_dirichlet_comps;
1253 std::vector<const DOpEWrapper::Function<dealdim>*> _control_dirichlet_values;
1259 std::vector<unsigned int> _dirichlet_colors;
1260 std::vector<std::vector<bool> > _dirichlet_comps;
1261 std::vector<PrimalDirichletData<DD, VECTOR, dealdim>*> _primal_dirichlet_values;
1262 std::vector<TangentDirichletData<DD, VECTOR, dealdim>*> _tangent_dirichlet_values;
1263 const dealii::Function<dealdim>* _zero_dirichlet_values;
1265 const dealii::Function<dealdim>* _initial_values;
1267 std::vector<unsigned int> _control_boundary_equation_colors;
1268 std::vector<unsigned int> _state_boundary_equation_colors;
1269 std::vector<unsigned int> _adjoint_boundary_equation_colors;
1271 std::vector<unsigned int> _boundary_functional_colors;
1273 std::map<std::string, const ControlVector<VECTOR>*> _auxiliary_controls;
1274 std::map<std::string, const StateVector<VECTOR>*> _auxiliary_state;
1275 std::map<std::string, const ConstraintVector<VECTOR>*> _auxiliary_constraints;
1279 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>,
1280 PDE, DD, SPARSITYPATTERN, VECTOR, dealdim> * _state_problem;
1284 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>,
1285 PDE, DD, SPARSITYPATTERN, VECTOR, dealdim> ;
1289 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1290 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1291 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1292 template<
int,
int>
class DH>
1295 FUNCTIONAL& functional, PDE& pde, CONSTRAINTS& constraints,
1298 &constraints), _STH(&STH), _state_problem(NULL)
1300 _ExceptionHandler = NULL;
1301 _OutputHandler = NULL;
1302 _zero_dirichlet_values =
new ZeroFunction<dealdim>(
1303 this->
GetPDE().GetStateNComponents());
1305 _functional_position[_functional->GetName()] = 0;
1307 _functional_for_ee_num = dealii::numbers::invalid_unsigned_int;
1312 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1313 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1314 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1315 template<
int,
int>
class DH>
1317 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::~OptProblemContainer()
1319 if (_zero_dirichlet_values != NULL)
1321 delete _zero_dirichlet_values;
1324 for (
unsigned int i = 0;
1325 i < _transposed_control_gradient_dirichlet_values.size(); i++)
1327 if (_transposed_control_gradient_dirichlet_values[i] != NULL)
1328 delete _transposed_control_gradient_dirichlet_values[i];
1330 for (
unsigned int i = 0;
1331 i < _transposed_control_hessian_dirichlet_values.size(); i++)
1333 if (_transposed_control_hessian_dirichlet_values[i] != NULL)
1334 delete _transposed_control_hessian_dirichlet_values[i];
1336 for (
unsigned int i = 0; i < _primal_dirichlet_values.size(); i++)
1338 if (_primal_dirichlet_values[i] != NULL)
1339 delete _primal_dirichlet_values[i];
1341 for (
unsigned int i = 0; i < _tangent_dirichlet_values.size(); i++)
1343 if (_tangent_dirichlet_values[i] != NULL)
1344 delete _tangent_dirichlet_values[i];
1346 if (_state_problem != NULL)
1348 delete _state_problem;
1354 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1355 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1356 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1357 template<
int,
int>
class DH>
1360 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ReInit(
1361 std::string algo_type)
1363 if (_state_problem != NULL)
1365 delete _state_problem;
1366 _state_problem = NULL;
1369 if (_algo_type != algo_type && _algo_type !=
"")
1372 "OptProblemContainer::ReInit");
1376 _algo_type = algo_type;
1377 this->SetTypeInternal(
"");
1379 if (_algo_type ==
"reduced")
1381 GetSpaceTimeHandler()->ReInit(this->GetPDE().GetControlNBlocks(),
1382 this->GetPDE().GetControlBlockComponent(),
1383 this->GetPDE().GetStateNBlocks(),
1384 this->GetPDE().GetStateBlockComponent());
1389 "OptProblemContainer::ReInit");
1396 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1397 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1398 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1399 template<
int,
int>
class DH>
1402 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetType(
1403 std::string type,
unsigned int num)
1405 if (this->GetType() != type || this->GetTypeNum() != num)
1407 this->SetTypeNumInternal(num);
1408 this->SetTypeInternal(type);
1409 this->GetPDE().SetProblemType(type);
1410 if (_functional_for_ee_num != dealii::numbers::invalid_unsigned_int)
1411 _aux_functionals[_functional_for_ee_num]->SetProblemType(type);
1412 this->GetConstraints()->SetProblemType(type, num);
1414 #if dope_dimension > 0
1415 if(dealdim == dopedim)
1420 if(this->GetType() ==
"state" ||this->GetType() ==
"adjoint"
1421 || this->GetType() ==
"adjoint_for_ee" || this->GetType() ==
"cost_functional"
1422 || this->GetType() ==
"aux_functional" || this->GetType() ==
"functional_for_ee"
1423 || this->GetType() ==
"tangent" || this->GetType() ==
"adjoint_hessian"
1424 || this->GetType() ==
"error_evaluation"
1425 || this->GetType().find(
"constraints") != std::string::npos)
1427 GetSpaceTimeHandler()->SetDoFHandlerOrdering(1,0);
1429 else if (this->GetType() ==
"gradient"||this->GetType() ==
"hessian"||this->GetType() ==
"hessian_inverse" || this->GetType() ==
"global_constraint_gradient"|| this->GetType() ==
"global_constraint_hessian")
1431 GetSpaceTimeHandler()->SetDoFHandlerOrdering(0,1);
1435 throw DOpEException(
"_problem_type : "+this->GetType()+
" not implemented!",
"OptProblemContainer::SetType");
1441 throw DOpEException(
"dopedim not implemented",
"OptProblemContainer::SetType");
1449 if (this->GetType() ==
"state" || this->GetType() ==
"adjoint"
1450 || this->GetType() ==
"adjoint_for_ee"
1451 || this->GetType() ==
"functional_for_ee"
1452 || this->GetType() ==
"cost_functional"
1453 || this->GetType() ==
"aux_functional"
1454 || this->GetType() ==
"tangent"
1455 || this->GetType() ==
"error_evaluation"
1456 || this->GetType() ==
"adjoint_hessian")
1458 GetSpaceTimeHandler()->SetDoFHandlerOrdering(0, 0);
1460 else if (this->GetType() ==
"gradient"
1461 || this->GetType() ==
"hessian_inverse"
1462 || this->GetType() ==
"hessian")
1464 GetSpaceTimeHandler()->SetDoFHandlerOrdering(0, 0);
1469 "_problem_type : " + this->GetType() +
" not implemented!",
1470 "OptProblemContainer::SetType");
1480 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1481 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1482 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1483 template<
int,
int>
class DH>
1484 template<
typename DATACONTAINER>
1487 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementFunctional(
1488 const DATACONTAINER& edc)
1491 if (this->GetType() ==
"cost_functional")
1494 return GetFunctional()->ElementValue(edc);
1496 else if (this->GetType() ==
"aux_functional")
1499 return _aux_functionals[this->GetTypeNum()]->ElementValue(edc);
1501 else if (this->GetType() ==
"functional_for_ee")
1503 return _aux_functionals[_functional_for_ee_num]->ElementValue(edc);
1505 else if (this->GetType().find(
"constraints") != std::string::npos)
1507 return GetConstraints()->ElementValue(edc);
1512 "OptProblemContainer::ElementFunctional");
1517 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1518 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1519 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1520 template<
int,
int>
class DH>
1523 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::PointFunctional(
1524 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
1525 const std::map<std::string, const VECTOR*> &domain_values)
1527 if (this->GetType() ==
"cost_functional")
1530 return GetFunctional()->PointValue(
1531 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
1532 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
1536 else if (this->GetType() ==
"aux_functional")
1539 return _aux_functionals[this->GetTypeNum()]->PointValue(
1540 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
1541 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
1545 else if (this->GetType() ==
"functional_for_ee")
1548 return _aux_functionals[_functional_for_ee_num]->PointValue(
1549 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
1550 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
1553 else if (this->GetType().find(
"constraints") != std::string::npos)
1555 return GetConstraints()->PointValue(
1556 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
1557 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
1564 "OptProblemContainer::PointFunctional");
1570 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1571 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1572 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1573 template<
int,
int>
class DH>
1574 template<
typename FACEDATACONTAINER>
1577 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::BoundaryFunctional(
1578 const FACEDATACONTAINER& fdc)
1580 if (this->GetType() ==
"cost_functional")
1583 return GetFunctional()->BoundaryValue(fdc);
1585 else if (this->GetType() ==
"aux_functional")
1588 return _aux_functionals[this->GetTypeNum()]->BoundaryValue(fdc);
1590 else if (this->GetType() ==
"functional_for_ee")
1593 return _aux_functionals[_functional_for_ee_num]->BoundaryValue(fdc);
1595 else if (this->GetType().find(
"constraints") != std::string::npos)
1597 return GetConstraints()->BoundaryValue(fdc);
1602 "OptProblemContainer::BoundaryFunctional");
1608 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1609 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1610 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1611 template<
int,
int>
class DH>
1612 template<
typename FACEDATACONTAINER>
1615 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::FaceFunctional(
1616 const FACEDATACONTAINER& fdc)
1618 if (this->GetType() ==
"cost_functional")
1621 return GetFunctional()->FaceValue(fdc);
1623 else if (this->GetType() ==
"aux_functional")
1626 return _aux_functionals[this->GetTypeNum()]->FaceValue(fdc);
1628 else if (this->GetType() ==
"functional_for_ee")
1631 return _aux_functionals[_functional_for_ee_num]->FaceValue(fdc);
1636 "OptProblemContainer::FaceFunctional");
1642 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1643 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1644 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1645 template<
int,
int>
class DH>
1648 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AlgebraicFunctional(
1649 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
1650 const std::map<std::string, const VECTOR*> &domain_values)
1652 if (this->GetType() ==
"cost_functional")
1655 return GetFunctional()->AlgebraicValue(param_values, domain_values);
1657 else if (this->GetType() ==
"aux_functional")
1660 return _aux_functionals[this->GetTypeNum()]->AlgebraicValue(
1661 param_values, domain_values);
1663 else if (this->GetType() ==
"functional_for_ee")
1666 return _aux_functionals[_functional_for_ee_num]->AlgebraicValue(
1667 param_values, domain_values);
1672 "OptProblemContainer::AlgebraicFunctional");
1678 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1679 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1680 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1681 template<
int,
int>
class DH>
1682 template<
typename DATACONTAINER>
1685 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementEquation(
1686 const DATACONTAINER& edc, dealii::Vector<double> &local_vector,
1687 double scale,
double scale_ico)
1690 if (this->GetType() ==
"state")
1695 else if ((this->GetType() ==
"adjoint")
1696 || (this->GetType() ==
"adjoint_for_ee"))
1699 this->GetPDE().ElementEquation_U(edc, local_vector, scale,
1702 else if (this->GetType() ==
"adjoint_hessian")
1705 this->GetPDE().ElementEquation_UTT(edc, local_vector, scale,
1708 else if (this->GetType() ==
"tangent")
1711 this->GetPDE().ElementEquation_UT(edc, local_vector, scale,
1714 else if ((this->GetType() ==
"gradient")
1715 || (this->GetType() ==
"hessian"))
1718 this->GetPDE().ControlElementEquation(edc, local_vector, scale);
1723 "OptProblemContainer::ElementEquation");
1729 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1730 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1731 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1732 template<
int,
int>
class DH>
1735 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AlgebraicResidual(
1737 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
1738 const std::map<std::string, const VECTOR*> &domain_values)
1740 if (this->GetType() ==
"gradient")
1743 return GetFunctional()->AlgebraicGradient_Q(residual, param_values,
1749 "OptProblemContainer::AlgebraicFunctional");
1755 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1756 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1757 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1758 template<
int,
int>
class DH>
1759 template<
typename DATACONTAINER>
1762 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementTimeEquation(
1763 const DATACONTAINER& edc, dealii::Vector<double> &local_vector,
1767 if (this->GetType() ==
"state")
1771 else if (this->GetType() ==
"adjoint"
1772 || this->GetType() ==
"adjoint_for_ee")
1774 this->GetPDE().ElementTimeEquation_U(edc, local_vector, scale);
1776 else if (this->GetType() ==
"adjoint_hessian")
1778 this->GetPDE().ElementTimeEquation_UTT(edc, local_vector, scale);
1780 else if (this->GetType() ==
"tangent")
1782 this->GetPDE().ElementTimeEquation_UT(edc, local_vector, scale);
1784 else if ((this->GetType() ==
"gradient")
1785 || (this->GetType() ==
"hessian"))
1788 "OptProblemContainer::ElementTimeEquation");
1793 "OptProblemContainer::ElementTimeEquation");
1799 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1800 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1801 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1802 template<
int,
int>
class DH>
1803 template<
typename DATACONTAINER>
1806 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementTimeEquationExplicit(
1807 const DATACONTAINER& edc, dealii::Vector<double> &local_vector,
1811 if (this->GetType() ==
"state")
1816 else if (this->GetType() ==
"adjoint"
1817 || this->GetType() ==
"adjoint_for_ee")
1819 this->GetPDE().ElementTimeEquationExplicit_U(edc, local_vector,
1822 else if (this->GetType() ==
"adjoint_hessian")
1824 this->GetPDE().ElementTimeEquationExplicit_UTT(edc, local_vector,
1827 else if (this->GetType() ==
"tangent")
1829 this->GetPDE().ElementTimeEquationExplicit_UT(edc, local_vector,
1832 else if ((this->GetType() ==
"gradient")
1833 || (this->GetType() ==
"hessian"))
1836 "OptProblemContainer::ElementTimeEquationExplicit");
1841 "OptProblemContainer::ElementTimeEquationExplicit");
1847 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1848 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1849 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1850 template<
int,
int>
class DH>
1851 template<
typename FACEDATACONTAINER>
1854 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::FaceEquation(
1855 const FACEDATACONTAINER& fdc,
1856 dealii::Vector<double> &local_vector,
double scale,
1859 if (this->GetType() ==
"state")
1862 this->GetPDE().
FaceEquation(fdc, local_vector, scale, scale_ico);
1864 else if (this->GetType() ==
"adjoint"
1865 || this->GetType() ==
"adjoint_for_ee")
1868 this->GetPDE().FaceEquation_U(fdc, local_vector, scale,
1871 else if (this->GetType() ==
"adjoint_hessian")
1874 this->GetPDE().FaceEquation_UTT(fdc, local_vector, scale,
1877 else if (this->GetType() ==
"tangent")
1880 this->GetPDE().FaceEquation_UT(fdc, local_vector, scale,
1891 "OptProblemContainer::FaceEquation");
1897 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1898 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1899 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1900 template<
int,
int>
class DH>
1901 template<
typename FACEDATACONTAINER>
1904 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::InterfaceEquation(
1905 const FACEDATACONTAINER& fdc,
1906 dealii::Vector<double> &local_vector,
double scale,
1909 if (this->GetType() ==
"state")
1914 else if (this->GetType() ==
"adjoint"
1915 || this->GetType() ==
"adjoint_for_ee")
1918 this->GetPDE().InterfaceEquation_U(fdc, local_vector, scale,
1924 "OptProblemContainer::InterfaceEquation");
1929 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1930 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1931 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1932 template<
int,
int>
class DH>
1933 template<
typename FACEDATACONTAINER>
1936 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::BoundaryEquation(
1937 const FACEDATACONTAINER& fdc,
1938 dealii::Vector<double> &local_vector,
double scale,
1941 if (this->GetType() ==
"state")
1947 else if (this->GetType() ==
"adjoint"
1948 || this->GetType() ==
"adjoint_for_ee")
1951 this->GetPDE().BoundaryEquation_U(fdc, local_vector, scale,
1954 else if (this->GetType() ==
"adjoint_hessian")
1957 this->GetPDE().BoundaryEquation_UTT(fdc, local_vector, scale,
1960 else if (this->GetType() ==
"tangent")
1963 this->GetPDE().BoundaryEquation_UT(fdc, local_vector, scale,
1974 "OptProblemContainer::ElementBoundaryEquation");
1980 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
1981 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
1982 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
1983 template<
int,
int>
class DH>
1984 template<
typename DATACONTAINER>
1987 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementRhs(
1988 const DATACONTAINER& edc, dealii::Vector<double> &local_vector,
1997 if (this->GetType() ==
"state")
2000 this->GetPDE().ElementRightHandSide(edc, local_vector, scale);
2002 else if (this->GetType() ==
"adjoint")
2005 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2006 GetFunctional()->ElementValue_U(edc, local_vector, scale);
2008 else if (this->GetType() ==
"adjoint_for_ee")
2011 _aux_functionals[_functional_for_ee_num]->ElementValue_U(edc,
2012 local_vector, scale);
2014 else if (this->GetType() ==
"tangent")
2018 this->GetPDE().ElementEquation_QT(edc, local_vector, scale, scale);
2020 else if (this->GetType() ==
"adjoint_hessian")
2023 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2025 GetFunctional()->ElementValue_UU(edc, local_vector, scale);
2026 GetFunctional()->ElementValue_QU(edc, local_vector, scale);
2029 this->GetPDE().ElementEquation_UU(edc, local_vector, scale, scale);
2030 this->GetPDE().ElementEquation_QU(edc, local_vector, scale, scale);
2032 this->GetPDE().ElementTimeEquationExplicit_UU(edc, local_vector,
2035 else if (this->GetType() ==
"gradient")
2037 if (GetSpaceTimeHandler()->GetControlType()
2040 this->GetPDE().Init_ElementRhs_Q(edc, local_vector, scale);
2043 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2044 GetFunctional()->ElementValue_Q(edc, local_vector, scale);
2047 this->GetPDE().ElementEquation_Q(edc, local_vector, scale, scale);
2049 else if (this->GetType() ==
"hessian")
2051 if (GetSpaceTimeHandler()->GetControlType()
2054 this->GetPDE().Init_ElementRhs_QTT(edc, local_vector, scale);
2055 this->GetPDE().Init_ElementRhs_QQ(edc, local_vector, scale);
2058 if (GetFunctional()->GetType().find(
"domain") != std::string::npos)
2060 GetFunctional()->ElementValue_QQ(edc, local_vector, scale);
2061 GetFunctional()->ElementValue_UQ(edc, local_vector, scale);
2065 this->GetPDE().ElementEquation_QTT(edc, local_vector, scale, scale);
2066 this->GetPDE().ElementEquation_UQ(edc, local_vector, scale, scale);
2067 this->GetPDE().ElementEquation_QQ(edc, local_vector, scale, scale);
2069 else if (this->GetType() ==
"global_constraint_gradient")
2071 GetConstraints()->ElementValue_Q(edc, local_vector, scale);
2073 else if (this->GetType() ==
"global_constraint_hessian")
2075 GetConstraints()->ElementValue_QQ(edc, local_vector, scale);
2080 "OptProblemContainer::ElementRhs");
2087 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2088 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2089 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2090 template<
int,
int>
class DH>
2093 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::PointRhs(
2094 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
2095 const std::map<std::string, const VECTOR*> &domain_values,
2096 VECTOR& rhs_vector,
double scale)
2099 if (this->GetType() ==
"adjoint")
2102 if (GetFunctional()->GetType().find(
"point") != std::string::npos)
2104 GetFunctional()->PointValue_U(
2105 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2106 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2107 domain_values, rhs_vector, scale);
2110 else if (this->GetType() ==
"adjoint_for_ee")
2113 _aux_functionals[_functional_for_ee_num]->PointValue_U(
2114 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2115 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2116 domain_values, rhs_vector, scale);
2118 else if (this->GetType() ==
"adjoint_hessian")
2121 if (GetFunctional()->GetType().find(
"point") != std::string::npos)
2123 GetFunctional()->PointValue_UU(
2124 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2125 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2126 domain_values, rhs_vector, scale);
2127 GetFunctional()->PointValue_QU(
2128 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2129 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2130 domain_values, rhs_vector, scale);
2133 else if (this->GetType() ==
"gradient")
2136 if (GetFunctional()->GetType().find(
"point") != std::string::npos)
2138 GetFunctional()->PointValue_Q(
2139 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2140 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2141 domain_values, rhs_vector, scale);
2144 else if (this->GetType() ==
"hessian")
2147 if (GetFunctional()->GetType().find(
"point") != std::string::npos)
2149 GetFunctional()->PointValue_QQ(
2150 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2151 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2152 domain_values, rhs_vector, scale);
2153 GetFunctional()->PointValue_UQ(
2154 this->GetSpaceTimeHandler()->GetControlDoFHandler(),
2155 this->GetSpaceTimeHandler()->GetStateDoFHandler(), param_values,
2156 domain_values, rhs_vector, scale);
2161 throw DOpEException(
"Not implemented",
"OptProblem::PointRhs");
2168 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2169 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2170 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2171 template<
int,
int>
class DH>
2172 template<
typename FACEDATACONTAINER>
2175 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::FaceRhs(
2176 const FACEDATACONTAINER& fdc,
2177 dealii::Vector<double> &local_vector,
double scale)
2180 if (this->GetType() ==
"state")
2183 this->GetPDE().FaceRightHandSide(fdc, local_vector, scale);
2185 else if (this->GetType() ==
"adjoint")
2188 if (GetFunctional()->GetType().find(
"face") != std::string::npos)
2189 GetFunctional()->FaceValue_U(fdc, local_vector, scale);
2191 else if (this->GetType() ==
"adjoint_for_ee")
2194 if (_aux_functionals[_functional_for_ee_num]->GetType().find(
"face")
2195 != std::string::npos)
2196 _aux_functionals[_functional_for_ee_num]->FaceValue_U(fdc,
2197 local_vector, scale);
2199 else if (this->GetType() ==
"tangent")
2203 this->GetPDE().FaceEquation_QT(fdc, local_vector, scale, scale);
2205 else if (this->GetType() ==
"adjoint_hessian")
2208 if (GetFunctional()->GetType().find(
"face") != std::string::npos)
2210 GetFunctional()->FaceValue_UU(fdc, local_vector, scale);
2211 GetFunctional()->FaceValue_QU(fdc, local_vector, scale);
2215 this->GetPDE().FaceEquation_UU(fdc, local_vector, scale, scale);
2217 this->GetPDE().FaceEquation_QU(fdc, local_vector, scale, scale);
2219 else if (this->GetType() ==
"gradient")
2222 if (GetFunctional()->GetType().find(
"face") != std::string::npos)
2224 GetFunctional()->FaceValue_Q(fdc, local_vector, scale);
2228 this->GetPDE().FaceEquation_Q(fdc, local_vector, scale, scale);
2230 else if (this->GetType() ==
"hessian")
2233 if (GetFunctional()->GetType().find(
"face") != std::string::npos)
2235 GetFunctional()->FaceValue_QQ(fdc, local_vector, scale);
2236 GetFunctional()->FaceValue_UQ(fdc, local_vector, scale);
2240 this->GetPDE().FaceEquation_QTT(fdc, local_vector, scale, scale);
2242 this->GetPDE().FaceEquation_UQ(fdc, local_vector, scale, scale);
2244 this->GetPDE().FaceEquation_QQ(fdc, local_vector, scale, scale);
2249 "OptProblemContainer::FaceRhs");
2256 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2257 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2258 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2259 template<
int,
int>
class DH>
2260 template<
typename FACEDATACONTAINER>
2263 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::BoundaryRhs(
2264 const FACEDATACONTAINER& fdc,
2265 dealii::Vector<double> &local_vector,
double scale)
2268 if (this->GetType() ==
"state")
2271 this->GetPDE().BoundaryRightHandSide(fdc, local_vector, scale);
2273 else if (this->GetType() ==
"adjoint")
2276 if (GetFunctional()->GetType().find(
"boundary") != std::string::npos)
2277 GetFunctional()->BoundaryValue_U(fdc, local_vector, scale);
2279 else if (this->GetType() ==
"adjoint_for_ee")
2282 if (_aux_functionals[_functional_for_ee_num]->GetType().find(
2283 "boundary") != std::string::npos)
2284 _aux_functionals[_functional_for_ee_num]->BoundaryValue_U(fdc,
2285 local_vector, scale);
2287 else if (this->GetType() ==
"tangent")
2291 this->GetPDE().BoundaryEquation_QT(fdc, local_vector, scale,
2294 else if (this->GetType() ==
"adjoint_hessian")
2297 if (GetFunctional()->GetType().find(
"boundary") != std::string::npos)
2299 GetFunctional()->BoundaryValue_UU(fdc, local_vector, scale);
2300 GetFunctional()->BoundaryValue_QU(fdc, local_vector, scale);
2304 this->GetPDE().BoundaryEquation_UU(fdc, local_vector, scale,
2306 this->GetPDE().BoundaryEquation_QU(fdc, local_vector, scale,
2309 else if (this->GetType() ==
"gradient")
2312 if (GetFunctional()->GetType().find(
"boundary") != std::string::npos)
2313 GetFunctional()->BoundaryValue_Q(fdc, local_vector, scale);
2316 this->GetPDE().BoundaryEquation_Q(fdc, local_vector, scale,
2319 else if (this->GetType() ==
"hessian")
2322 if (GetFunctional()->GetType().find(
"boundary") != std::string::npos)
2324 GetFunctional()->BoundaryValue_QQ(fdc, local_vector, scale);
2325 GetFunctional()->BoundaryValue_UQ(fdc, local_vector, scale);
2329 this->GetPDE().BoundaryEquation_QTT(fdc, local_vector, scale,
2331 this->GetPDE().BoundaryEquation_UQ(fdc, local_vector, scale,
2333 this->GetPDE().BoundaryEquation_QQ(fdc, local_vector, scale,
2339 "OptProblemContainer::BoundaryRhs");
2346 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2347 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2348 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2349 template<
int,
int>
class DH>
2350 template<
typename DATACONTAINER>
2353 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementMatrix(
2354 const DATACONTAINER& edc,
2355 dealii::FullMatrix<double> &local_entry_matrix,
double scale,
2359 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2362 this->GetPDE().
ElementMatrix(edc, local_entry_matrix, scale, scale_ico);
2364 else if (this->GetType() ==
"adjoint"
2365 || this->GetType() ==
"adjoint_for_ee"
2366 || this->GetType() ==
"adjoint_hessian")
2369 this->GetPDE().ElementMatrix_T(edc, local_entry_matrix, scale,
2372 else if ((this->GetType() ==
"gradient")
2373 || (this->GetType() ==
"hessian"))
2376 this->GetPDE().ControlElementMatrix(edc, local_entry_matrix);
2381 "OptProblemContainer::ElementMatrix");
2388 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2389 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2390 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2391 template<
int,
int>
class DH>
2392 template<
typename DATACONTAINER>
2395 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementTimeMatrix(
2396 const DATACONTAINER& edc, FullMatrix<double> &local_entry_matrix)
2399 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2404 else if (this->GetType() ==
"adjoint"
2405 || this->GetType() ==
"adjoint_for_ee"
2406 || this->GetType() ==
"adjoint_hessian")
2408 this->GetPDE().ElementTimeMatrix_T(edc, local_entry_matrix);
2410 else if ((this->GetType() ==
"gradient")
2411 || (this->GetType() ==
"hessian"))
2414 "OptProblemContainer::ElementTimeMatrix");
2419 "OptProblemContainer::ElementTimeMatrix");
2426 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2427 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2428 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2429 template<
int,
int>
class DH>
2430 template<
typename DATACONTAINER>
2433 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ElementTimeMatrixExplicit(
2434 const DATACONTAINER& edc,
2435 dealii::FullMatrix<double> &local_entry_matrix)
2438 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2442 else if (this->GetType() ==
"adjoint"
2443 || this->GetType() ==
"adjoint_hessian")
2445 this->GetPDE().ElementTimeMatrixExplicit_T(edc, local_entry_matrix);
2447 else if ((this->GetType() ==
"gradient")
2448 || (this->GetType() ==
"hessian"))
2451 "OptProblemContainer::ElementTimeMatrixExplicit");
2456 "OptProblemContainer::ElementTimeMatrixExplicit");
2463 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2464 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2465 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2466 template<
int,
int>
class DH>
2467 template<
typename FACEDATACONTAINER>
2470 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::FaceMatrix(
2471 const FACEDATACONTAINER& fdc, FullMatrix<double> &local_entry_matrix,
2472 double scale,
double scale_ico)
2474 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2477 this->GetPDE().
FaceMatrix(fdc, local_entry_matrix, scale, scale_ico);
2479 else if (this->GetType() ==
"adjoint"
2480 || this->GetType() ==
"adjoint_for_ee"
2481 || this->GetType() ==
"adjoint_hessian")
2484 this->GetPDE().FaceMatrix_T(fdc, local_entry_matrix, scale,
2495 "OptProblemContainer::NewtonFaceMatrix");
2502 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2503 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2504 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2505 template<
int,
int>
class DH>
2506 template<
typename FACEDATACONTAINER>
2509 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::InterfaceMatrix(
2510 const FACEDATACONTAINER& fdc, FullMatrix<double> &local_entry_matrix,
2511 double scale,
double scale_ico)
2513 if (this->GetType() ==
"state")
2518 else if (this->GetType() ==
"adjoint"
2519 || this->GetType() ==
"adjoint_for_ee"
2520 || this->GetType() ==
"adjoint_hessian")
2522 this->GetPDE().InterfaceMatrix_T(fdc, local_entry_matrix, scale,
2528 "OptProblemContainer::NewtonInterfaceMatrix");
2534 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2535 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2536 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2537 template<
int,
int>
class DH>
2538 template<
typename FACEDATACONTAINER>
2541 CONSTRAINTS, SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::BoundaryMatrix(
2542 const FACEDATACONTAINER& fdc, FullMatrix<double> &local_matrix,
2543 double scale,
double scale_ico)
2545 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
2551 else if (this->GetType() ==
"adjoint"
2552 || this->GetType() ==
"adjoint_for_ee"
2553 || this->GetType() ==
"adjoint_hessian")
2556 this->GetPDE().BoundaryMatrix_T(fdc, local_matrix, scale,
2567 "OptProblemContainer::ElementBoundaryMatrix");
2572 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2573 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2574 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2575 template<
int,
int>
class DH>
2578 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ComputeLocalControlConstraints(
2579 VECTOR& constraints,
2580 const std::map<std::string,
const dealii::Vector<double>*> &,
2581 const std::map<std::string, const VECTOR*> &block_values)
2583 if (this->GetType() ==
"constraints")
2585 if (this->GetSpaceTimeHandler()->GetNLocalConstraints() != 0)
2587 const VECTOR& control = *GetBlockVector(block_values,
"control");
2588 this->GetConstraints()->EvaluateLocalControlConstraints(control,
2595 "OptProblemContainer::ComputeLocalConstraints");
2601 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2602 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2603 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2604 template<
int,
int>
class DH>
2607 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDoFType()
const
2609 if (this->GetType() ==
"state" || this->GetType() ==
"adjoint"
2610 || this->GetType() ==
"adjoint_for_ee" || this->GetType() ==
"tangent"
2611 || this->GetType() ==
"adjoint_hessian")
2615 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian")
2616 || (this->GetType() ==
"hessian_inverse"))
2623 "OptProblemContainer::GetDoFType");
2629 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2630 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2631 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2632 template<
int,
int>
class DH>
2633 const FE<dealdim, dealdim>&
2635 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFESystem()
const
2637 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
2638 || this->GetType() ==
"adjoint_for_ee" || this->GetType() ==
"tangent"
2639 || this->GetType() ==
"adjoint_hessian")
2641 return this->GetSpaceTimeHandler()->
GetFESystem(
"state");
2643 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian")
2644 || (this->GetType() ==
"global_constraint_gradient"))
2646 #if dope_dimension > 0
2647 if(dopedim == dealdim)
2648 return this->GetSpaceTimeHandler()->GetFESystem(
"control");
2650 throw DOpEException(
"Non matching dimensions!",
"OptProblemContainer::GetFESystem");
2652 return this->GetSpaceTimeHandler()->GetFESystem(
"state");
2658 "OptProblemContainer::GetFESystem");
2664 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2665 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2666 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2667 template<
int,
int>
class DH>
2670 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetUpdateFlags()
const
2674 if (this->GetType().find(
"aux_functional") != std::string::npos)
2678 else if (this->GetType().find(
"functional") != std::string::npos)
2680 r = this->GetFunctional()->GetUpdateFlags();
2682 else if (this->GetType().find(
"constraints") != std::string::npos)
2684 r = this->GetConstraints()->GetUpdateFlags();
2686 else if (this->GetType() ==
"functional_for_ee")
2688 r = _aux_functionals[_functional_for_ee_num]->GetUpdateFlags();
2692 r = this->GetPDE().GetUpdateFlags();
2693 if (this->GetType() ==
"adjoint_hessian" || this->GetType() ==
"adjoint"
2694 || (this->GetType() ==
"hessian")
2695 || (this->GetType() ==
"gradient"))
2697 r = r | this->GetFunctional()->GetUpdateFlags();
2699 else if (this->GetType() ==
"adjoint_for_ee")
2701 r = r | _aux_functionals[_functional_for_ee_num]->GetUpdateFlags();
2704 return r | update_JxW_values;
2709 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2710 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2711 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2712 template<
int,
int>
class DH>
2715 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFaceUpdateFlags()
const
2718 if (this->GetType().find(
"aux_functional") != std::string::npos)
2722 else if (this->GetType().find(
"functional") != std::string::npos)
2724 r = this->GetFunctional()->GetFaceUpdateFlags();
2726 else if (this->GetType().find(
"constraints") != std::string::npos)
2728 r = this->GetConstraints()->GetFaceUpdateFlags();
2730 else if (this->GetType() ==
"functional_for_ee")
2732 r = _aux_functionals[_functional_for_ee_num]->GetUpdateFlags();
2736 r = this->GetPDE().GetFaceUpdateFlags();
2737 if (this->GetType() ==
"adjoint_hessian" || this->GetType() ==
"adjoint"
2738 || (this->GetType() ==
"hessian"))
2740 r = r | this->GetFunctional()->GetFaceUpdateFlags();
2742 else if (this->GetType() ==
"adjoint_for_ee")
2745 | _aux_functionals[_functional_for_ee_num]->GetFaceUpdateFlags();
2748 return r | update_JxW_values;
2753 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2754 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2755 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2756 template<
int,
int>
class DH>
2759 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFunctionalType()
const
2761 if (this->GetType() ==
"aux_functional")
2763 return _aux_functionals[this->GetTypeNum()]->
GetType();
2765 else if (this->GetType() ==
"functional_for_ee")
2767 return _aux_functionals[_functional_for_ee_num]->GetType();
2769 return GetFunctional()->GetType();
2774 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2775 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2776 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2777 template<
int,
int>
class DH>
2780 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFunctionalName()
const
2782 if (this->GetType() ==
"aux_functional")
2784 return _aux_functionals[this->GetTypeNum()]->
GetName();
2786 else if (this->GetType() ==
"functional_for_ee")
2788 return _aux_functionals[_functional_for_ee_num]->GetName();
2790 return GetFunctional()->GetName();
2795 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2796 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2797 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2798 template<
int,
int>
class DH>
2801 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetConstraintType()
const
2803 return GetConstraints()->
GetType();
2808 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2809 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2810 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2811 template<
int,
int>
class DH>
2814 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetTime(
double time,
2817 GetSpaceTimeHandler()->SetInterval(interval);
2821 for (
unsigned int i = 0;
2822 i < _transposed_control_gradient_dirichlet_values.size(); i++)
2823 _transposed_control_gradient_dirichlet_values[i]->SetTime(time);
2824 for (
unsigned int i = 0;
2825 i < _transposed_control_hessian_dirichlet_values.size(); i++)
2826 _transposed_control_hessian_dirichlet_values[i]->SetTime(time);
2827 for (
unsigned int i = 0; i < _primal_dirichlet_values.size(); i++)
2828 _primal_dirichlet_values[i]->SetTime(time);
2829 for (
unsigned int i = 0; i < _tangent_dirichlet_values.size(); i++)
2830 _tangent_dirichlet_values[i]->SetTime(time);
2831 for (
unsigned int i = 0; i < _control_dirichlet_values.size(); i++)
2832 _control_dirichlet_values[i]->SetTime(time);
2834 GetFunctional()->
SetTime(time);
2835 for (
unsigned int i = 0; i < _aux_functionals.size(); i++)
2836 _aux_functionals[i]->SetTime(time);
2838 this->GetPDE().SetTime(time);
2842 typename std::map<std::string, const ControlVector<VECTOR> *>::iterator it =
2843 _auxiliary_controls.begin();
2844 for (; it != _auxiliary_controls.end(); it++)
2846 it->second->SetTime(time, interval);
2850 typename std::map<std::string, const StateVector<VECTOR> *>::iterator it =
2851 _auxiliary_state.begin();
2852 for (; it != _auxiliary_state.end(); it++)
2854 it->second->SetTime(time, interval);
2858 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
2859 _auxiliary_constraints.begin();
2860 for (; it != _auxiliary_constraints.end(); it++)
2862 it->second->SetTime(time, interval);
2870 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2871 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2872 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2873 template<
int,
int>
class DH>
2876 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::ComputeSparsityPattern(
2877 SPARSITYPATTERN & sparsity)
const
2879 if (this->GetType() ==
"state" || this->GetType() ==
"tangent"
2880 || this->GetType() ==
"adjoint_for_ee" || this->GetType() ==
"adjoint"
2881 || this->GetType() ==
"adjoint_hessian")
2883 this->GetSpaceTimeHandler()->ComputeStateSparsityPattern(sparsity);
2885 else if ((this->GetType() ==
"gradient")
2886 || (this->GetType() ==
"hessian"))
2888 #if dope_dimension > 0
2889 this->GetSpaceTimeHandler()->ComputeControlSparsityPattern(sparsity);
2892 "OptProblemContainer::ComputeSparsityPattern");
2898 "OptProblemContainer::ComputeSparsityPattern");
2904 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2905 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2906 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2907 template<
int,
int>
class DH>
2910 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::PostProcessConstraints(
2917 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2918 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2919 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2920 template<
int,
int>
class DH>
2923 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AddAuxiliaryControl(
2926 if (_auxiliary_controls.find(name) != _auxiliary_controls.end())
2929 "Adding multiple Data with name " + name +
" is prohibited!",
2930 "OptProblemContainer::AddAuxiliaryControl");
2932 _auxiliary_controls.insert(
2938 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2939 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2940 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2941 template<
int,
int>
class DH>
2944 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AddAuxiliaryState(
2947 if (_auxiliary_state.find(name) != _auxiliary_state.end())
2950 "Adding multiple Data with name " + name +
" is prohibited!",
2951 "OptProblemContainer::AddAuxiliaryState");
2953 _auxiliary_state.insert(
2958 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2959 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2960 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2961 template<
int,
int>
class DH>
2964 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::AddAuxiliaryConstraint(
2967 if (_auxiliary_constraints.find(name) != _auxiliary_constraints.end())
2970 "Adding multiple Data with name " + name +
" is prohibited!",
2971 "OptProblemContainer::AddAuxiliaryConstraint");
2973 _auxiliary_constraints.insert(
2978 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
2979 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
2980 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
2981 template<
int,
int>
class DH>
2984 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetAuxiliaryControl(
2985 std::string name)
const
2987 typename std::map<std::string, const ControlVector<VECTOR> *>::const_iterator it =
2988 _auxiliary_controls.find(name);
2989 if (it == _auxiliary_controls.end())
2991 throw DOpEException(
"Could not find Data with name " + name,
2992 "OptProblemContainer::GetAuxiliaryControl");
2999 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3000 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3001 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3002 template<
int,
int>
class DH>
3005 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetAuxiliaryState(
3006 std::string name)
const
3008 typename std::map<std::string, const StateVector<VECTOR> *>::const_iterator it =
3009 _auxiliary_state.find(name);
3010 if (it == _auxiliary_state.end())
3012 throw DOpEException(
"Could not find Data with name " + name,
3013 "OptProblemContainer::GetAuxiliaryState");
3020 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3021 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3022 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3023 template<
int,
int>
class DH>
3026 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::DeleteAuxiliaryControl(
3029 typename std::map<std::string, const ControlVector<VECTOR> *>::iterator it =
3030 _auxiliary_controls.find(name);
3031 if (it == _auxiliary_controls.end())
3034 "Deleting Data " + name +
" is impossible! Data not found",
3035 "OptProblemContainer::DeleteAuxiliaryControl");
3037 _auxiliary_controls.erase(it);
3042 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3043 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3044 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3045 template<
int,
int>
class DH>
3048 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::DeleteAuxiliaryState(
3051 typename std::map<std::string, const StateVector<VECTOR> *>::iterator it =
3052 _auxiliary_state.find(name);
3053 if (it == _auxiliary_state.end())
3056 "Deleting Data " + name +
" is impossible! Data not found",
3057 "OptProblemContainer::DeleteAuxiliaryState");
3059 _auxiliary_state.erase(it);
3064 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3065 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3066 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3067 template<
int,
int>
class DH>
3070 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::DeleteAuxiliaryConstraint(
3073 typename std::map<std::string, const ConstraintVector<VECTOR> *>::iterator it =
3074 _auxiliary_constraints.find(name);
3075 if (it == _auxiliary_constraints.end())
3078 "Deleting Data " + name +
" is impossible! Data not found",
3079 "OptProblemContainer::DeleteAuxiliaryConstraint");
3081 _auxiliary_constraints.erase(it);
3086 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3087 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3088 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3089 template<
int,
int>
class DH>
3092 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFunctional()
3094 if (this->GetType() ==
"aux_functional"
3095 || this->GetType() ==
"functional_for_ee")
3107 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3108 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3109 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3110 template<
int,
int>
class DH>
3113 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetFunctional()
const
3115 if (this->GetType() ==
"aux_functional"
3116 || this->GetType() ==
"functional_for_ee")
3127 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3128 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3129 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3130 template<
int,
int>
class DH>
3133 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::HasFaces()
const
3135 if (this->GetType().find(
"aux_functional") != std::string::npos)
3137 return _aux_functionals[this->GetTypeNum()]->
HasFaces();
3139 else if (this->GetType().find(
"functional") != std::string::npos)
3141 return this->GetFunctional()->HasFaces();
3143 else if (this->GetType().find(
"constraint") != std::string::npos)
3145 return this->GetConstraints()->HasFaces();
3149 if ((this->GetType() ==
"state") || (this->GetType() ==
"tangent")
3150 || (this->GetType() ==
"gradient"))
3152 return this->GetPDE().HasFaces();
3154 else if ((this->GetType() ==
"adjoint")
3155 || (this->GetType() ==
"adjoint_hessian")
3156 || (this->GetType() ==
"hessian"))
3158 return this->GetPDE().HasFaces() || this->GetFunctional()->HasFaces();
3160 else if (this->GetType() ==
"adjoint_for_ee")
3162 return this->GetPDE().HasFaces()
3163 || _aux_functionals[_functional_for_ee_num]->HasFaces();
3167 throw DOpEException(
"Unknown Type: '" + this->GetType() +
"'!",
3168 "OptProblemContainer::HasFaces");
3175 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3176 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3177 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3178 template<
int,
int>
class DH>
3181 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::HasPoints()
const
3183 if (this->GetType().find(
"constraint") != std::string::npos
3184 || (this->GetType() ==
"functional")
3185 || this->GetType() ==
"aux_functional" || (this->GetType() ==
"state")
3186 || (this->GetType() ==
"tangent"))
3191 else if ((this->GetType() ==
"adjoint")
3192 || (this->GetType() ==
"adjoint_hessian")
3193 || (this->GetType() ==
"hessian"))
3195 return this->GetFunctional()->
HasPoints();
3197 else if (this->GetType() ==
"adjoint_for_ee")
3199 return _aux_functionals[_functional_for_ee_num]->HasPoints();
3201 else if (this->GetType() ==
"gradient")
3203 return this->GetFunctional()->HasPoints();
3207 throw DOpEException(
"Unknown Type: '" + this->GetType() +
"'!",
3208 "OptProblem::HasPoints");
3215 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3216 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3217 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3218 template<
int,
int>
class DH>
3221 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::HasInterfaces()
const
3223 if (this->GetType().find(
"aux_functional") != std::string::npos)
3227 else if (this->GetType().find(
"functional") != std::string::npos)
3231 else if (this->GetType().find(
"constraint") != std::string::npos)
3237 if ((this->GetType() ==
"state") || this->GetType() ==
"adjoint_for_ee"
3238 || (this->GetType() ==
"tangent") || (this->GetType() ==
"gradient")
3239 || (this->GetType() ==
"adjoint")
3240 || (this->GetType() ==
"adjoint_hessian")
3241 || (this->GetType() ==
"hessian"))
3247 throw DOpEException(
"Unknown Type: '" + this->GetType() +
"'!",
3248 "OptProblemContainer::HasFaces");
3255 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3256 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3257 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3258 template<
int,
int>
class DH>
3261 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetControlDirichletBoundaryColors(
3262 unsigned int color,
const std::vector<bool>& comp_mask,
3267 unsigned int comp = _control_dirichlet_colors.size();
3268 for (
unsigned int i = 0; i < _control_dirichlet_colors.size(); ++i)
3270 if (_control_dirichlet_colors[i] == color)
3276 if (comp != _control_dirichlet_colors.size())
3278 std::stringstream s;
3279 s <<
"ControlDirichletColor" << color <<
" has multiple occurences !";
3281 "OptProblemContainer::SetControlDirichletBoundary");
3283 _control_dirichlet_colors.push_back(color);
3284 _control_dirichlet_comps.push_back(comp_mask);
3285 _control_dirichlet_values.push_back(values);
3290 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3291 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3292 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3293 template<
int,
int>
class DH>
3296 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetDirichletBoundaryColors(
3297 unsigned int color,
const std::vector<bool>& comp_mask,
3301 assert(values->n_components() == comp_mask.size());
3303 unsigned int comp = _dirichlet_colors.size();
3304 for (
unsigned int i = 0; i < _dirichlet_colors.size(); ++i)
3306 if (_dirichlet_colors[i] == color)
3312 if (comp != _dirichlet_colors.size())
3314 std::stringstream s;
3315 s <<
"DirichletColor" << color <<
" has multiple occurrences !";
3317 "OptProblemContainer::SetDirichletBoundary");
3319 _dirichlet_colors.push_back(color);
3320 _dirichlet_comps.push_back(comp_mask);
3323 _primal_dirichlet_values.push_back(data);
3326 _tangent_dirichlet_values.push_back(tdata);
3328 if (values->NeedsControl())
3330 _control_transposed_dirichlet_colors.push_back(color);
3334 _transposed_control_gradient_dirichlet_values.push_back(gdata);
3338 _transposed_control_hessian_dirichlet_values.push_back(hdata);
3344 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3345 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3346 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3347 template<
int,
int>
class DH>
3348 const std::vector<unsigned int>&
3350 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDirichletColors()
const
3352 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
3353 || this->GetType() ==
"adjoint_for_ee"
3354 || (this->GetType() ==
"tangent")
3355 || (this->GetType() ==
"adjoint_hessian"))
3357 return _dirichlet_colors;
3359 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian")
3360 || (this->GetType() ==
"global_constraint_gradient"))
3362 return _control_dirichlet_colors;
3367 "OptProblemContainer::GetDirichletColors");
3372 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3373 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3374 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3375 template<
int,
int>
class DH>
3376 const std::vector<unsigned int>&
3378 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetTransposedDirichletColors()
const
3380 if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian"))
3382 return _control_transposed_dirichlet_colors;
3387 "OptProblemContainer::GetTransposedDirichletColors");
3393 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3394 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3395 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3396 template<
int,
int>
class DH>
3397 const std::vector<bool>&
3399 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDirichletCompMask(
3400 unsigned int color)
const
3402 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
3403 || this->GetType() ==
"adjoint_for_ee"
3404 || (this->GetType() ==
"tangent")
3405 || (this->GetType() ==
"adjoint_hessian"))
3407 unsigned int comp = _dirichlet_colors.size();
3408 for (
unsigned int i = 0; i < _dirichlet_colors.size(); ++i)
3410 if (_dirichlet_colors[i] == color)
3416 if (comp == _dirichlet_colors.size())
3418 std::stringstream s;
3419 s <<
"DirichletColor" << color <<
" has not been found !";
3421 "OptProblemContainer::GetDirichletCompMask");
3423 return _dirichlet_comps[comp];
3425 else if ((this->GetType() ==
"gradient")
3426 || (this->GetType() ==
"hessian"))
3428 unsigned int comp = _control_dirichlet_colors.size();
3429 for (
unsigned int i = 0; i < _control_dirichlet_colors.size(); ++i)
3431 if (_control_dirichlet_colors[i] == color)
3437 if (comp == _control_dirichlet_colors.size())
3439 std::stringstream s;
3440 s <<
"ControlDirichletColor" << color <<
" has not been found !";
3442 "OptProblemContainer::GetDirichletCompMask");
3444 return _control_dirichlet_comps[comp];
3449 "OptProblemContainer::GetDirichletCompMask");
3454 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3455 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3456 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3457 template<
int,
int>
class DH>
3458 const std::vector<bool>&
3460 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetTransposedDirichletCompMask(
3461 unsigned int color)
const
3463 if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian"))
3465 unsigned int comp = _dirichlet_colors.size();
3466 for (
unsigned int i = 0; i < _dirichlet_colors.size(); ++i)
3468 if (_dirichlet_colors[i] == color)
3474 if (comp == _dirichlet_colors.size())
3476 std::stringstream s;
3477 s <<
"DirichletColor" << color <<
" has not been found !";
3479 "OptProblemContainer::GetDirichletCompMask");
3481 return _dirichlet_comps[comp];
3486 "OptProblemContainer::GetTransposedDirichletCompMask");
3492 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3493 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3494 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3495 template<
int,
int>
class DH>
3496 const Function<dealdim>&
3498 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDirichletValues(
3500 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
3501 const std::map<std::string, const VECTOR*> &domain_values)
const
3504 unsigned int col = _dirichlet_colors.size();
3505 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
3506 || this->GetType() ==
"adjoint_for_ee"
3507 || (this->GetType() ==
"tangent")
3508 || (this->GetType() ==
"adjoint_hessian"))
3510 for (
unsigned int i = 0; i < _dirichlet_colors.size(); ++i)
3512 if (_dirichlet_colors[i] == color)
3518 if (col == _dirichlet_colors.size())
3520 std::stringstream s;
3521 s <<
"DirichletColor" << color <<
" has not been found !";
3523 "OptProblemContainer::GetDirichletValues");
3526 else if (this->GetType() ==
"gradient" || (this->GetType() ==
"hessian"))
3528 col = _control_dirichlet_colors.size();
3529 for (
unsigned int i = 0; i < _control_dirichlet_colors.size(); ++i)
3531 if (_control_dirichlet_colors[i] == color)
3537 if (col == _control_dirichlet_colors.size())
3539 std::stringstream s;
3540 s <<
"ControlDirichletColor" << color <<
" has not been found !";
3542 "OptProblemContainer::GetDirichletValues");
3548 "OptProblemContainer::GetDirichletValues");
3551 if (this->GetType() ==
"state")
3553 _primal_dirichlet_values[col]->ReInit(param_values, domain_values,
3555 return *(_primal_dirichlet_values[col]);
3557 else if (this->GetType() ==
"tangent")
3559 _tangent_dirichlet_values[col]->ReInit(param_values, domain_values,
3561 return *(_tangent_dirichlet_values[col]);
3563 else if (this->GetType() ==
"adjoint"
3564 || this->GetType() ==
"adjoint_for_ee"
3565 || (this->GetType() ==
"adjoint_hessian"))
3567 return *(_zero_dirichlet_values);
3569 else if (this->GetType() ==
"gradient" || (this->GetType() ==
"hessian"))
3571 return *(_control_dirichlet_values[col]);
3576 "OptProblemContainer::GetDirichletValues");
3581 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3582 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3583 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3584 template<
int,
int>
class DH>
3587 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetTransposedDirichletValues(
3589 const std::map<std::string,
const dealii::Vector<double>*> ¶m_values,
3590 const std::map<std::string, const VECTOR*> &domain_values)
const
3592 unsigned int col = _control_transposed_dirichlet_colors.size();
3593 if (this->GetType() ==
"gradient" || (this->GetType() ==
"hessian"))
3595 for (
unsigned int i = 0;
3596 i < _control_transposed_dirichlet_colors.size(); ++i)
3598 if (_control_transposed_dirichlet_colors[i] == color)
3604 if (col == _control_transposed_dirichlet_colors.size())
3606 std::stringstream s;
3607 s <<
"TransposedControlDirichletColor" << color
3608 <<
" has not been found !";
3610 "OptProblemContainer::GetTransposedDirichletValues");
3616 "OptProblemContainer::GetTransposedDirichletValues");
3619 if (this->GetType() ==
"gradient")
3621 _transposed_control_gradient_dirichlet_values[col]->ReInit(param_values,
3622 domain_values, color);
3623 return *(_transposed_control_gradient_dirichlet_values[col]);
3625 else if (this->GetType() ==
"hessian")
3627 _transposed_control_hessian_dirichlet_values[col]->ReInit(param_values,
3628 domain_values, color);
3629 return *(_transposed_control_hessian_dirichlet_values[col]);
3634 "OptProblemContainer::GetTransposedDirichletValues");
3640 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3641 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3642 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3643 template<
int,
int>
class DH>
3644 const std::vector<unsigned int>&
3646 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetBoundaryEquationColors()
const
3648 if (this->GetType() ==
"state" || this->GetType() ==
"tangent")
3650 return _state_boundary_equation_colors;
3652 else if (this->GetType() ==
"adjoint"
3653 || this->GetType() ==
"adjoint_for_ee"
3654 || this->GetType() ==
"adjoint_hessian")
3656 return _adjoint_boundary_equation_colors;
3658 else if (this->GetType() ==
"gradient" || (this->GetType() ==
"hessian")
3659 || (this->GetType() ==
"global_constraint_gradient"))
3661 return _control_boundary_equation_colors;
3666 "OptProblemContainer::GetBoundaryEquationColors");
3672 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3673 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3674 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3675 template<
int,
int>
class DH>
3678 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetControlBoundaryEquationColors(
3682 unsigned int comp = _control_boundary_equation_colors.size();
3683 for (
unsigned int i = 0; i < _control_boundary_equation_colors.size();
3686 if (_control_boundary_equation_colors[i] == color)
3692 if (comp != _control_boundary_equation_colors.size())
3694 std::stringstream s;
3695 s <<
"Boundary Equation Color" << color
3696 <<
" has multiple occurences !";
3698 "OptProblemContainer::SetControlBoundaryEquationColors");
3700 _control_boundary_equation_colors.push_back(color);
3705 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3706 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3707 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3708 template<
int,
int>
class DH>
3711 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetBoundaryEquationColors(
3715 unsigned int comp = _state_boundary_equation_colors.size();
3716 for (
unsigned int i = 0; i < _state_boundary_equation_colors.size();
3719 if (_state_boundary_equation_colors[i] == color)
3725 if (comp != _state_boundary_equation_colors.size())
3727 std::stringstream s;
3728 s <<
"Boundary Equation Color" << color
3729 <<
" has multiple occurences !";
3731 "OptProblemContainer::SetBoundaryEquationColors");
3733 _state_boundary_equation_colors.push_back(color);
3736 unsigned int comp = _adjoint_boundary_equation_colors.size();
3737 for (
unsigned int i = 0; i < _adjoint_boundary_equation_colors.size();
3740 if (_adjoint_boundary_equation_colors[i] == color)
3746 if (comp != _adjoint_boundary_equation_colors.size())
3753 _adjoint_boundary_equation_colors.push_back(color);
3760 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3761 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3762 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3763 template<
int,
int>
class DH>
3764 const std::vector<unsigned int>&
3766 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetBoundaryFunctionalColors()
const
3768 if (this->GetType() ==
"cost_functional"
3769 || this->GetType() ==
"aux_functional"
3770 || this->GetType() ==
"functional_for_ee")
3772 return _boundary_functional_colors;
3777 "OptProblemContainer::GetBoundaryFunctionalColors");
3783 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3784 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3785 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3786 template<
int,
int>
class DH>
3789 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::SetBoundaryFunctionalColors(
3793 unsigned int comp = _boundary_functional_colors.size();
3794 for (
unsigned int i = 0; i < _boundary_functional_colors.size(); ++i)
3796 if (_boundary_functional_colors[i] == color)
3802 if (comp != _boundary_functional_colors.size())
3804 std::stringstream s;
3805 s <<
"Boundary Functional Color" << color
3806 <<
" has multiple occurences !";
3808 "OptProblemContainer::SetBoundaryFunctionalColors");
3810 _boundary_functional_colors.push_back(color);
3813 unsigned int comp = _adjoint_boundary_equation_colors.size();
3814 for (
unsigned int i = 0; i < _adjoint_boundary_equation_colors.size();
3817 if (_adjoint_boundary_equation_colors[i] == color)
3823 if (comp != _adjoint_boundary_equation_colors.size())
3830 _adjoint_boundary_equation_colors.push_back(color);
3837 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3838 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3839 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3840 template<
int,
int>
class DH>
3843 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetControlNBlocks()
const
3850 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3851 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3852 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3853 template<
int,
int>
class DH>
3856 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetStateNBlocks()
const
3863 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3864 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3865 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3866 template<
int,
int>
class DH>
3869 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetNBlocks()
const
3871 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint_for_ee")
3872 || (this->GetType() ==
"adjoint") || (this->GetType() ==
"tangent")
3873 || (this->GetType() ==
"adjoint_hessian"))
3875 return this->GetStateNBlocks();
3877 else if ((this->GetType() ==
"gradient")
3878 || (this->GetType() ==
"hessian"))
3880 return this->GetControlNBlocks();
3885 "OptProblemContainer::GetNBlocks");
3891 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3892 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3893 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3894 template<
int,
int>
class DH>
3897 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDoFsPerBlock(
3898 unsigned int b)
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 GetSpaceTimeHandler()->GetStateDoFsPerBlock(b);
3907 else if ((this->GetType() ==
"gradient")
3908 || (this->GetType() ==
"hessian"))
3910 return GetSpaceTimeHandler()->GetControlDoFsPerBlock(b);
3915 "OptProblemContainer::GetDoFsPerBlock");
3921 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3922 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3923 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3924 template<
int,
int>
class DH>
3925 const std::vector<unsigned int>&
3927 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDoFsPerBlock()
const
3929 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
3930 || (this->GetType() ==
"adjoint_for_ee")
3931 || (this->GetType() ==
"tangent")
3932 || (this->GetType() ==
"adjoint_hessian"))
3934 return GetSpaceTimeHandler()->GetStateDoFsPerBlock();
3936 else if ((this->GetType() ==
"gradient")
3937 || (this->GetType() ==
"hessian"))
3939 return GetSpaceTimeHandler()->GetControlDoFsPerBlock();
3944 "OptProblemContainer::GetDoFsPerBlock");
3950 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3951 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3952 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3953 template<
int,
int>
class DH>
3954 const dealii::ConstraintMatrix&
3956 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::GetDoFConstraints()
const
3958 if ((this->GetType() ==
"state") || (this->GetType() ==
"adjoint")
3959 || (this->GetType() ==
"adjoint_for_ee")
3960 || (this->GetType() ==
"tangent")
3961 || (this->GetType() ==
"adjoint_hessian"))
3963 return GetSpaceTimeHandler()->GetStateDoFConstraints();
3965 else if ((this->GetType() ==
"gradient") || (this->GetType() ==
"hessian")
3966 || (this->GetType() ==
"global_constraint_gradient"))
3968 return GetSpaceTimeHandler()->GetControlDoFConstraints();
3973 "OptProblemContainer::GetDoFConstraints");
3979 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
3980 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
3981 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
3982 template<
int,
int>
class DH>
3985 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::NeedTimeFunctional()
const
3987 if (this->GetType() ==
"cost_functional")
3988 return GetFunctional()->NeedTime();
3989 else if (this->GetType() ==
"aux_functional")
3990 return _aux_functionals[this->GetTypeNum()]->NeedTime();
3991 else if (this->GetType() ==
"functional_for_ee")
3992 return _aux_functionals[_functional_for_ee_num]->NeedTime();
3995 "OptProblemContainer::NeedTimeFunctional");
4000 template<
typename FUNCTIONAL_INTERFACE,
typename FUNCTIONAL,
typename PDE,
4001 typename DD,
typename CONSTRAINTS,
typename SPARSITYPATTERN,
4002 typename VECTOR,
int dopedim,
int dealdim,
template<
int,
int>
class FE,
4003 template<
int,
int>
class DH>
4006 SPARSITYPATTERN, VECTOR, dopedim, dealdim, FE, DH>::HasControlInDirichletData()
const
4008 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:2353
void DeleteAuxiliaryState(std::string name)
Definition: optproblemcontainer.h:3048
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:1115
OptProblemContainer(FUNCTIONAL &functional, PDE &pde, CONSTRAINTS &constraints, SpaceTimeHandler< FE, DH, SPARSITYPATTERN, VECTOR, dopedim, dealdim > &STH)
Definition: optproblemcontainer.h:1294
void BoundaryEquation(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:1936
dealii::UpdateFlags GetUpdateFlags() const
Definition: optproblemcontainer.h:2670
Definition: stateproblem.h:48
const ConstraintVector< VECTOR > * GetAuxiliaryConstraint(std::string name)
Definition: optproblemcontainer.h:910
void SetTime(double time, const TimeIterator &interval)
Definition: optproblemcontainer.h:2814
unsigned int GetNFunctionals() const
Definition: optproblemcontainer.h:754
double FaceFunctional(const FACEDATACONTAINER &fdc)
Definition: optproblemcontainer.h:1615
void Init_ElementEquation(const DATACONTAINER &edc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:1050
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:2263
Definition: constraintvector.h:47
double AlgebraicFunctional(const std::map< std::string, const dealii::Vector< double > * > &values, const std::map< std::string, const VECTOR * > &block_values)
Definition: optproblemcontainer.h:1648
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:2578
void ElementTimeMatrixExplicit(const DATACONTAINER &dc, dealii::FullMatrix< double > &local_entry_matrix)
Definition: optproblemcontainer.h:2433
void ElementTimeEquationExplicit(const DATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:1806
const std::vector< unsigned int > & GetBoundaryFunctionalColors() const
Definition: optproblemcontainer.h:3766
void ElementRhs(const DATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:1987
void ReInit(std::string algo_type)
Definition: optproblemcontainer.h:1360
const VECTOR * GetBlockVector(const std::map< std::string, const VECTOR * > &values, std::string name)
Definition: optproblemcontainer.h:1211
Definition: dopetypes.h:106
const dealii::Function< dealdim > & GetInitialValues() const
Definition: optproblemcontainer.h:662
const FE< dealdim, dealdim > & GetFESystem() const
Definition: optproblemcontainer.h:2635
void PostProcessConstraints(ConstraintVector< VECTOR > &g) const
Definition: optproblemcontainer.h:2910
dealii::UpdateFlags GetFaceUpdateFlags() const
Definition: optproblemcontainer.h:2715
std::string GetFunctionalType() const
Definition: optproblemcontainer.h:2759
void AddFunctional(FUNCTIONAL_INTERFACE *F)
Definition: optproblemcontainer.h:692
FUNCTIONAL * GetFunctional()
Definition: optproblemcontainer.h:3092
Definition: tangentdirichletdata.h:39
bool HasInterfaces() const
Definition: optproblemcontainer.h:3221
double BoundaryFunctional(const FACEDATACONTAINER &fdc)
Definition: optproblemcontainer.h:1577
double ElementFunctional(const DATACONTAINER &edc)
Definition: optproblemcontainer.h:1487
std::string GetType() const
Definition: problemcontainer_internal.h:109
const std::vector< unsigned int > & GetBoundaryEquationColors() const
Definition: optproblemcontainer.h:3646
void SetDirichletBoundaryColors(unsigned int color, const std::vector< bool > &comp_mask, const DD *values)
Definition: optproblemcontainer.h:3296
const std::vector< unsigned int > & GetDoFsPerBlock() const
Definition: optproblemcontainer.h:3927
void SetControlBoundaryEquationColors(unsigned int color)
Definition: optproblemcontainer.h:3678
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:2093
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:2923
const std::vector< unsigned int > & GetDirichletColors() const
Definition: optproblemcontainer.h:3350
bool HasPoints() const
Definition: optproblemcontainer.h:3181
std::string GetDoFType() const
Definition: optproblemcontainer.h:2607
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:1685
void ElementTimeEquation(const DATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:1762
const std::vector< bool > & GetDirichletCompMask(unsigned int color) const
Definition: optproblemcontainer.h:3399
void SetType(std::string type, unsigned int num=0)
Definition: optproblemcontainer.h:1402
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:1523
Definition: timeiterator.h:63
unsigned int GetNBlocks() const
Definition: optproblemcontainer.h:3869
const StateVector< VECTOR > * GetAuxiliaryState(std::string name) const
Definition: optproblemcontainer.h:3005
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:3498
Definition: controlvector.h:48
void Init_ElementMatrix(const DATACONTAINER &edc, dealii::FullMatrix< double > &local_entry_matrix, double scale, double scale_ico)
Definition: optproblemcontainer.h:1165
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:1189
const dealii::ConstraintMatrix & GetDoFConstraints() const
Definition: optproblemcontainer.h:3956
std::string GetConstraintType() const
Definition: optproblemcontainer.h:2801
Definition: optproblemcontainer.h:101
unsigned int GetStateNBlocks()
Definition: optproblemcontainer.h:1025
void FaceEquation(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:1854
void AddAuxiliaryConstraint(const ConstraintVector< VECTOR > *c, std::string name)
Definition: optproblemcontainer.h:2964
const ControlVector< VECTOR > * GetAuxiliaryControl(std::string name) const
Definition: optproblemcontainer.h:2984
DOpEExceptionHandler< VECTOR > * GetExceptionHandler()
Definition: optproblemcontainer.h:813
void FaceRhs(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale=1.)
Definition: optproblemcontainer.h:2175
const SpaceTimeHandler< FE, DH, SPARSITYPATTERN, VECTOR, dopedim, dealdim > * GetSpaceTimeHandler() const
Definition: optproblemcontainer.h:843
void RegisterExceptionHandler(DOpEExceptionHandler< VECTOR > *OH)
Definition: optproblemcontainer.h:172
Definition: transposedhessiandirichletdata.h:41
CONSTRAINTS * GetConstraints()
Definition: optproblemcontainer.h:1200
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:975
const dealii::Vector< double > * GetVector(const std::map< std::string, const Vector< double > * > &values, std::string name)
Definition: optproblemcontainer.h:1224
SpaceTimeHandler< FE, DH, SPARSITYPATTERN, VECTOR, dopedim, dealdim > * GetSpaceTimeHandler()
Definition: optproblemcontainer.h:851
const CONSTRAINTS * GetConstraints() const
Definition: optproblemcontainer.h:1205
bool HasFaces() const
Definition: optproblemcontainer.h:3133
Definition: primaldirichletdata.h:41
const std::vector< unsigned int > & GetTransposedDirichletColors() const
Definition: optproblemcontainer.h:3378
Definition: statevector.h:49
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:3587
void ComputeSparsityPattern(SPARSITYPATTERN &sparsity) const
Definition: optproblemcontainer.h:2876
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:1735
void InterfaceEquation(const FACEDATACONTAINER &dc, dealii::Vector< double > &local_vector, double scale, double scale_ico)
Definition: optproblemcontainer.h:1904
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:3856
std::vector< unsigned int > & GetControlBlockComponent()
Definition: optproblemcontainer.h:1033
void AddAuxiliaryState(const StateVector< VECTOR > *c, std::string name)
Definition: optproblemcontainer.h:2944
bool NeedTimeFunctional() const
Definition: optproblemcontainer.h:3985
std::string GetFunctionalName() const
Definition: optproblemcontainer.h:2780
Definition: transposeddirichletdatainterface.h:37
unsigned int GetControlNBlocks() const
Definition: optproblemcontainer.h:3843
const std::vector< bool > & GetTransposedDirichletCompMask(unsigned int color) const
Definition: optproblemcontainer.h:3460
~OptProblemContainer()
Definition: optproblemcontainer.h:1317
bool HasControlInDirichletData() const
Definition: optproblemcontainer.h:4006
std::vector< unsigned int > & GetStateBlockComponent()
Definition: optproblemcontainer.h:1040
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:925
void SetBoundaryEquationColors(unsigned int color)
Definition: optproblemcontainer.h:3711
void SetControlDirichletBoundaryColors(unsigned int color, const std::vector< bool > &comp_mask, const DOpEWrapper::Function< dealdim > *values)
Definition: optproblemcontainer.h:3261
void DeleteAuxiliaryConstraint(std::string name)
Definition: optproblemcontainer.h:3070
const std::map< std::string, unsigned int > & GetFunctionalPosition() const
Definition: optproblemcontainer.h:1019
void SetBoundaryFunctionalColors(unsigned int color)
Definition: optproblemcontainer.h:3789
void DeleteAuxiliaryControl(std::string name)
Definition: optproblemcontainer.h:3026
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:1069
void InterfaceMatrix(const FACEDATACONTAINER &dc, dealii::FullMatrix< double > &local_entry_matrix, double scale=1., double scale_ico=1.)
Definition: optproblemcontainer.h:72