PolyFEM
Loading...
Searching...
No Matches
polyfem::Units Class Reference

#include <Units.hpp>

Public Member Functions

void init (const json &json)
 
const std::string & length () const
 
const std::string & mass () const
 
const std::string & time () const
 
double characteristic_length () const
 
double & characteristic_length ()
 
std::string stress () const
 
std::string density () const
 
std::string velocity () const
 
std::string acceleration () const
 
std::string force () const
 
std::string pressure () const
 
std::string energy () const
 
std::string viscosity () const
 

Static Public Member Functions

static double convert (const json &val, const std::string &unit_type)
 
static double convert (const double val, const std::string &unit, const std::string &unit_type)
 

Private Attributes

std::string length_ = "m"
 
std::string mass_ = "kg"
 
std::string time_ = "s"
 
double characteristic_length_ = 1
 

Detailed Description

Definition at line 11 of file Units.hpp.

Member Function Documentation

◆ acceleration()

std::string polyfem::Units::acceleration ( ) const
inline

Definition at line 28 of file Units.hpp.

References length_, and time_.

Referenced by force(), pressure(), and polyfem::assembler::GenericTensorProblem::set_units().

Here is the caller graph for this function:

◆ characteristic_length() [1/2]

double & polyfem::Units::characteristic_length ( )
inline

Definition at line 23 of file Units.hpp.

References characteristic_length_.

◆ characteristic_length() [2/2]

double polyfem::Units::characteristic_length ( ) const
inline

Definition at line 22 of file Units.hpp.

References characteristic_length_.

Referenced by polyfem::solver::SolveData::init_forms(), polyfem::State::init_time(), polyfem::State::make_nl_solver(), and polyfem::State::solve_tensor_nonlinear().

Here is the caller graph for this function:

◆ convert() [1/2]

double polyfem::Units::convert ( const double  val,
const std::string &  unit,
const std::string &  unit_type 
)
static

Definition at line 41 of file Units.cpp.

References polyfem::log_and_throw_error(), and val.

Here is the call graph for this function:

◆ convert() [2/2]

double polyfem::Units::convert ( const json val,
const std::string &  unit_type 
)
static

Definition at line 31 of file Units.cpp.

References convert(), and val.

Referenced by polyfem::State::build_basis(), convert(), polyfem::State::init_time(), polyfem::mesh::read_fem_mesh(), and polyfem::mesh::read_obstacle_mesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ density()

std::string polyfem::Units::density ( ) const
inline

Definition at line 26 of file Units.hpp.

References length_, and mass_.

Referenced by polyfem::assembler::Mass::add_multimaterial().

Here is the caller graph for this function:

◆ energy()

std::string polyfem::Units::energy ( ) const
inline

Definition at line 31 of file Units.hpp.

References length_, mass_, and time_.

◆ force()

std::string polyfem::Units::force ( ) const
inline

Definition at line 29 of file Units.hpp.

References acceleration(), and mass_.

Referenced by polyfem::assembler::GenericTensorProblem::set_units(), and viscosity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void polyfem::Units::init ( const json json)

Definition at line 9 of file Units.cpp.

References characteristic_length_, length_, mass_, and time_.

Referenced by polyfem::State::init().

Here is the caller graph for this function:

◆ length()

const std::string & polyfem::Units::length ( ) const
inline

Definition at line 19 of file Units.hpp.

References length_.

Referenced by polyfem::State::build_basis(), polyfem::mesh::read_fem_mesh(), polyfem::mesh::read_obstacle_mesh(), polyfem::assembler::GenericTensorProblem::set_units(), and polyfem::mesh::Obstacle::set_units().

Here is the caller graph for this function:

◆ mass()

const std::string & polyfem::Units::mass ( ) const
inline

Definition at line 20 of file Units.hpp.

References mass_.

◆ pressure()

std::string polyfem::Units::pressure ( ) const
inline

Definition at line 30 of file Units.hpp.

References acceleration(), length_, and mass_.

Referenced by polyfem::assembler::GenericTensorProblem::set_units().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stress()

◆ time()

const std::string & polyfem::Units::time ( ) const
inline

Definition at line 21 of file Units.hpp.

References time_.

Referenced by polyfem::State::init_time().

Here is the caller graph for this function:

◆ velocity()

std::string polyfem::Units::velocity ( ) const
inline

Definition at line 27 of file Units.hpp.

References length_, and time_.

Referenced by polyfem::State::build_basis(), and polyfem::assembler::GenericTensorProblem::set_units().

Here is the caller graph for this function:

◆ viscosity()

std::string polyfem::Units::viscosity ( ) const
inline

Definition at line 32 of file Units.hpp.

References force(), length_, and time_.

Referenced by polyfem::assembler::NavierStokesVelocity::add_multimaterial(), and polyfem::assembler::StokesVelocity::add_multimaterial().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ characteristic_length_

double polyfem::Units::characteristic_length_ = 1
private

Definition at line 38 of file Units.hpp.

Referenced by characteristic_length(), characteristic_length(), and init().

◆ length_

std::string polyfem::Units::length_ = "m"
private

Definition at line 35 of file Units.hpp.

Referenced by acceleration(), density(), energy(), init(), length(), pressure(), stress(), velocity(), and viscosity().

◆ mass_

std::string polyfem::Units::mass_ = "kg"
private

Definition at line 36 of file Units.hpp.

Referenced by density(), energy(), force(), init(), mass(), pressure(), and stress().

◆ time_

std::string polyfem::Units::time_ = "s"
private

Definition at line 37 of file Units.hpp.

Referenced by acceleration(), energy(), init(), stress(), time(), velocity(), and viscosity().


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