specfem::assembly::fields_impl::base_field

template<specfem::dimension::type DimensionTag, specfem::element::medium_tag MediumTag, specfem::data_access::DataClassType DataClass>
class base_field

Base storage class for individual field components in spectral elements.

This template class provides the foundational storage and access mechanisms for individual field components (displacement, velocity, acceleration, mass matrix) in spectral element simulations. It manages both device and host memory views with efficient synchronization capabilities.

The class is designed to handle different physical media and spatial dimensions while maintaining optimal memory layouts for Kokkos-based computations.

Template Parameters:
  • DimensionTag – Spatial dimension (2D or 3D)

  • MediumTag – Physical medium type (elastic, acoustic, poroelastic)

  • DataClass – Field component type (displacement, velocity, acceleration, mass_matrix)

Public Functions

base_field() = default

Default constructor.

Creates an uninitialized base field with no allocated storage.

inline base_field(const int nglob, std::string name)

Construct base field with specified size and name.

Allocates device and host memory views for the field data with the appropriate number of components based on the medium type and dimension. The field is stored as a 2D array [nglob × components].

Parameters:
  • nglob – Number of global points in the spectral element mesh

  • name – Descriptive name for the field (used for debugging and profiling)

Public Static Attributes

static constexpr int components = specfem::element::attributes<DimensionTag, MediumTag>::components

Number of components for this medium and dimension (e.g., 2 for 2D, 3 for 3D)

static constexpr auto data_class = DataClass

Data class type identifier for this field component.