specfem::element::dimension_tag

enum class specfem::element::dimension_tag

Spatial dimension types.

Used as template parameters throughout the codebase to distinguish between 2D and 3D implementations.

Values:

enumerator dim2

2D spatial dimension

enumerator dim3

3D spatial dimension

specfem::element::dimension

template<specfem::element::dimension_tag DimensionTag>
class dimension

Compile-time dimension traits and utilities.

Provides dimension-specific constants and string conversion. Template specializations define dimension-dependent behavior.

// Get dimension info at compile time
using dim_2d =
specfem::element::dimension<specfem::element::dimension_tag::dim2>;
static_assert(dim_2d::dim == 2);
std::string name = dim_2d::to_string(); // "2D"

Template Parameters:

DimensionTag – Spatial dimension (dim2 or dim3)

Dimension-Specific Implementations

template<>
class dimension<specfem::element::dimension_tag::dim2>

2D dimension specialization.

Provides compile-time constants for 2D finite element computations.

Public Static Attributes

static constexpr auto value = specfem::element::dimension_tag::dim2

Dimension type tag.

static constexpr int dim = 2

Spatial dimension count.

template<>
class dimension<specfem::element::dimension_tag::dim3>

3D dimension specialization.

Provides compile-time constants for 3D finite element computations.

Public Static Attributes

static constexpr auto value = specfem::element::dimension_tag::dim3

Dimension type tag.

static constexpr int dim = 3

Spatial dimension count.

specfem::element::medium_tag

enum class specfem::element::medium_tag

Element medium types for physics simulations.

Defines wave propagation physics: elastic (P/SV/SH waves), acoustic (pressure waves), poroelastic (fluid-solid interaction), and electromagnetic (TE/TM modes).

Values:

enumerator elastic_psv

2D elastic medium with P and SV waves

enumerator elastic_sh

2D elastic medium with SH waves

enumerator elastic_psv_t

2D elastic PSV with transverse spin (Cosserat)

enumerator acoustic

Acoustic medium (pressure waves)

enumerator poroelastic

Poroelastic medium (Biot theory)

enumerator electromagnetic_te

2D electromagnetic TE modes

enumerator elastic

3D elastic medium (full displacement field)

enumerator elastic_spin

Elastic medium with spin dynamics.

enumerator electromagnetic

Electromagnetic medium (TE and TM modes)

specfem::element::property_tag

enum class specfem::element::property_tag

Material property symmetries.

Controls material tensor structure: isotropic (scalar properties), anisotropic (full tensor), isotropic_cosserat (with microrotation).

Values:

enumerator isotropic

Isotropic material (scalar properties)

enumerator anisotropic

Anisotropic material (full tensor)

enumerator isotropic_cosserat

Isotropic Cosserat material (with microrotation)

specfem::element::boundary_tag

enum class specfem::element::boundary_tag

Boundary condition types for domain edges.

Defines how waves interact with domain boundaries: free surfaces, absorbing conditions (Stacey), and composite boundary treatments.

Values:

enumerator none

No boundary condition.

enumerator acoustic_free_surface

Acoustic free surface (zero pressure)

enumerator stacey

Stacey absorbing boundary condition.

enumerator composite_stacey_dirichlet

Combined Stacey-Dirichlet boundary.

specfem::element::to_string

const std::string specfem::element::to_string(const medium_tag &medium)

Convert medium tag to string.

Parameters:

medium – Medium type

Returns:

String representation

const std::string specfem::element::to_string(const property_tag &property)

Convert property tag to string.

Parameters:

property – Property type

Returns:

String representation

const std::string specfem::element::to_string(const boundary_tag &boundary)

Convert boundary tag to string.

Parameters:

boundary – Boundary condition type

Returns:

String representation

const std::string specfem::element::to_string(const attenuation_tag &attenuation)

Convert attenuation tag to string.

Parameters:

attenuation – Attenuation type

Returns:

String representation

const std::string specfem::element::to_string(const medium_tag &medium, const property_tag &property_tag, const boundary_tag &boundary_tag)

Convert medium, property, and boundary tags to string.

Parameters:
  • medium – Medium type

  • property_tag – Property type

  • boundary_tag – Boundary condition type

Returns:

Combined string representation

const std::string specfem::element::to_string(const medium_tag &medium, const property_tag &property_tag, const attenuation_tag &attenuation_tag)

Convert medium, property, and attenuation tags to string.

Parameters:
  • medium – Medium type

  • property_tag – Property type

  • attenuation_tag – Attenuation type

Returns:

Combined string representation

specfem::element::from_string

specfem::element::medium_tag specfem::element::from_string(const std::string &medium_tag)

Parse medium tag from string representation.

Parameters:

medium_tag – String representation of medium type

Throws:

std::runtime_error – if string is not recognized

Returns:

Corresponding medium_tag enumeration value

specfem::element::attributes

template<specfem::element::dimension_tag Dimension, specfem::element::medium_tag MediumTag>
class attributes

Element physics attributes for different media.

Template specializations define field components, physics flags, and computational requirements for each medium type.

// Get attributes for 2D elastic PSV medium
using attrs = specfem::element::attributes<
  specfem::element::dimension_tag::dim2,
  specfem::element::medium_tag::elastic_psv>;
static_assert(attrs::components == 2); // u_x, u_z components
static_assert(attrs::dimension == 2);

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

  • MediumTag – Medium physics type

template<>
class attributes<specfem::element::dimension_tag::dim2, specfem::element::medium_tag::elastic_psv>

Attributes for 2D elastic PSV waves (P and SV components).

Handles in-plane wave propagation with displacement components u_x and u_z.

Public Static Attributes

static constexpr int dimension = 2

Spatial dimension.

static constexpr int components = 2

Field components (u_x, u_z)

