33 void cont_struct_getfem_model::set_variables
34 (
const base_vector &x,
double gamma)
const {
35 md->set_real_variable(parameter_name)[0] = gamma;
36 if (!currentdata_name.empty()) {
37 gmm::add(gmm::scaled(md->real_variable(initdata_name), 1. - gamma),
38 gmm::scaled(md->real_variable(finaldata_name), gamma),
39 md->set_real_variable(currentdata_name));
44 void cont_struct_getfem_model::update_matrix
45 (
const base_vector &x,
double gamma)
const {
46 set_variables(x, gamma);
47 if (noisy() > 2) cout <<
"starting computing tangent matrix" << endl;
48 md->assembly(model::BUILD_MATRIX);
52 void cont_struct_getfem_model::solve
53 (
const model_real_sparse_matrix &A, base_vector &g,
54 const base_vector &L)
const {
55 if (noisy() > 2) cout <<
"starting linear solver" << endl;
56 gmm::iteration iter(maxres_solve, (noisy() >= 2) ? noisy() - 2 : 0,
58 (*lsolver)(A, g, L, iter);
59 if (noisy() > 2) cout <<
"linear solver done" << endl;
63 void cont_struct_getfem_model::solve
64 (
const model_real_sparse_matrix &A, base_vector &g1, base_vector &g2,
65 const base_vector &L1,
const base_vector &L2)
const {
66 if (noisy() > 2) cout <<
"starting linear solver" << endl;
67 gmm::iteration iter(maxres_solve, (noisy() >= 2) ? noisy() - 2 : 0,
69 (*lsolver)(A, g1, L1, iter);
70 iter.init(); (*lsolver)(A, g2, L2, iter);
71 if (noisy() > 2) cout <<
"linear solver done" << endl;
75 void cont_struct_getfem_model::F
76 (
const base_vector &x,
double gamma, base_vector &f)
const {
77 set_variables(x, gamma);
78 md->assembly(model::BUILD_RHS);
79 gmm::copy(gmm::scaled(md->real_rhs(), -1.), f);
83 void cont_struct_getfem_model::F_gamma
84 (
const base_vector &x,
double gamma,
const base_vector &f0,
85 base_vector &g)
const {
86 const double eps = diffeps;
89 gmm::scale(g, 1./eps);
93 void cont_struct_getfem_model::F_gamma
94 (
const base_vector &x,
double gamma, base_vector &g)
const {
97 F_gamma(x, gamma, f0, g);
101 void cont_struct_getfem_model::F_x
102 (
const base_vector &x,
double gamma, model_real_sparse_matrix &A)
const {
103 update_matrix(x, gamma);
110 void cont_struct_getfem_model::solve_grad
111 (
const base_vector &x,
double gamma, base_vector &g,
112 const base_vector &L)
const {
113 update_matrix(x, gamma);
114 solve(md->real_tangent_matrix(), g, L);
120 void cont_struct_getfem_model::solve_grad
121 (
const base_vector &x,
double gamma, base_vector &g1, base_vector &g2,
122 const base_vector &L1,
const base_vector &L2)
const {
123 update_matrix(x, gamma);
124 solve(md->real_tangent_matrix(), g1, g2, L1, L2);
128 void cont_struct_getfem_model::mult_grad
129 (
const base_vector &x,
double gamma,
130 const base_vector &w, base_vector &y)
const {
131 update_matrix(x, gamma);
132 mult(md->real_tangent_matrix(), w, y);
135 size_type cont_struct_getfem_model::estimated_memsize(
void) {
136 return sizeof(cont_struct_getfem_model)
137 + 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.