LCOV - code coverage report
Current view: top level - src/physics - diff_qoi.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 15 15 100.0 %
Date: 2025-08-19 19:27:09 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
       3             : 
       4             : // This library is free software; you can redistribute it and/or
       5             : // modify it under the terms of the GNU Lesser General Public
       6             : // License as published by the Free Software Foundation; either
       7             : // version 2.1 of the License, or (at your option) any later version.
       8             : 
       9             : // This library is distributed in the hope that it will be useful,
      10             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12             : // Lesser General Public License for more details.
      13             : 
      14             : // You should have received a copy of the GNU Lesser General Public
      15             : // License along with this library; if not, write to the Free Software
      16             : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      17             : 
      18             : 
      19             : #include "libmesh/diff_qoi.h"
      20             : #include "libmesh/int_range.h"
      21             : #include "libmesh/parallel.h"
      22             : 
      23             : namespace libMesh
      24             : {
      25             : 
      26        5185 : DifferentiableQoI::DifferentiableQoI () :
      27        4877 :   assemble_qoi_sides(false),
      28        4877 :   assemble_qoi_internal_sides(false),
      29        5185 :   assemble_qoi_elements(true)
      30             : {
      31        5185 : }
      32             : 
      33       45863 : void DifferentiableQoI::thread_join( std::vector<Number> & qoi,
      34             :                                      const std::vector<Number> & other_qoi,
      35             :                                      const QoISet &)
      36             : {
      37      111406 :   for (auto i : index_range(qoi))
      38       75106 :     qoi[i] += other_qoi[i];
      39       45863 : }
      40             : 
      41       39155 : void DifferentiableQoI::parallel_op(const Parallel::Communicator & communicator,
      42             :                                     std::vector<Number> & sys_qoi,
      43             :                                     std::vector<Number> & local_qoi,
      44             :                                     const QoISet &)
      45             : {
      46             :   // Sum everything into local_qoi
      47       39155 :   communicator.sum(local_qoi);
      48             : 
      49             :   // Now put into system qoi
      50       39155 :   sys_qoi = local_qoi;
      51       39155 : }
      52             : 
      53       24817 : void DifferentiableQoI::finalize_derivative(NumericVector<Number> &, std::size_t)
      54             : {
      55             :   // by default, do nothing
      56       24817 : }
      57             : 
      58             : } // namespace libMesh

Generated by: LCOV version 1.14