LCOV - code coverage report
Current view: top level - include/systems - DisplacedSystem.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: fef103 Lines: 44 106 41.5 %
Date: 2025-09-03 20:01:23 Functions: 23 52 44.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #pragma once
      11             : 
      12             : #include "SystemBase.h"
      13             : 
      14             : // Forward declarations
      15             : class DisplacedProblem;
      16             : namespace libMesh
      17             : {
      18             : class System;
      19             : }
      20             : 
      21             : class DisplacedSystem : public SystemBase
      22             : {
      23             : public:
      24             :   DisplacedSystem(DisplacedSystem &&) = delete;
      25             :   DisplacedSystem & operator=(DisplacedSystem &&) = delete;
      26             : 
      27             :   DisplacedSystem(DisplacedProblem & problem,
      28             :                   FEProblemBase & fe_problem,
      29             :                   SystemBase & undisplaced_system,
      30             :                   const std::string & name,
      31             :                   Moose::VarKindType var_kind);
      32             :   virtual ~DisplacedSystem();
      33             : 
      34    79204634 :   virtual NumericVector<Number> & getVector(TagID tag_id) override
      35             :   {
      36    79204634 :     return _undisplaced_system.getVector(tag_id);
      37             :   }
      38           0 :   virtual const NumericVector<Number> & getVector(TagID tag_id) const override
      39             :   {
      40           0 :     return _undisplaced_system.getVector(tag_id);
      41             :   }
      42             : 
      43           0 :   virtual TagID residualVectorTag() const override
      44             :   {
      45           0 :     return _undisplaced_system.residualVectorTag();
      46             :   }
      47             : 
      48           0 :   virtual TagID systemMatrixTag() const override { return _undisplaced_system.systemMatrixTag(); }
      49             : 
      50          48 :   virtual TagID timeVectorTag() const override { return _undisplaced_system.timeVectorTag(); }
      51             : 
      52          96 :   virtual TagID nonTimeVectorTag() const override { return _undisplaced_system.nonTimeVectorTag(); }
      53             : 
      54           0 :   virtual std::set<TagID> defaultVectorTags() const override
      55             :   {
      56           0 :     return _undisplaced_system.defaultVectorTags();
      57             :   }
      58           0 :   virtual std::set<TagID> defaultMatrixTags() const override
      59             :   {
      60           0 :     return _undisplaced_system.defaultMatrixTags();
      61             :   }
      62             : 
      63           0 :   virtual void associateVectorToTag(NumericVector<Number> & vec, TagID tag) override
      64             :   {
      65           0 :     _undisplaced_system.associateVectorToTag(vec, tag);
      66           0 :   }
      67             : 
      68           0 :   virtual void disassociateVectorFromTag(NumericVector<Number> & vec, TagID tag) override
      69             :   {
      70           0 :     _undisplaced_system.disassociateVectorFromTag(vec, tag);
      71           0 :   }
      72             : 
      73           0 :   virtual void disassociateVectorFromTag(TagID tag) override
      74             :   {
      75           0 :     _undisplaced_system.disassociateVectorFromTag(tag);
      76           0 :   }
      77             : 
      78           0 :   virtual void disassociateDefaultVectorTags() override
      79             :   {
      80           0 :     _undisplaced_system.disassociateDefaultVectorTags();
      81           0 :   }
      82             : 
      83           0 :   virtual void associateMatrixToTag(libMesh::SparseMatrix<Number> & matrix, TagID tag) override
      84             :   {
      85           0 :     _undisplaced_system.associateMatrixToTag(matrix, tag);
      86           0 :   }
      87             : 
      88           0 :   virtual void disassociateMatrixFromTag(libMesh::SparseMatrix<Number> & matrix, TagID tag) override
      89             :   {
      90           0 :     _undisplaced_system.disassociateMatrixFromTag(matrix, tag);
      91           0 :   }
      92             : 
      93           0 :   virtual void disassociateMatrixFromTag(TagID tag) override
      94             :   {
      95           0 :     _undisplaced_system.disassociateMatrixFromTag(tag);
      96           0 :   }
      97             : 
      98           0 :   virtual void disassociateDefaultMatrixTags() override
      99             :   {
     100           0 :     _undisplaced_system.disassociateDefaultMatrixTags();
     101           0 :   }
     102             : 
     103             :   virtual NumericVector<Number> & getVector(const std::string & name) override;
     104             :   virtual const NumericVector<Number> & getVector(const std::string & name) const override;
     105             : 
     106           0 :   virtual NumericVector<Number> & serializedSolution() override
     107             :   {
     108           0 :     return _undisplaced_system.serializedSolution();
     109             :   }
     110             : 
     111     3865464 :   const NumericVector<Number> * const & currentSolution() const override
     112             :   {
     113     3865464 :     return _undisplaced_system.currentSolution();
     114             :   }
     115             : 
     116           0 :   NumericVector<Number> * solutionPreviousNewton() override { return nullptr; }
     117           0 :   const NumericVector<Number> * solutionPreviousNewton() const override { return nullptr; }
     118             : 
     119     2483082 :   NumericVector<Number> * solutionUDot() override { return _undisplaced_system.solutionUDot(); }
     120        4800 :   NumericVector<Number> * solutionUDotDot() override
     121             :   {
     122        4800 :     return _undisplaced_system.solutionUDotDot();
     123             :   }
     124       77192 :   NumericVector<Number> * solutionUDotOld() override
     125             :   {
     126       77192 :     return _undisplaced_system.solutionUDotOld();
     127             :   }
     128       77192 :   NumericVector<Number> * solutionUDotDotOld() override
     129             :   {
     130       77192 :     return _undisplaced_system.solutionUDotDotOld();
     131             :   }
     132         490 :   const NumericVector<Number> * solutionUDot() const override
     133             :   {
     134         490 :     return _undisplaced_system.solutionUDot();
     135             :   }
     136         490 :   const NumericVector<Number> * solutionUDotDot() const override
     137             :   {
     138         490 :     return _undisplaced_system.solutionUDotDot();
     139             :   }
     140         490 :   const NumericVector<Number> * solutionUDotOld() const override
     141             :   {
     142         490 :     return _undisplaced_system.solutionUDotOld();
     143             :   }
     144         490 :   const NumericVector<Number> * solutionUDotDotOld() const override
     145             :   {
     146         490 :     return _undisplaced_system.solutionUDotDotOld();
     147             :   }
     148             : 
     149           0 :   virtual std::vector<Number> & duDotDus() override { return _undisplaced_system.duDotDus(); }
     150           0 :   virtual Number & duDotDotDu() override { return _undisplaced_system.duDotDotDu(); }
     151             :   virtual const Number & duDotDu(unsigned int var_num = 0) const override;
     152         490 :   virtual const Number & duDotDotDu() const override { return _undisplaced_system.duDotDotDu(); }
     153             : 
     154           0 :   virtual void addDotVectors() override { _undisplaced_system.addDotVectors(); }
     155             : 
     156             :   /**
     157             :    * Return the residual copy from the NonlinearSystem
     158             :    * @return Residual copy
     159             :    */
     160           0 :   virtual NumericVector<Number> & residualCopy() override
     161             :   {
     162           0 :     return _undisplaced_system.residualCopy();
     163             :   }
     164          13 :   virtual NumericVector<Number> & residualGhosted() override
     165             :   {
     166          13 :     return _undisplaced_system.residualGhosted();
     167             :   }
     168             : 
     169        4132 :   virtual void augmentSendList(std::vector<dof_id_type> & send_list) override
     170             :   {
     171        4132 :     _undisplaced_system.augmentSendList(send_list);
     172        4132 :   }
     173             : 
     174             :   /**
     175             :    * This is an empty function since the displaced system doesn't have a matrix!
     176             :    * All sparsity pattern modification will be taken care of by the undisplaced system directly
     177             :    */
     178           0 :   virtual void augmentSparsity(libMesh::SparsityPattern::Graph & /*sparsity*/,
     179             :                                std::vector<dof_id_type> & /*n_nz*/,
     180             :                                std::vector<dof_id_type> & /*n_oz*/) override
     181             :   {
     182           0 :   }
     183             : 
     184             :   /**
     185             :    * Adds this variable to the list of variables to be zeroed during each residual evaluation.
     186             :    * @param var_name The name of the variable to be zeroed.
     187             :    */
     188           0 :   virtual void addVariableToZeroOnResidual(std::string var_name) override
     189             :   {
     190           0 :     _undisplaced_system.addVariableToZeroOnResidual(var_name);
     191           0 :   }
     192             : 
     193             :   /**
     194             :    * Adds this variable to the list of variables to be zeroed during each jacobian evaluation.
     195             :    * @param var_name The name of the variable to be zeroed.
     196             :    */
     197           0 :   virtual void addVariableToZeroOnJacobian(std::string var_name) override
     198             :   {
     199           0 :     _undisplaced_system.addVariableToZeroOnJacobian(var_name);
     200           0 :   }
     201             : 
     202             :   /**
     203             :    * Zero out the solution for the list of variables passed in.
     204             :    */
     205           0 :   virtual void zeroVariables(std::vector<std::string> & vars_to_be_zeroed) override
     206             :   {
     207           0 :     _undisplaced_system.zeroVariables(vars_to_be_zeroed);
     208           0 :   }
     209             : 
     210   116008389 :   virtual bool hasVector(TagID tag_id) const override
     211             :   {
     212   116008389 :     return _undisplaced_system.hasVector(tag_id);
     213             :   }
     214             : 
     215     3294205 :   virtual bool hasMatrix(TagID tag_id) const override
     216             :   {
     217     3294205 :     return _undisplaced_system.hasMatrix(tag_id);
     218             :   }
     219             : 
     220             :   virtual void initSolutionState() override;
     221             :   virtual NumericVector<Number> & solutionState(
     222             :       const unsigned int state,
     223             :       Moose::SolutionIterationType iteration_type = Moose::SolutionIterationType::Time) override;
     224             :   virtual const NumericVector<Number> &
     225             :   solutionState(const unsigned int state,
     226             :                 Moose::SolutionIterationType iteration_type =
     227             :                     Moose::SolutionIterationType::Time) const override;
     228             :   virtual void needSolutionState(
     229             :       const unsigned int state,
     230             :       Moose::SolutionIterationType iteration_type = Moose::SolutionIterationType::Time,
     231             :       libMesh::ParallelType parallel_type = GHOSTED) override;
     232             :   virtual bool hasSolutionState(const unsigned int state,
     233             :                                 Moose::SolutionIterationType iteration_type =
     234             :                                     Moose::SolutionIterationType::Time) const override;
     235             : 
     236    19187345 :   virtual libMesh::SparseMatrix<Number> & getMatrix(TagID tag) override
     237             :   {
     238    19187345 :     return _undisplaced_system.getMatrix(tag);
     239             :   }
     240           0 :   virtual const libMesh::SparseMatrix<Number> & getMatrix(TagID tag) const override
     241             :   {
     242           0 :     return _undisplaced_system.getMatrix(tag);
     243             :   }
     244             : 
     245     1202747 :   virtual libMesh::System & sys() { return _sys; }
     246             : 
     247             :   virtual System & system() override;
     248             :   virtual const System & system() const override;
     249             : 
     250           0 :   virtual void compute(ExecFlagType) override {}
     251             : 
     252             : protected:
     253           0 :   NumericVector<Number> & solutionInternal() const override
     254             :   {
     255           0 :     return _undisplaced_system.solution();
     256             :   }
     257             : 
     258             :   SystemBase & _undisplaced_system;
     259             :   libMesh::System & _sys;
     260             : };
     261             : 
     262             : inline void
     263        4468 : DisplacedSystem::initSolutionState()
     264             : {
     265        4468 :   _undisplaced_system.initSolutionState();
     266        4468 : }
     267             : 
     268             : inline NumericVector<Number> &
     269       44816 : DisplacedSystem::solutionState(const unsigned int state,
     270             :                                const Moose::SolutionIterationType iteration_type)
     271             : {
     272       44816 :   return _undisplaced_system.solutionState(state, iteration_type);
     273             : }
     274             : 
     275             : inline const NumericVector<Number> &
     276           0 : DisplacedSystem::solutionState(const unsigned int state,
     277             :                                const Moose::SolutionIterationType iteration_type) const
     278             : {
     279           0 :   return _undisplaced_system.solutionState(state, iteration_type);
     280             : }
     281             : 
     282             : inline void
     283          51 : DisplacedSystem::needSolutionState(const unsigned int state,
     284             :                                    const Moose::SolutionIterationType iteration_type,
     285             :                                    const libMesh::ParallelType parallel_type)
     286             : {
     287          51 :   _undisplaced_system.needSolutionState(state, iteration_type, parallel_type);
     288          51 : }
     289             : 
     290             : inline bool
     291           0 : DisplacedSystem::hasSolutionState(const unsigned int state,
     292             :                                   const Moose::SolutionIterationType iteration_type) const
     293             : {
     294           0 :   return _undisplaced_system.hasSolutionState(state, iteration_type);
     295             : }
     296             : 
     297             : inline const Number &
     298     7201756 : DisplacedSystem::duDotDu(const unsigned int var_num) const
     299             : {
     300     7201756 :   return _undisplaced_system.duDotDu(var_num);
     301             : }

Generated by: LCOV version 1.14