EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
EBGeometry::RegionNames Class Reference

The names of an object's regions, materials, surfaces and surface labels, from its expression's index, and of surface groups: what a viewer shows a piece of surface or a group by (Render::view()). More...

#include <EBGeometry_RegionNames.hpp>

Collaboration diagram for EBGeometry::RegionNames:
Collaboration graph
[legend]

Public Member Functions

 RegionNames ()=default
 No names: everything is named by its number.
 
template<class T >
 RegionNames (const ExprIndex< T > &a_index)
 The names an expression's index gives: a region by its name and its material ("2 wall (steel)"), a surface by its label (or its number).
 
uint32_t addDomain (std::string a_name, const DomainSetup &a_domain)
 Register a domain: its name, and how it is made (its subdomains and surface groups, see DomainSetup). The first registered is the active one, whose surface groups the names name and a viewer shows.
 
uint32_t getNumDomains () const noexcept
 How many domains are registered.
 
DomainSetup & getDomain (const uint32_t a_domain)
 How a domain is made, to edit.
 
const DomainSetup & getDomain (const uint32_t a_domain) const
 How a domain is made.
 
const std::string & domainName (const uint32_t a_domain) const
 A domain's name.
 
void setActiveDomain (const uint32_t a_domain)
 Make a domain the active one: the one whose surface groups setSurfaceGroup() and surfaceGroup() name.
 
uint32_t getActiveDomain () const noexcept
 The active domain.
 
void setSurfaceGroup (const uint32_t a_domain, const uint32_t a_group, std::string a_name)
 Name a surface group of a domain.
 
void setSubdomain (const uint32_t a_domain, const uint32_t a_subdomain, std::string a_name)
 Name a subdomain of a domain ("fluid", "solid").
 
std::string subdomain (const uint32_t a_subdomain, const bool a_number=true) const
 A subdomain's name in the active domain, with its number or not: "1 solid" or "solid"; "subdomain 1".
 
void setColor (std::string a_name, const Vec3T< double > &a_color)
 Give a name a color: a region's, a material's, a surface label's or a surface group's. Colored by that kind of key, its surfaces take it; others take the palette's.
 
bool colorOf (const RegionColoring a_coloring, const uint32_t a_key, Vec3T< double > &a_color) const
 The color a key has, colored by a kind of key: by the name of the region, material, surface label (a surface's too) or surface group it is. Colored by region, a region without a color of its own takes its material's, so that colors given to materials (the usual case) are kept when the coloring turns to regions.
 
const SurfaceInventory & getInventory () const noexcept
 What the index says about the surfaces: every surface, its parts, the pairs of regions it may separate (see possiblePieces(), coverageOf()).
 
uint32_t materialOf (const uint32_t a_region) const noexcept
 A region's material.
 
void setSurface (const uint32_t a_surface, std::string a_name)
 Name a surface (by default it is named by its label): where it comes from, say ("cylinder, model.ebg:6").
 
void setPickedByLabel (const uint32_t a_surface, const bool a_byLabel=true)
 Pick a surface by its labels rather than its parts: a click on it picks the faces labeled as the one clicked (a mesh's face group), or the whole surface when the face has no label of its own. For a mesh, whose parts are its faces, which a model names only through its face groups.
 
bool pickedByLabel (const uint32_t a_surface) const noexcept
 Whether a surface is picked by its labels (see setPickedByLabel()).
 
void setSurfaceGroup (const uint32_t a_group, std::string a_name)
 Name a surface group of the active domain (with no domain registered, of those a viewer shows).
 
void removeSurfaceGroup (const uint32_t a_group)
 Forget a group's name; the names of the groups after it move down by one (as SurfaceGroups::removeSurfaceGroup() numbers them).
 
std::string region (const uint32_t a_region, const bool a_number=true) const
 A region's name and material, with its number or not: "2 wall (steel)" or "wall (steel)"; the background is "background", a region without a name "region 2".
 
std::string material (const uint32_t a_material, const bool a_number=true) const
 A material's name, with its number or not.
 
std::string surface (const uint32_t a_surface, const bool a_number=true) const
 A surface's name, with its number or not: its label's, or "surface 3".
 
std::string surfaceLabel (const uint32_t a_label, const bool a_number=true) const
 A surface label's name, with its number or not.
 
std::string surfaceGroup (const uint32_t a_group, const bool a_number=true) const
 A surface group's name, with its number or not: "0 inlet" or "inlet"; "surface group 0".
 

Static Public Attributes

static constexpr uint32_t None = 0xFFFFFFFFU
 No material, no label.
 

Protected Member Functions

std::vector< std::string > & groupNames () noexcept
 The surface groups' names in use: the active domain's, or, with no domain, the names' own.
 
const std::vector< std::string > & groupNames () const noexcept
 The surface groups' names in use.
 

Static Protected Member Functions

static std::string named (const std::vector< std::string > &a_names, const uint32_t a_index, const char *a_kind, const bool a_number)
 A name from a list, after its number, or the kind and the number.
 

Protected Attributes

SurfaceInventory m_inventory
 The surfaces, from the index.
 
std::vector< DomainSetup > m_domains
 The domains, their names and their surface groups' names; and the active one, or None.
 
std::vector< std::string > m_domainNames
 The domains' names.
 
std::vector< std::vector< std::string > > m_domainSubdomains
 Each domain's subdomains' names.
 
std::vector< std::vector< std::string > > m_domainGroups
 Each domain's surface groups' names.
 
uint32_t m_activeDomain = None
 The active domain, or None.
 
std::vector< std::string > m_regionNames
 The regions' own names (RegionName()), empty for none; the lists below too leave the unnamed empty.
 
std::vector< uint32_t > m_regionMaterials
 Each region's material label number, or None.
 
std::map< std::string, Vec3T< double > > m_colors
 The colors given to names.
 
std::vector< std::string > m_materials
 The materials' names.
 
std::vector< std::string > m_surfaces
 The surfaces' names.
 
std::vector< bool > m_pickedByLabel
 Which surfaces are picked by their labels (see setPickedByLabel()).
 
std::vector< std::string > m_surfaceLabels
 The surface labels' names.
 
std::vector< std::string > m_surfaceGroups
 The groups' names.
 

Detailed Description

The names of an object's regions, materials, surfaces and surface labels, from its expression's index, and of surface groups: what a viewer shows a piece of surface or a group by (Render::view()).

Host only. Anything without a name, or beyond the lists, is named by its kind and number ("region 3", "surface group 1"). Names can also be given colors (setColor()), which a viewer colors the surfaces by.

Constructor & Destructor Documentation

◆ RegionNames()

template<class T >
EBGeometry::RegionNames::RegionNames ( const ExprIndex< T > &  a_index)
inlineexplicit

The names an expression's index gives: a region by its name and its material ("2 wall (steel)"), a surface by its label (or its number).

Template Parameters
TFloating-point precision.
Parameters
[in]a_indexThe index of the expression the tape was compiled from.

Member Function Documentation

◆ addDomain()

uint32_t EBGeometry::RegionNames::addDomain ( std::string  a_name,
const DomainSetup &  a_domain 
)
inline

Register a domain: its name, and how it is made (its subdomains and surface groups, see DomainSetup). The first registered is the active one, whose surface groups the names name and a viewer shows.

Parameters
[in]a_nameIts name ("heat transfer").
[in]a_domainHow it is made.
Returns
Its number, from 0 in the order registered.

◆ colorOf()

bool EBGeometry::RegionNames::colorOf ( const RegionColoring  a_coloring,
const uint32_t  a_key,
Vec3T< double > &  a_color 
) const
inline

The color a key has, colored by a kind of key: by the name of the region, material, surface label (a surface's too) or surface group it is. Colored by region, a region without a color of its own takes its material's, so that colors given to materials (the usual case) are kept when the coloring turns to regions.

Parameters
[in]a_coloringThe kind of key.
[in]a_keyThe key.
[out]a_colorIts color, if it has one.
Returns
Whether it has one.

◆ domainName()

const std::string & EBGeometry::RegionNames::domainName ( const uint32_t  a_domain) const
inline

A domain's name.

Parameters
[in]a_domainIts number (below getNumDomains()).
Returns
The name.

◆ getActiveDomain()

uint32_t EBGeometry::RegionNames::getActiveDomain ( ) const
inlinenoexcept

The active domain.

Returns
Its number, or None when none is registered.

◆ getDomain() [1/2]

DomainSetup & EBGeometry::RegionNames::getDomain ( const uint32_t  a_domain)
inline

How a domain is made, to edit.

Parameters
[in]a_domainIts number (below getNumDomains()).
Returns
Its setup.

◆ getDomain() [2/2]

const DomainSetup & EBGeometry::RegionNames::getDomain ( const uint32_t  a_domain) const
inline

How a domain is made.

Parameters
[in]a_domainIts number (below getNumDomains()).
Returns
Its setup.

◆ getInventory()

const SurfaceInventory & EBGeometry::RegionNames::getInventory ( ) const
inlinenoexcept

What the index says about the surfaces: every surface, its parts, the pairs of regions it may separate (see possiblePieces(), coverageOf()).

Returns
The inventory; empty for names not built from an index.

◆ getNumDomains()

uint32_t EBGeometry::RegionNames::getNumDomains ( ) const
inlinenoexcept

How many domains are registered.

Returns
The count.

◆ groupNames() [1/2]

const std::vector< std::string > & EBGeometry::RegionNames::groupNames ( ) const
inlineprotectednoexcept

The surface groups' names in use.

Returns
The names.

◆ groupNames() [2/2]

std::vector< std::string > & EBGeometry::RegionNames::groupNames ( )
inlineprotectednoexcept

The surface groups' names in use: the active domain's, or, with no domain, the names' own.

Returns
The names.

◆ material()

std::string EBGeometry::RegionNames::material ( const uint32_t  a_material,
const bool  a_number = true 
) const
inline

A material's name, with its number or not.

Parameters
[in]a_materialThe material label's number.
[in]a_numberWhether to put its number first.
Returns
The name.

◆ materialOf()

uint32_t EBGeometry::RegionNames::materialOf ( const uint32_t  a_region) const
inlinenoexcept

A region's material.

Parameters
[in]a_regionThe region.
Returns
The material label's number, or None.

◆ named()

static std::string EBGeometry::RegionNames::named ( const std::vector< std::string > &  a_names,
const uint32_t  a_index,
const char *  a_kind,
const bool  a_number 
)
inlinestaticprotected

A name from a list, after its number, or the kind and the number.

Parameters
[in]a_namesThe list.
[in]a_indexThe number.
[in]a_kindWhat it is.
[in]a_numberWhether to put the number before a name.
Returns
The name.

◆ pickedByLabel()

bool EBGeometry::RegionNames::pickedByLabel ( const uint32_t  a_surface) const
inlinenoexcept

Whether a surface is picked by its labels (see setPickedByLabel()).

Parameters
[in]a_surfaceThe surface.
Returns
Whether it is.

◆ region()

std::string EBGeometry::RegionNames::region ( const uint32_t  a_region,
const bool  a_number = true 
) const
inline

A region's name and material, with its number or not: "2 wall (steel)" or "wall (steel)"; the background is "background", a region without a name "region 2".

Parameters
[in]a_regionThe region.
[in]a_numberWhether to put its number first.
Returns
The name.

◆ removeSurfaceGroup()

void EBGeometry::RegionNames::removeSurfaceGroup ( const uint32_t  a_group)
inline

Forget a group's name; the names of the groups after it move down by one (as SurfaceGroups::removeSurfaceGroup() numbers them).

Parameters
[in]a_groupThe group.

◆ setActiveDomain()

void EBGeometry::RegionNames::setActiveDomain ( const uint32_t  a_domain)
inline

Make a domain the active one: the one whose surface groups setSurfaceGroup() and surfaceGroup() name.

Parameters
[in]a_domainIts number (below getNumDomains()).

◆ setColor()

void EBGeometry::RegionNames::setColor ( std::string  a_name,
const Vec3T< double > &  a_color 
)
inline

Give a name a color: a region's, a material's, a surface label's or a surface group's. Colored by that kind of key, its surfaces take it; others take the palette's.

Parameters
[in]a_nameThe name ("steel", "wall", "inlet").
[in]a_colorIts color, linear RGB in [0, 1] (as Render::Settings::m_color).

◆ setPickedByLabel()

void EBGeometry::RegionNames::setPickedByLabel ( const uint32_t  a_surface,
const bool  a_byLabel = true 
)
inline

Pick a surface by its labels rather than its parts: a click on it picks the faces labeled as the one clicked (a mesh's face group), or the whole surface when the face has no label of its own. For a mesh, whose parts are its faces, which a model names only through its face groups.

Parameters
[in]a_surfaceThe surface.
[in]a_byLabelWhether it is picked by its labels.

◆ setSubdomain()

void EBGeometry::RegionNames::setSubdomain ( const uint32_t  a_domain,
const uint32_t  a_subdomain,
std::string  a_name 
)
inline

Name a subdomain of a domain ("fluid", "solid").

Parameters
[in]a_domainThe domain (below getNumDomains()).
[in]a_subdomainThe subdomain (its number in the domain's Subdomains).
[in]a_nameIts name.

◆ setSurface()

void EBGeometry::RegionNames::setSurface ( const uint32_t  a_surface,
std::string  a_name 
)
inline

Name a surface (by default it is named by its label): where it comes from, say ("cylinder, model.ebg:6").

Parameters
[in]a_surfaceThe surface.
[in]a_nameIts name.

◆ setSurfaceGroup() [1/2]

void EBGeometry::RegionNames::setSurfaceGroup ( const uint32_t  a_domain,
const uint32_t  a_group,
std::string  a_name 
)
inline

Name a surface group of a domain.

Parameters
[in]a_domainThe domain.
[in]a_groupThe surface group.
[in]a_nameIts name: the boundary condition's tag.

◆ setSurfaceGroup() [2/2]

void EBGeometry::RegionNames::setSurfaceGroup ( const uint32_t  a_group,
std::string  a_name 
)
inline

Name a surface group of the active domain (with no domain registered, of those a viewer shows).

Parameters
[in]a_groupThe group.
[in]a_nameIts name.

◆ subdomain()

std::string EBGeometry::RegionNames::subdomain ( const uint32_t  a_subdomain,
const bool  a_number = true 
) const
inline

A subdomain's name in the active domain, with its number or not: "1 solid" or "solid"; "subdomain 1".

Parameters
[in]a_subdomainThe subdomain.
[in]a_numberWhether to put its number first.
Returns
The name.

◆ surface()

std::string EBGeometry::RegionNames::surface ( const uint32_t  a_surface,
const bool  a_number = true 
) const
inline

A surface's name, with its number or not: its label's, or "surface 3".

Parameters
[in]a_surfaceThe surface (SurfaceRef::m_surface).
[in]a_numberWhether to put its number first.
Returns
The name.

◆ surfaceGroup()

std::string EBGeometry::RegionNames::surfaceGroup ( const uint32_t  a_group,
const bool  a_number = true 
) const
inline

A surface group's name, with its number or not: "0 inlet" or "inlet"; "surface group 0".

Parameters
[in]a_groupThe group.
[in]a_numberWhether to put its number first.
Returns
The name.

◆ surfaceLabel()

std::string EBGeometry::RegionNames::surfaceLabel ( const uint32_t  a_label,
const bool  a_number = true 
) const
inline

A surface label's name, with its number or not.

Parameters
[in]a_labelThe label's number.
[in]a_numberWhether to put its number first.
Returns
The name.

The documentation for this class was generated from the following file: