oomph::AugmentedBlockFoldLinearSolver Class Reference

#include <assembly_handler.h>

+ Inheritance diagram for oomph::AugmentedBlockFoldLinearSolver:

Public Member Functions

 AugmentedBlockFoldLinearSolver (LinearSolver *const linear_solver_pt)
 Constructor, inherits the original linear solver. More...
 
 ~AugmentedBlockFoldLinearSolver ()
 Destructor: clean up the allocated memory. More...
 
void solve (Problem *const &problem_pt, DoubleVector &result)
 The solve function uses the block factorisation. More...
 
void solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result)
 
void solve (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result)
 
void resolve (const DoubleVector &rhs, DoubleVector &result)
 The resolve function also uses the block factorisation. More...
 
LinearSolverlinear_solver_pt () const
 Access function to the original linear solver. More...
 
- Public Member Functions inherited from oomph::LinearSolver
 LinearSolver ()
 Empty constructor, initialise the member data. More...
 
 LinearSolver (const LinearSolver &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const LinearSolver &)=delete
 Broken assignment operator. More...
 
virtual ~LinearSolver ()
 Empty virtual destructor. More...
 
void enable_doc_time ()
 Enable documentation of solve times. More...
 
void disable_doc_time ()
 Disable documentation of solve times. More...
 
bool is_doc_time_enabled () const
 Is documentation of solve times enabled? More...
 
bool is_resolve_enabled () const
 Boolean flag indicating if resolves are enabled. More...
 
virtual void enable_resolve ()
 
virtual void disable_resolve ()
 
virtual void solve_transpose (Problem *const &problem_pt, DoubleVector &result)
 
virtual void solve_transpose (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result)
 
virtual void solve_transpose (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result)
 
virtual void resolve_transpose (const DoubleVector &rhs, DoubleVector &result)
 
virtual void clean_up_memory ()
 
virtual double jacobian_setup_time () const
 
virtual double linear_solver_solution_time () const
 
virtual void enable_computation_of_gradient ()
 
void disable_computation_of_gradient ()
 
void reset_gradient ()
 
void get_gradient (DoubleVector &gradient)
 function to access the gradient, provided it has been computed More...
 
- Public Member Functions inherited from oomph::DistributableLinearAlgebraObject
 DistributableLinearAlgebraObject ()
 Default constructor - create a distribution. More...
 
 DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete
 Broken copy constructor. More...
 
void operator= (const DistributableLinearAlgebraObject &)=delete
 Broken assignment operator. More...
 
virtual ~DistributableLinearAlgebraObject ()
 Destructor. More...
 
LinearAlgebraDistributiondistribution_pt () const
 access to the LinearAlgebraDistribution More...
 
unsigned nrow () const
 access function to the number of global rows. More...
 
unsigned nrow_local () const
 access function for the num of local rows on this processor. More...
 
unsigned nrow_local (const unsigned &p) const
 access function for the num of local rows on this processor. More...
 
unsigned first_row () const
 access function for the first row on this processor More...
 
unsigned first_row (const unsigned &p) const
 access function for the first row on this processor More...
 
bool distributed () const
 distribution is serial or distributed More...
 
bool distribution_built () const
 
void build_distribution (const LinearAlgebraDistribution *const dist_pt)
 
void build_distribution (const LinearAlgebraDistribution &dist)
 

Private Attributes

LinearSolverLinear_solver_pt
 Pointer to the original linear solver. More...
 
ProblemProblem_pt
 
DoubleVectorAlpha_pt
 Pointer to the storage for the vector alpha. More...
 
DoubleVectorE_pt
 Pointer to the storage for the vector e. More...
 

Additional Inherited Members

- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 
- Protected Attributes inherited from oomph::LinearSolver
bool Enable_resolve
 
bool Doc_time
 Boolean flag that indicates whether the time taken. More...
 
bool Compute_gradient
 
bool Gradient_has_been_computed
 flag that indicates whether the gradient was computed or not More...
 
DoubleVector Gradient_for_glob_conv_newton_solve
 

Detailed Description

A custom linear solver class that is used to solve a block-factorised version of the Fold bifurcation detection problem.

Constructor & Destructor Documentation

◆ AugmentedBlockFoldLinearSolver()

oomph::AugmentedBlockFoldLinearSolver::AugmentedBlockFoldLinearSolver ( LinearSolver *const  linear_solver_pt)
inline

Constructor, inherits the original linear solver.

414  {
415  }
LinearSolver * Linear_solver_pt
Pointer to the original linear solver.
Definition: assembly_handler.h:399
LinearSolver * linear_solver_pt() const
Access function to the original linear solver.
Definition: assembly_handler.h:451
Problem * Problem_pt
Definition: assembly_handler.h:402
DoubleVector * E_pt
Pointer to the storage for the vector e.
Definition: assembly_handler.h:408
DoubleVector * Alpha_pt
Pointer to the storage for the vector alpha.
Definition: assembly_handler.h:405

◆ ~AugmentedBlockFoldLinearSolver()

oomph::AugmentedBlockFoldLinearSolver::~AugmentedBlockFoldLinearSolver ( )

Destructor: clean up the allocated memory.

Clean up the memory that may have been allocated by the solver.

390  {
391  if (Alpha_pt != 0)
392  {
393  delete Alpha_pt;
394  }
395  if (E_pt != 0)
396  {
397  delete E_pt;
398  }
399  }

References Alpha_pt, and E_pt.

Member Function Documentation

◆ linear_solver_pt()

LinearSolver* oomph::AugmentedBlockFoldLinearSolver::linear_solver_pt ( ) const
inline

Access function to the original linear solver.

452  {
453  return Linear_solver_pt;
454  }

References Linear_solver_pt.

Referenced by oomph::FoldHandler::~FoldHandler().

◆ resolve()

void oomph::AugmentedBlockFoldLinearSolver::resolve ( const DoubleVector rhs,
DoubleVector result 
)
virtual

The resolve function also uses the block factorisation.

Reimplemented from oomph::LinearSolver.

679  {
680  // Check that the factors have been stored
681  if (Alpha_pt == 0)
682  {
683  throw OomphLibError("The required vectors have not been stored",
686  }
687 
688  // Get the pointer to the problem
689  Problem* const problem_pt = Problem_pt;
690 
691  FoldHandler* handler_pt =
692  static_cast<FoldHandler*>(problem_pt->assembly_handler_pt());
693 
694  // Switch things to our block solver
695  handler_pt->solve_augmented_block_system();
696 
697  // We need to find out the number of dofs in the problem
698  unsigned n_dof = problem_pt->ndof();
699 
700 #ifdef PARANOID
701  // if the result is setup then it should not be distributed
702  if (result.built())
703  {
704  if (result.distributed())
705  {
706  throw OomphLibError("The result vector must not be distributed",
709  }
710  }
711  // the rhs must be setup
712  if (!rhs.built())
713  {
714  throw OomphLibError("The rhs vector must be setup",
717  }
718 #endif
719 
720  // if the result vector is not setup then rebuild with distribution = global
721  if (!result.built())
722  {
723  result.build(rhs.distribution_pt(), 0.0);
724  }
725 
726  // Setup storage
727  DoubleVector a(this->distribution_pt(), 0.0),
728  b(this->distribution_pt(), 0.0);
729 
730  // Set the values of the a vector
731  for (unsigned n = 0; n < (n_dof - 1); n++)
732  {
733  a[n] = rhs[n];
734  }
735  // The entry associated with the additional parameter is zero
736  a[n_dof - 1] = 0.0;
737 
739 
740  // Copy rhs vector into local storage so it doesn't get overwritten
741  // if the linear solver decides to initialise the solution vector, say,
742  // which it's quite entitled to do!
743  DoubleVector input_a(a);
744 
745  Linear_solver_pt->resolve(input_a, a);
746 
747  // We can now construct our multipliers
748  // Prepare to scale
749  double dof_length = 0.0, a_length = 0.0;
750  for (unsigned n = 0; n < n_dof; n++)
751  {
752  if (std::fabs(problem_pt->dof(n)) > dof_length)
753  {
754  dof_length = std::fabs(problem_pt->dof(n));
755  }
756 
757  if (std::fabs(a[n]) > a_length)
758  {
759  a_length = std::fabs(a[n]);
760  }
761  }
762  double a_mult = dof_length / a_length;
763  const double FD_step = 1.0e-8;
764  a_mult += FD_step;
765  a_mult *= FD_step;
766 
767  DoubleVector Jprod_a(this->distribution_pt(), 0.0);
768 
769  unsigned long n_element = problem_pt->mesh_pt()->nelement();
770  for (unsigned long e = 0; e < n_element; e++)
771  {
772  GeneralisedElement* elem_pt = problem_pt->mesh_pt()->element_pt(e);
773  // Loop over the ndofs in each element
774  unsigned n_var = handler_pt->ndof(elem_pt);
775  // Get some jacobian matrices
776  DenseMatrix<double> jac(n_var), jac_a(n_var);
777  // the elemental residual
778  Vector<double> res_elemental(n_var);
779  // Get unperturbed jacobian
780  handler_pt->get_jacobian(elem_pt, res_elemental, jac);
781 
782  // Backup the dofs
783  Vector<double> dof_bac(n_var);
784  // Perturb the dofs
785  for (unsigned n = 0; n < n_var; n++)
786  {
787  unsigned eqn_number = handler_pt->eqn_number(elem_pt, n);
788  dof_bac[n] = problem_pt->dof(eqn_number);
789  // Pertub by vector a
790  problem_pt->dof(eqn_number) += a_mult * a[eqn_number];
791  }
792 
793  problem_pt->actions_after_change_in_bifurcation_parameter();
794 
795  // Now get the new jacobian
796  handler_pt->get_jacobian(elem_pt, res_elemental, jac_a);
797 
798  // Reset the dofs
799  for (unsigned n = 0; n < n_var; n++)
800  {
801  unsigned eqn_number = handler_pt->eqn_number(elem_pt, n);
802  problem_pt->dof(eqn_number) = dof_bac[n];
803  }
804 
805  problem_pt->actions_after_change_in_bifurcation_parameter();
806 
807  // OK, now work out the products
808  for (unsigned n = 0; n < (n_var - 1); n++)
809  {
810  unsigned eqn_number = handler_pt->eqn_number(elem_pt, n);
811  double prod_a = 0.0;
812  for (unsigned m = 0; m < (n_var - 1); m++)
813  {
814  unsigned unknown = handler_pt->eqn_number(elem_pt, m);
815  prod_a += (jac_a(n, m) - jac(n, m)) * handler_pt->Y[unknown];
816  }
817  Jprod_a[eqn_number] += prod_a / a_mult;
818  }
819  }
820 
821  Jprod_a[n_dof - 1] = 0.0;
822 
823  // OK, now we can formulate the next vectors
824  for (unsigned n = 0; n < n_dof - 1; n++)
825  {
826  b[n] = rhs[n_dof + n] - Jprod_a[n];
827  }
828  // The residuals for the final entry should be those associated
829  // with the parameter
830  b[n_dof - 1] = rhs[n_dof - 1];
831 
832  DoubleVector f(this->distribution_pt(), 0.0);
833 
835 
836  // Calculate the final entry in the vector d
837  const double d_final = f[n_dof - 1] / (*E_pt)[n_dof - 1];
838  // Assemble the final corrections
839  for (unsigned n = 0; n < n_dof - 1; n++)
840  {
841  result[n] = a[n] - (*Alpha_pt)[n] * d_final + d_final * handler_pt->Y[n];
842  result[n_dof + n] = f[n] - (*E_pt)[n] * d_final;
843  }
844  // The result corresponding to the paramater
845  result[n_dof - 1] = a[n_dof - 1] - (*Alpha_pt)[n_dof - 1] * d_final;
846 
848 
849  // Switch things to our block solver
850  handler_pt->solve_full_system();
851  }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
std::vector< double > DoubleVector
loads clump configuration
Definition: ClumpInput.h:26
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar * b
Definition: benchVecAdd.cpp:17
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
Definition: linear_algebra_distribution.h:457
virtual void enable_resolve()
Definition: linear_solver.h:135
virtual void resolve(const DoubleVector &rhs, DoubleVector &result)
Definition: linear_solver.h:225
virtual void disable_resolve()
Definition: linear_solver.h:144
unsigned long ndof() const
Return the number of dofs.
Definition: problem.h:1674
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237
const Scalar * a
Definition: level2_cplx_impl.h:32
int * m
Definition: level2_cplx_impl.h:294
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
double FD_step
FD step.
Definition: black_box_newton_solver.cc:54
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References a, oomph::Problem::actions_after_change_in_bifurcation_parameter(), Alpha_pt, oomph::Problem::assembly_handler_pt(), b, oomph::DoubleVector::build(), oomph::DoubleVector::built(), oomph::LinearSolver::disable_resolve(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::Problem::dof(), e(), oomph::Mesh::element_pt(), oomph::LinearSolver::enable_resolve(), oomph::FoldHandler::eqn_number(), f(), boost::multiprecision::fabs(), oomph::BlackBoxFDNewtonSolver::FD_step, oomph::FoldHandler::get_jacobian(), Linear_solver_pt, m, oomph::Problem::mesh_pt(), n, oomph::Problem::ndof(), oomph::FoldHandler::ndof(), oomph::Mesh::nelement(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Problem_pt, oomph::LinearSolver::resolve(), oomph::FoldHandler::solve_augmented_block_system(), oomph::FoldHandler::solve_full_system(), and oomph::FoldHandler::Y.

◆ solve() [1/3]

void oomph::AugmentedBlockFoldLinearSolver::solve ( DoubleMatrixBase *const &  matrix_pt,
const DoubleVector rhs,
DoubleVector result 
)
inlinevirtual

The linear-algebra-type solver does not make sense. The interface is deliberately broken

Reimplemented from oomph::LinearSolver.

428  {
429  throw OomphLibError(
430  "Linear-algebra interface does not make sense for this linear solver\n",
433  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ solve() [2/3]

void oomph::AugmentedBlockFoldLinearSolver::solve ( DoubleMatrixBase *const &  matrix_pt,
const Vector< double > &  rhs,
Vector< double > &  result 
)
inlinevirtual

The linear-algebra-type solver does not make sense. The interface is deliberately broken

Reimplemented from oomph::LinearSolver.

440  {
441  throw OomphLibError(
442  "Linear-algebra interface does not make sense for this linear solver\n",
445  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ solve() [3/3]

void oomph::AugmentedBlockFoldLinearSolver::solve ( Problem *const &  problem_pt,
DoubleVector result 
)
virtual

The solve function uses the block factorisation.

Use a block factorisation to solve the augmented system associated with a PitchFork bifurcation.

Implements oomph::LinearSolver.

407  {
408  // if the result is setup then it should not be distributed
409 #ifdef PARANOID
410  if (result.built())
411  {
412  if (result.distributed())
413  {
414  throw OomphLibError("The result vector must not be distributed",
417  }
418  }
419 #endif
420 
421  // Locally cache the pointer to the handler.
422  FoldHandler* handler_pt =
423  static_cast<FoldHandler*>(problem_pt->assembly_handler_pt());
424 
425  // Switch the handler to "block solver" mode
426  handler_pt->solve_augmented_block_system();
427 
428  // We need to find out the number of dofs in the problem
429  unsigned n_dof = problem_pt->ndof();
430 
431  // create the linear algebra distribution for this solver
432  // currently only global (non-distributed) distributions are allowed
433  LinearAlgebraDistribution dist(problem_pt->communicator_pt(), n_dof, false);
434  this->build_distribution(dist);
435 
436  // if the result vector is not setup then rebuild with distribution = global
437  if (!result.built())
438  {
439  result.build(this->distribution_pt(), 0.0);
440  }
441 
442  // Setup storage for temporary vectors
443  DoubleVector a(this->distribution_pt(), 0.0),
444  b(this->distribution_pt(), 0.0);
445 
446  // Allocate storage for Alpha which can be used in the resolve
447  if (Alpha_pt != 0)
448  {
449  delete Alpha_pt;
450  }
451  Alpha_pt = new DoubleVector(this->distribution_pt(), 0.0);
452 
453  // We are going to do resolves using the underlying linear solver
455 
456  // Solve the first system Aa = R
457  Linear_solver_pt->solve(problem_pt, a);
458 
459  // The vector in the top right-hand block is the jacobian multiplied
460  // by the null vector
461 
462  // Get the present null vector from the handler
463  DoubleVector y(this->distribution_pt(), 0.0);
464  for (unsigned n = 0; n < (n_dof - 1); ++n)
465  {
466  y[n] = handler_pt->Y[n];
467  }
468  // For simplicity later, add a zero at the end
469  y[n_dof - 1] = 0.0;
470 
471  // Loop over the elements and assemble the product
472  // Local storage for the product terms
473  DoubleVector Jy(this->distribution_pt(), 0.0);
474 
475  // Calculate the product of the jacobian matrices, etc
476  unsigned long n_element = problem_pt->mesh_pt()->nelement();
477  for (unsigned long e = 0; e < n_element; e++)
478  {
479  GeneralisedElement* elem_pt = problem_pt->mesh_pt()->element_pt(e);
480  // Loop over the ndofs in each element
481  unsigned n_var = elem_pt->ndof();
482  // Get the jacobian matrix
483  DenseMatrix<double> jac(n_var);
484  // storage for the residual
485  Vector<double> res(n_var);
486  // Get unperturbed raw jacobian
487  elem_pt->get_jacobian(res, jac);
488 
489  // Multiply the dofs
490  for (unsigned n = 0; n < n_var; n++)
491  {
492  unsigned eqn_number = elem_pt->eqn_number(n);
493  for (unsigned m = 0; m < n_var; m++)
494  {
495  unsigned unknown = elem_pt->eqn_number(m);
496  Jy[eqn_number] += jac(n, m) * y[unknown];
497  }
498  }
499  }
500  // The final entry of the vector will be zero
501 
502  // Now resolve to find alpha
504 
505  // The vector that multiplie the product matrix is actually y - alpha
506  DoubleVector y_minus_alpha(this->distribution_pt(), 0.0);
507  for (unsigned n = 0; n < n_dof; n++)
508  {
509  y_minus_alpha[n] = y[n] - (*Alpha_pt)[n];
510  }
511 
512  // We can now construct our multipliers
513  // Prepare to scale
514  double dof_length = 0.0, a_length = 0.0, alpha_length = 0.0;
515  for (unsigned n = 0; n < n_dof; n++)
516  {
517  if (std::fabs(problem_pt->dof(n)) > dof_length)
518  {
519  dof_length = std::fabs(problem_pt->dof(n));
520  }
521  if (std::fabs(a[n]) > a_length)
522  {
523  a_length = std::fabs(a[n]);
524  }
525  if (std::fabs(y_minus_alpha[n]) > alpha_length)
526  {
527  alpha_length = std::fabs(y_minus_alpha[n]);
528  }
529  }
530 
531  double a_mult = dof_length / a_length;
532  double alpha_mult = dof_length / alpha_length;
533  const double FD_step = 1.0e-8;
534  a_mult += FD_step;
535  alpha_mult += FD_step;
536  a_mult *= FD_step;
537  alpha_mult *= FD_step;
538 
539  // Local storage for the product terms
540  DoubleVector Jprod_a(this->distribution_pt(), 0.0),
541  Jprod_alpha(this->distribution_pt(), 0.0);
542 
543  // Calculate the product of the jacobian matrices, etc
544  for (unsigned long e = 0; e < n_element; e++)
545  {
546  GeneralisedElement* elem_pt = problem_pt->mesh_pt()->element_pt(e);
547  // Loop over the ndofs in each element
548  unsigned n_var = handler_pt->ndof(elem_pt);
549  // Get the jacobian matrices
550  DenseMatrix<double> jac(n_var), jac_a(n_var), jac_alpha(n_var);
551  // elemental residual storage
552  Vector<double> res_elemental(n_var);
553  // Get unperturbed jacobian
554  handler_pt->get_jacobian(elem_pt, res_elemental, jac);
555 
556  // Backup the dofs
557  Vector<double> dof_bac(n_var);
558  // Perturb the dofs
559  for (unsigned n = 0; n < n_var; n++)
560  {
561  unsigned eqn_number = handler_pt->eqn_number(elem_pt, n);
562  dof_bac[n] = problem_pt->dof(eqn_number);
563  // Pertub by vector a
564  problem_pt->dof(eqn_number) += a_mult * a[eqn_number];
565  }
566 
567  problem_pt->actions_after_change_in_bifurcation_parameter();
568 
569  // Now get the new jacobian
570  handler_pt->get_jacobian(elem_pt, res_elemental, jac_a);
571 
572  // Perturb the dofs
573  for (unsigned n = 0; n < n_var; n++)
574  {
575  unsigned eqn_number = handler_pt->eqn_number(elem_pt, n);
576  problem_pt->dof(eqn_number) = dof_bac[n];
577  // Pertub by vector a
578  problem_pt->dof(eqn_number) += alpha_mult * y_minus_alpha[eqn_number];
579  }
580 
581  problem_pt->actions_after_change_in_bifurcation_parameter();
582 
583  // Now get the new jacobian
584  handler_pt->get_jacobian(elem_pt, res_elemental, jac_alpha);
585 
586  // Reset the dofs
587  for (unsigned n = 0; n < n_var; n++)
588  {
589  unsigned eqn_number = handler_pt->eqn_number(elem_pt, n);
590  problem_pt->dof(eqn_number) = dof_bac[n];
591  }
592 
593  problem_pt->actions_after_change_in_bifurcation_parameter();
594 
595  // OK, now work out the products
596  // Note the (n_var-1), we are only interested in the non-augmented
597  // jacobian
598  for (unsigned n = 0; n < (n_var - 1); n++)
599  {
600  unsigned eqn_number = handler_pt->eqn_number(elem_pt, n);
601  double prod_a = 0.0, prod_alpha = 0.0;
602  for (unsigned m = 0; m < (n_var - 1); m++)
603  {
604  unsigned unknown = handler_pt->eqn_number(elem_pt, m);
605  prod_a += (jac_a(n, m) - jac(n, m)) * y[unknown];
606  prod_alpha += (jac_alpha(n, m) - jac(n, m)) * y[unknown];
607  }
608  Jprod_a[eqn_number] += prod_a / a_mult;
609  Jprod_alpha[eqn_number] += prod_alpha / alpha_mult;
610  }
611  }
612 
613  Jprod_alpha[n_dof - 1] = 0.0;
614  Jprod_a[n_dof - 1] = 0.0;
615 
616  // OK, now we can formulate the next vectors
617  // The assumption here is that the result has been set to the
618  // residuals.
619  for (unsigned n = 0; n < n_dof - 1; n++)
620  {
621  b[n] = result[n_dof + n] - Jprod_a[n];
622  }
623  // The final residual is the entry corresponding to the original parameter
624  b[n_dof - 1] = result[n_dof - 1];
625 
626  // Allocate storage for E which can be used in the resolve
627  if (E_pt != 0)
628  {
629  delete E_pt;
630  }
631  E_pt = new DoubleVector(this->distribution_pt(), 0.0);
632  DoubleVector f(this->distribution_pt(), 0.0);
634  Linear_solver_pt->resolve(Jprod_alpha, *E_pt);
635 
636  // Calculate the final entry in the vector e
637  const double e_final = (*E_pt)[n_dof - 1];
638  // Calculate the final entry in the vector d
639  const double d_final = f[n_dof - 1] / e_final;
640  // Assemble the final corrections
641  for (unsigned n = 0; n < n_dof - 1; n++)
642  {
643  result[n] = a[n] - (*Alpha_pt)[n] * d_final + d_final * y[n];
644  result[n_dof + n] = f[n] - (*E_pt)[n] * d_final;
645  }
646  // The result corresponding to the parameter
647  result[n_dof - 1] = a[n_dof - 1] - (*Alpha_pt)[n_dof - 1] * d_final;
648 
649  // The sign of the jacobian is the sign of the final entry in e
650  problem_pt->sign_of_jacobian() =
651  static_cast<int>(std::fabs(e_final) / e_final);
652 
653  // Switch things to our block solver
654  handler_pt->solve_full_system();
655 
656  // If we are not storing things, clear the results
657  if (!Enable_resolve)
658  {
659  // We no longer need to store the matrix
661  delete Alpha_pt;
662  Alpha_pt = 0;
663  delete E_pt;
664  E_pt = 0;
665  }
666  // Otherwise, also store the problem pointer
667  else
668  {
669  Problem_pt = problem_pt;
670  }
671  }
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
Definition: linear_algebra_distribution.h:507
virtual void solve(Problem *const &problem_pt, DoubleVector &result)=0
bool Enable_resolve
Definition: linear_solver.h:73
Scalar * y
Definition: level1_cplx_impl.h:128

References a, oomph::Problem::actions_after_change_in_bifurcation_parameter(), Alpha_pt, oomph::Problem::assembly_handler_pt(), b, oomph::DoubleVector::build(), oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DoubleVector::built(), oomph::Problem::communicator_pt(), oomph::LinearSolver::disable_resolve(), oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::Problem::dof(), e(), E_pt, oomph::Mesh::element_pt(), oomph::LinearSolver::Enable_resolve, oomph::LinearSolver::enable_resolve(), oomph::GeneralisedElement::eqn_number(), oomph::FoldHandler::eqn_number(), f(), boost::multiprecision::fabs(), oomph::BlackBoxFDNewtonSolver::FD_step, oomph::FoldHandler::get_jacobian(), oomph::GeneralisedElement::get_jacobian(), Linear_solver_pt, m, oomph::Problem::mesh_pt(), n, oomph::GeneralisedElement::ndof(), oomph::Problem::ndof(), oomph::FoldHandler::ndof(), oomph::Mesh::nelement(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Problem_pt, res, oomph::LinearSolver::resolve(), oomph::Problem::sign_of_jacobian(), oomph::LinearSolver::solve(), oomph::FoldHandler::solve_augmented_block_system(), oomph::FoldHandler::solve_full_system(), y, and oomph::FoldHandler::Y.

Member Data Documentation

◆ Alpha_pt

DoubleVector* oomph::AugmentedBlockFoldLinearSolver::Alpha_pt
private

Pointer to the storage for the vector alpha.

Referenced by resolve(), solve(), and ~AugmentedBlockFoldLinearSolver().

◆ E_pt

DoubleVector* oomph::AugmentedBlockFoldLinearSolver::E_pt
private

Pointer to the storage for the vector e.

Referenced by solve(), and ~AugmentedBlockFoldLinearSolver().

◆ Linear_solver_pt

LinearSolver* oomph::AugmentedBlockFoldLinearSolver::Linear_solver_pt
private

Pointer to the original linear solver.

Referenced by linear_solver_pt(), resolve(), and solve().

◆ Problem_pt

Problem* oomph::AugmentedBlockFoldLinearSolver::Problem_pt
private

Referenced by resolve(), and solve().


The documentation for this class was generated from the following files: