LCOV - code coverage report
Current view: top level - include/userobjects - UserObject.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 3 5 60.0 %
Date: 2026-05-29 20:35:17 Functions: 2 3 66.7 %
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 "UserObjectBase.h"
      13             : 
      14             : #include "libmesh/parallel.h"
      15             : 
      16             : /**
      17             :  * Base class for user-specific data
      18             :  */
      19             : class UserObject : public UserObjectBase
      20             : {
      21             : public:
      22             :   static InputParameters validParams();
      23             : 
      24             :   UserObject(const InputParameters & params);
      25             : 
      26             :   /**
      27             :    * Execute method.
      28             :    */
      29             :   virtual void execute() = 0;
      30             : 
      31             :   /**
      32             :    * Optional interface function for "evaluating" a UserObject at a spatial position.
      33             :    * If a UserObject overrides this function that UserObject can then be used in a
      34             :    * Transfer to transfer information from one domain to another.
      35             :    */
      36           3 :   virtual Real spatialValue(const Point & /*p*/) const
      37             :   {
      38           3 :     mooseError(name(), " does not satisfy the Spatial UserObject interface!");
      39             :   }
      40             : 
      41             :   /**
      42             :    * Optional interface function for providing the points at which a UserObject attains
      43             :    * spatial values. If a UserObject overrides this function, then other objects that
      44             :    * take both the UserObject and points can instead directly use the points specified
      45             :    * on the UserObject.
      46             :    */
      47           0 :   virtual const std::vector<Point> spatialPoints() const
      48             :   {
      49           0 :     mooseError("Spatial UserObject interface is not satisfied; spatialPoints() must be overridden");
      50             :   }
      51             : 
      52             :   /**
      53             :    * Must override.
      54             :    *
      55             :    * @param uo The UserObject to be joined into _this_ object.  Take the data from the uo object and
      56             :    * "add" it into the data for this object.
      57             :    */
      58             :   virtual void threadJoin(const UserObject & uo) = 0;
      59             : 
      60             :   void setPrimaryThreadCopy(UserObject * primary);
      61             : 
      62      399615 :   UserObject * primaryThreadCopy() { return _primary_thread_copy; }
      63             : 
      64             : protected:
      65             :   /// Coordinate system
      66             :   const Moose::CoordinateSystemType & _coord_sys;
      67             : 
      68             : private:
      69             :   UserObject * _primary_thread_copy = nullptr;
      70             : };

Generated by: LCOV version 1.14