1 #include "identity_parameterization.hpp" 2 #include <deal.II/dofs/dof_tools.h> 3 #include <deal.II/lac/dynamic_sparsity_pattern.h> 4 #include <deal.II/lac/sparsity_tools.h> 18 current_volume_nodes = design_var;
19 design_var.update_ghost_values();
20 current_volume_nodes.update_ghost_values();
27 const dealii::IndexSet &volume_range = this->
high_order_grid->volume_nodes.get_partitioner()->locally_owned_range();
28 const unsigned int n_vol_nodes = this->
high_order_grid->volume_nodes.size();
29 dealii::DynamicSparsityPattern dsp(n_vol_nodes, n_vol_nodes, volume_range);
31 for(
unsigned int i=0; i<n_vol_nodes; ++i)
33 if(!volume_range.is_element(i))
continue;
37 dealii::IndexSet locally_relevant_dofs;
38 dealii::DoFTools::extract_locally_relevant_dofs(this->
high_order_grid->dof_handler_grid, locally_relevant_dofs);
40 dealii::SparsityTools::distribute_sparsity_pattern(dsp, volume_range, this->
mpi_communicator, locally_relevant_dofs);
44 for(
unsigned int i=0; i<n_vol_nodes; ++i)
46 if(!volume_range.is_element(i))
continue;
50 dXv_dXp.compress(dealii::VectorOperation::insert);
58 AssertDimension(dXv_dXp.n(), design_var.size());
62 if(!(design_variable_has_changed))
68 current_volume_nodes = design_var;
bool has_design_variable_been_updated(const VectorType ¤t_design_var, const VectorType &updated_design_var) const
Checks if the design variable has changed.
void compute_dXv_dXp(MatrixType &dXv_dXp) const override
Computes the derivative of volume nodes w.r.t. design parameters. Overrides the virtual function in b...
Files for the baseline physics.
dealii::TrilinosWrappers::SparseMatrix MatrixType
Alias for dealii::TrilinosWrappers::SparseMatrix.
Abstract class for design parameterization. Objective function and the constraints take this class's ...
bool update_mesh_from_design_variables(const MatrixType &dXv_dXp, const VectorType &design_var) override
Checks if the design variables have changed and updates volume nodes.
unsigned int get_number_of_design_variables() const override
Returns the number of design variables (i.e. total no. of volume nodes on all processors).
Identity design parameterization. Control variables are all volume nodes.
MPI_Comm mpi_communicator
Alias for MPI_COMM_WORLD.
std::shared_ptr< HighOrderGrid< dim, double > > high_order_grid
Pointer to high order grid.
dealii::LinearAlgebra::distributed::Vector< double > VectorType
Alias for dealii's parallel distributed vector.
void initialize_design_variables(VectorType &design_var) override
Initializes design variables with volume nodes and set locally owned and ghost indices. Overrides the virtual function in base class.
IdentityParameterization(std::shared_ptr< HighOrderGrid< dim, double >> _high_order_grid)
Constructor.