PolyFEM
Loading...
Searching...
No Matches
ParametrizedProductForm.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
polyfem/solver/forms/adjoint_forms/ParametrizationForm.hpp
>
4
#include "
VariableToSimulation.hpp
"
5
6
namespace
polyfem::solver
7
{
8
// computes the product of a parametrized vector
9
class
ParametrizedProductForm
:
public
ParametrizationForm
10
{
11
public
:
12
ParametrizedProductForm
(
CompositeParametrization
&¶metrizations) :
ParametrizationForm
(std::move(parametrizations))
13
{
14
}
15
16
protected
:
17
inline
double
value_unweighted_with_param
(
const
Eigen::VectorXd &
x
)
const override
18
{
19
return
x
.prod();
20
}
21
22
inline
void
compute_partial_gradient_with_param
(
const
Eigen::VectorXd &
x
, Eigen::VectorXd &gradv)
const override
23
{
24
gradv.setOnes(
x
.size());
25
for
(
int
i = 0; i <
x
.size(); i++)
26
{
27
for
(
int
j = 0; j <
x
.size(); j++)
28
{
29
if
(j != i)
30
gradv(i) *=
x
(j);
31
}
32
}
33
gradv *=
weight
();
34
}
35
};
36
}
// namespace polyfem::solver
ParametrizationForm.hpp
x
int x
Definition
SplineBasis3d.cpp:55
VariableToSimulation.hpp
polyfem::solver::CompositeParametrization
Definition
Parametrization.hpp:27
polyfem::solver::Form::weight
virtual double weight() const
Get the form's multiplicative constant weight.
Definition
Form.hpp:126
polyfem::solver::ParametrizationForm
Definition
ParametrizationForm.hpp:15
polyfem::solver::ParametrizedProductForm
Definition
ParametrizedProductForm.hpp:10
polyfem::solver::ParametrizedProductForm::compute_partial_gradient_with_param
void compute_partial_gradient_with_param(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override
Definition
ParametrizedProductForm.hpp:22
polyfem::solver::ParametrizedProductForm::value_unweighted_with_param
double value_unweighted_with_param(const Eigen::VectorXd &x) const override
Definition
ParametrizedProductForm.hpp:17
polyfem::solver::ParametrizedProductForm::ParametrizedProductForm
ParametrizedProductForm(CompositeParametrization &¶metrizations)
Definition
ParametrizedProductForm.hpp:12
polyfem::solver
Definition
OptState.hpp:16
src
polyfem
solver
forms
adjoint_forms
ParametrizedProductForm.hpp
Generated by
1.9.8