static constexpr bool has_damping_force = false

No damping physics.

static constexpr bool has_cosserat_stress = false

No Cosserat stress.

static constexpr bool has_cosserat_couple_stress = false

No couple stress.

template<>
class attributes<specfem::element::dimension_tag::dim2, specfem::element::medium_tag::elastic_sh>

Attributes for 2D elastic SH waves (out-of-plane shear).

Handles anti-plane wave propagation with single displacement component u_y.

Public Static Attributes

static constexpr int dimension = 2

Spatial dimension.

static constexpr int components = 1

Field components (u_y)

static constexpr bool has_damping_force = false

No damping physics.

static constexpr bool has_cosserat_stress = false

No Cosserat stress.

static constexpr bool has_cosserat_couple_stress = false

No couple stress.

template<>
class attributes<specfem::element::dimension_tag::dim2, specfem::element::medium_tag::acoustic>

Attributes for 2D acoustic waves (pressure field).

Handles compressional wave propagation in fluid media with scalar pressure.

Public Static Attributes

static constexpr int dimension = 2

Spatial dimension.

static constexpr int components = 1

Field components (pressure)

static constexpr bool has_damping_force = false

No damping physics.

static constexpr bool has_cosserat_stress = false

No Cosserat stress.

static constexpr bool has_cosserat_couple_stress = false

No couple stress.

template<>
class attributes<specfem::element::dimension_tag::dim2, specfem::element::medium_tag::poroelastic>

Attributes for 2D poroelastic media (Biot theory).

Couples solid skeleton and fluid flow with displacement and pressure fields. Components: solid displacement (u_s^x, u_s^z) and relative fluid motion (w^x, w^z).

Public Static Attributes

static constexpr int dimension = 2

Spatial dimension.

static constexpr int components = 4

Field components (u_s^x, u_s^z, w^x, w^z)

static constexpr bool has_damping_force = true

Has fluid damping.

static constexpr bool has_cosserat_stress = false

No Cosserat stress.

static constexpr bool has_cosserat_couple_stress = false

No couple stress.

template<>
class attributes<specfem::element::dimension_tag::dim2, specfem::element::medium_tag::elastic_psv_t>

Attributes for 2D elastic PSV with transverse spin (Cosserat medium).

Extends PSV waves with microrotation physics for granular/micropolar materials. Includes displacement (u_x, u_z) and rotation (ω_y) components.

Public Static Attributes

static constexpr int dimension = 2

Spatial dimension.

static constexpr int components = 3

Field components (u_x, u_z, ω_y)

static constexpr bool has_damping_force = false

No damping physics.

static constexpr bool has_cosserat_stress = true

Has Cosserat stress.

static constexpr bool has_cosserat_couple_stress = true

Has couple stress.

template<>
class attributes<specfem::element::dimension_tag::dim2, specfem::element::medium_tag::electromagnetic_te>

Attributes for 2D electromagnetic TE waves (transverse electric).

Handles electromagnetic wave propagation with electric field components E_x and E_y.

Public Static Attributes

static constexpr int dimension = 2

Spatial dimension.

static constexpr int components = 2

Field components (E_x, E_y)

static constexpr bool has_damping_force = false

No damping physics.

static constexpr bool has_cosserat_stress = false

No Cosserat stress.

static constexpr bool has_cosserat_couple_stress = false

No couple stress.

template<>
class attributes<specfem::element::dimension_tag::dim3, specfem::element::medium_tag::elastic>

Attributes for 3D elastic waves (full displacement field).

Handles 3D elastic wave propagation with displacement components u_x, u_y, u_z.

Public Static Attributes

static constexpr int dimension = 3

Spatial dimension.

static constexpr int components = 3

Field components (u_x, u_y, u_z)

static constexpr bool has_damping_force = false

No damping physics.

static constexpr bool has_cosserat_stress = false

No Cosserat stress.

static constexpr bool has_cosserat_couple_stress = false

No couple stress.

template<>
class attributes<specfem::element::dimension_tag::dim3, specfem::element::medium_tag::acoustic>

Attributes for 3D acoustic waves (pressure field).

Handles compressional wave propagation in 3D fluid media with scalar pressure.

Public Static Attributes

static constexpr int dimension = 3

Spatial dimension.

static constexpr int components = 1

Field components (pressure)

static constexpr bool has_damping_force = false

No damping physics.

static constexpr bool has_cosserat_stress = false

No Cosserat stress.

static constexpr bool has_cosserat_couple_stress = false

No couple stress.

specfem::element::is_elastic

template<specfem::element::medium_tag MediumTag>
using specfem::element::is_elastic = typename std::conditional_t<(MediumTag == specfem::element::medium_tag::elastic || MediumTag == specfem::element::medium_tag::elastic_psv || MediumTag == specfem::element::medium_tag::elastic_sh || MediumTag == specfem::element::medium_tag::elastic_psv_t || MediumTag == specfem::element::medium_tag::elastic_spin), std::true_type, std::false_type>::type

Type trait to identify elastic media.

static_assert(is_elastic<medium_tag::elastic_psv>::value);
static_assert(!is_elastic<medium_tag::acoustic>::value);

Template Parameters:

MediumTag – Medium type to check

Return:

std::true_type if elastic, std::false_type otherwise

specfem::element::is_electromagnetic

template<specfem::element::medium_tag MediumTag>
using specfem::element::is_electromagnetic = typename std::conditional_t<(MediumTag == specfem::element::medium_tag::electromagnetic || MediumTag == specfem::element::medium_tag::electromagnetic_te), std::true_type, std::false_type>::type

Type trait to identify electromagnetic media.

Template Parameters:

MediumTag – Medium type to check

Return:

std::true_type if electromagnetic, std::false_type otherwise