Loading...
Searching...
No Matches
option.h
// Copyright (C) 2024 Paul T. Kühner
//
// This file is part of DOLFINX (https://www.fenicsproject.org)
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#pragma once
#include <cstdint>
#include <type_traits>
namespace dolfinx::refinement
{
enum class Option : std::uint8_t
{
none = 0b00,
parent_facet = 0b01,
parent_cell
= 0b10,
parent_cell_and_facet = 0b11 /*< Both cell and facet parent data */
};
inline constexpr Option operator|(Option a, Option b)
{
using bitmask_t = std::underlying_type_t<Option>;
bitmask_t a_native = static_cast<bitmask_t>(a);
bitmask_t b_native = static_cast<bitmask_t>(b);
return static_cast<Option>(a_native | b_native);
}
inline constexpr bool option_parent_facet(Option a)
{
using bitmask_t = std::underlying_type_t<Option>;
bitmask_t a_native = static_cast<bitmask_t>(a);
bitmask_t facet_native = static_cast<bitmask_t>(Option::parent_facet);
return (a_native & facet_native) == facet_native;
}
inline constexpr bool option_parent_cell(Option a)
{
using bitmask_t = std::underlying_type_t<Option>;
bitmask_t a_native = static_cast<bitmask_t>(a);
bitmask_t facet_native = static_cast<bitmask_t>(Option::parent_cell);
return (a_native & facet_native) == facet_native;
}
} // namespace dolfinx::refinement
dolfinx::refinement
Mesh refinement algorithms.
Definition dolfinx_refinement.h:8
dolfinx::refinement::operator|
constexpr Option operator|(Option a, Option b)
Combine two refinement options into one, both flags will be set for the resulting option.
Definition option.h:27
dolfinx::refinement::option_parent_cell
constexpr bool option_parent_cell(Option a)
Check if parent_cell flag is set.
Definition option.h:45
dolfinx::refinement::Option
Option
Options for data to compute during mesh refinement.
Definition option.h:16
dolfinx::refinement::Option::none
@ none
Definition option.h:17
dolfinx::refinement::Option::parent_cell
@ parent_cell
Definition option.h:20
dolfinx::refinement::Option::parent_facet
@ parent_facet
Definition option.h:18
dolfinx::refinement::option_parent_facet
constexpr bool option_parent_facet(Option a)
Check if parent_facet flag is set.
Definition option.h:36