LCOV - code coverage report
Current view: top level - models - surfacecurrentoperator.hpp (source / functions) Coverage Total Hit
Test: Palace Coverage Report Lines: 0.0 % 2 0
Test Date: 2025-10-23 22:45:05 Functions: - 0 0
Legend: Lines: hit not hit

            Line data    Source code
       1              : // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
       2              : // SPDX-License-Identifier: Apache-2.0
       3              : 
       4              : #ifndef PALACE_MODELS_SURFACE_CURRENT_OPERATOR_HPP
       5              : #define PALACE_MODELS_SURFACE_CURRENT_OPERATOR_HPP
       6              : 
       7              : #include <map>
       8              : #include <memory>
       9              : #include <vector>
      10              : #include <mfem.hpp>
      11              : #include "fem/lumpedelement.hpp"
      12              : 
      13              : namespace palace
      14              : {
      15              : 
      16              : class IoData;
      17              : class SumVectorCoefficient;
      18              : 
      19              : namespace config
      20              : {
      21              : 
      22              : struct SurfaceCurrentData;
      23              : 
      24              : }  // namespace config
      25              : 
      26              : //
      27              : // Helper class for surface current boundaries in a model.
      28              : //
      29            0 : class SurfaceCurrentData
      30              : {
      31              : public:
      32              :   // To accomodate multielement surface current sources, a current source may be made up
      33              :   // of elements with different attributes and directions which add to deliver the same
      34              :   // total source current.
      35              :   std::vector<std::unique_ptr<LumpedElementData>> elems;
      36              : 
      37              : public:
      38              :   SurfaceCurrentData(const config::SurfaceCurrentData &data, const mfem::ParMesh &mesh);
      39              : 
      40              :   double GetExcitationCurrent() const;
      41              : };
      42              : 
      43              : //
      44              : // A class handling surface current boundaries.
      45              : //
      46            0 : class SurfaceCurrentOperator
      47              : {
      48              : private:
      49              :   // Mapping from source index to data structure containing source surface current
      50              :   // information.
      51              :   std::map<int, SurfaceCurrentData> sources;
      52              : 
      53              :   void SetUpBoundaryProperties(const IoData &iodata, const mfem::ParMesh &mesh);
      54              :   void PrintBoundaryInfo(const IoData &iodata, const mfem::ParMesh &mesh);
      55              : 
      56              : public:
      57              :   SurfaceCurrentOperator(const IoData &iodata, const mfem::ParMesh &mesh);
      58              : 
      59              :   // Access data structures for the surface current source with the given index.
      60              :   const SurfaceCurrentData &GetSource(int idx) const;
      61              :   auto begin() const { return sources.begin(); }
      62              :   auto end() const { return sources.end(); }
      63              :   auto rbegin() const { return sources.rbegin(); }
      64              :   auto rend() const { return sources.rend(); }
      65              :   auto Size() const { return sources.size(); }
      66              : 
      67              :   // Returns array of surface current source attributes.
      68              :   mfem::Array<int> GetAttrList() const;
      69              : 
      70              :   // Add contributions to the right-hand side source term vector for a surface current
      71              :   // excitation at the specified boundaries, -J_inc for the real version (versus the
      72              :   // full -iω J_inc for the complex one).
      73              :   void AddExcitationBdrCoefficients(SumVectorCoefficient &fb);
      74              :   void AddExcitationBdrCoefficients(int idx, SumVectorCoefficient &fb);
      75              :   void AddExcitationBdrCoefficients(const SurfaceCurrentData &data,
      76              :                                     SumVectorCoefficient &fb);
      77              : };
      78              : 
      79              : }  // namespace palace
      80              : 
      81              : #endif  // PALACE_MODELS_SURFACE_CURRENT_OPERATOR_HPP
        

Generated by: LCOV version 2.0-1