34 void cont_struct_getfem_model::set_variables
35 (
const base_vector &x,
double gamma)
const {
36 md->set_real_variable(parameter_name)[0] = gamma;
37 if (!currentdata_name.empty()) {
38 gmm::add(gmm::scaled(md->real_variable(initdata_name), 1. - gamma),
39 gmm::scaled(md->real_variable(finaldata_name), gamma),
40 md->set_real_variable(currentdata_name));
45 void cont_struct_getfem_model::update_matrix
46 (
const base_vector &x,
double gamma)
const {
47 set_variables(x, gamma);
48 if (noisy() > 2) cout <<
"starting computing tangent matrix" << endl;
49 md->assembly(model::BUILD_MATRIX);
53 void cont_struct_getfem_model::solve
54 (
const model_real_sparse_matrix &A, base_vector &g,
55 const base_vector &L)
const {
56 if (noisy() > 2) cout <<
"starting linear solver" << endl;
57 gmm::iteration iter(maxres_solve, (noisy() >= 2) ? noisy() - 2 : 0,
59 (*lsolver)(A, g, L, iter);
60 if (noisy() > 2) cout <<
"linear solver done" << endl;
64 void cont_struct_getfem_model::solve
65 (
const model_real_sparse_matrix &A, base_vector &g1, base_vector &g2,
66 const base_vector &L1,
const base_vector &L2)
const {
67 if (noisy() > 2) cout <<
"starting linear solver" << endl;
68 gmm::iteration iter(maxres_solve, (noisy() >= 2) ? noisy() - 2 : 0,
70 (*lsolver)(A, g1, L1, iter);
71 iter.init(); (*lsolver)(A, g2, L2, iter);
72 if (noisy() > 2) cout <<
"linear solver done" << endl;
76 void cont_struct_getfem_model::F
77 (
const base_vector &x,
double gamma, base_vector &f)
const {
78 set_variables(x, gamma);
79 md->assembly(model::BUILD_RHS);
80 gmm::copy(gmm::scaled(md->real_rhs(), -1.), f);
84 void cont_struct_getfem_model::F_gamma
85 (
const base_vector &x,
double gamma,
const base_vector &f0,
86 base_vector &g)
const {
87 const double eps = diffeps;
90 gmm::scale(g, 1./eps);
94 void cont_struct_getfem_model::F_gamma
95 (
const base_vector &x,
double gamma, base_vector &g)
const {
98 F_gamma(x, gamma, f0, g);
102 void cont_struct_getfem_model::F_x
103 (
const base_vector &x,
double gamma, model_real_sparse_matrix &A)
const {
104 update_matrix(x, gamma);
111 void cont_struct_getfem_model::solve_grad
112 (
const base_vector &x,
double gamma, base_vector &g,
113 const base_vector &L)
const {
114 update_matrix(x, gamma);
115 solve(md->real_tangent_matrix(), g, L);
121 void cont_struct_getfem_model::solve_grad
122 (
const base_vector &x,
double gamma, base_vector &g1, base_vector &g2,
123 const base_vector &L1,
const base_vector &L2)
const {
124 update_matrix(x, gamma);
125 solve(md->real_tangent_matrix(), g1, g2, L1, L2);
129 void cont_struct_getfem_model::mult_grad
130 (
const base_vector &x,
double gamma,
131 const base_vector &w, base_vector &y)
const {
132 update_matrix(x, gamma);
133 mult(md->real_tangent_matrix(), w, y);
136 size_type cont_struct_getfem_model::estimated_memsize(
void) {
137 return sizeof(cont_struct_getfem_model)
138 + virtual_cont_struct::estimated_memsize();
The Iteration object calculates whether the solution has reached the desired accuracy,...
Inexact Moore-Penrose continuation method.
void copy(const L1 &l1, L2 &l2)
*/
void resize(V &v, size_type n)
*/
void mult(const L1 &l1, const L2 &l2, L3 &l3)
*/
void add(const L1 &l1, L2 &l2)
*/
size_t size_type
used as the common size type in the library
GEneric Tool for Finite Element Methods.