13 #ifndef __appframe__optimization_block_application_h
14 #define __appframe__optimization_block_application_h
16 #include <base/parameter_handler.h>
17 #include <lac/vector.h>
18 #include <lac/block_vector.h>
19 #include <grid/grid_refinement.h>
20 #include <grid/grid_tools.h>
21 #include <grid/persistent_tria.h>
22 #include <dofs/dof_handler.h>
23 #include <dofs/dof_renumbering.h>
25 #include <fe/fe_values.h>
26 #include <numerics/solution_transfer.h>
27 #include <boost/shared_ptr.hpp>
72 SmartPointer<OptimizationBlockMatrixApplication<dim> >
app;
137 boost::shared_ptr<AppFrame::ApplicationData>());
151 bool triangulation_only);
170 virtual void set_parameters(
const std::vector<std::string>& name_dvar,
171 const std::vector<double>& value_dvar,
172 ParameterHandler& param);
176 virtual void initialize(ParameterHandler& param);
189 virtual void responses (std::vector<double>& f,
229 virtual void dresponses_dl (std::vector<std::vector<double> >& df_dl,
261 virtual void dresponses_du(std::vector<AppFrame::FEVector>& dst,
270 std::vector<std::vector<double> >& src);
303 std::vector<std::vector<double> >& src);
316 void solve_direct (std::vector<std::vector<double> >& df_dl,
330 void solve_adjoint (std::vector<std::vector<double> >& df_dl,
366 ParameterHandler prm;
369 file.open(
"Default_parameter_file.prm");
370 prm.print_parameters (file, ParameterHandler::Text);
407 for (
unsigned int i=0; i<
n_resp; ++i)
408 for (
unsigned int j=0; j<
n_dvar; ++j)
409 std::cout<<
"Df"<<i<<
"/Dl"<<j<<
" is equal to "<<pdf_pdl[i][j]<<std::endl;
420 for (
unsigned int r=0; r<
n_resp; ++r)
423 unsigned int n_blocks = df_du[r].n_blocks();
424 unsigned int size = df_du[r].size();
425 unsigned int comp_per_block = size/n_blocks;
426 for (
unsigned int i=0; i<n_blocks; ++i)
427 for (
unsigned int j=0; j<comp_per_block; ++j)
429 std::cout<<
"Element "<<j<<
" in block "<<i<<
" in STEP (Du) is "<<df_du[r].block(i)(j)<<std::endl;
431 std::cout<<
"NORM OF Df"<<r<<
"/Du = "<<df_du[r].l2_norm()<<std::endl;
442 std::vector<std::vector<double> >& );
453 void dfunction (std::vector<AppFrame::FEVector>& dst,