tk namespace

Toolkit declarations and definitions for general purpose utilities.

Namespaces

namespace ctr
Toolkit control, general purpose user input to internal data transfer.
namespace grm
Toolkit general purpose grammar definition.
namespace mkl
Toolkit, grammar definition for Intel's Math Kernel Library.
namespace random123
Toolkit, grammar definition for the Random123 library.
namespace rngsse
Toolkit, grammar definition for the RNGSSE library.
namespace zoltan
Interoperation with the Zoltan library, used for static mesh partitioning.

Classes

class ChareStateCollector
template<uint8_t Layout>
class Data
Zero-runtime-cost data-layout wrappers with type-based compile-time dispatch.
class Exception
Basic exception class for producing file:func:line info + call trace.
template<typename, typename = std::void_t<>>
struct HasTypedef_alias
Detect if a type defines type 'alias'.
template<typename, typename = std::void_t<>>
struct HasTypedef_i_am_tagged_tuple
Detect if a type defines type 'i_am_tagged_tuple'.
template<typename, typename = std::void_t<>>
struct HasFunction_expect_description
Detect if a type defines function 'expect::description()'.
template<typename, typename = std::void_t<>>
struct HasVar_expect_lower
Detect if a type defines variable 'expect::lower'.
template<typename, typename = std::void_t<>>
struct HasVar_expect_upper
Detect if a type defines variable 'expect::upper'.
template<typename, typename = std::void_t<>>
struct HasFunction_expect_choices
Detect if a type defines function 'expect::choices()'.
template<bool Condition, typename Then, typename Else = void>
struct if_
Type selection: if_< Condition, Then, Else >::type.
class Print
template<std::size_t N>
class Progress
class Reader
template<class List>
class TaggedTuple
Tagged tuple, allowing tag-based access.
template<class List, class Ignore = brigand::set<>>
struct DeepTuplePrinter
template<class List, class Ignore = brigand::set<>>
struct TuplePrinter
class Timer
class Writer
class FileParser
FileParser.
template<typename... T>
class cmd_keywords
class StringParser
StringParser.
template<typename Enum>
class Toggle
Toggle is the base for an Option, doing generic searches.
class ASCMeshReader
ASCMeshReader : tk::Reader.
class DiagWriter
DiagWriter : tk::Writer.
class ExodusIIMeshReader
class ExodusIIMeshWriter
class GmshMeshReader
class GmshMeshWriter
class H5PartWriter
class HyperMeshReader
HyperMeshReader : tk::Reader.
class MeshReader
class MeshWriter
Charm++ group used to output particle data to file in parallel.
class NetgenMeshReader
NetgenMeshReader : tk::Reader.
class NetgenMeshWriter
class Omega_h_MeshReader
class ParticleWriter
Charm++ group used to output particle data to file in parallel using H5Part and MPI-IO.
class PDFWriter
PDFWriter : Writer.
class RDGFLOMeshReader
RDGFLOMeshReader : tk::Reader.
class SiloWriter
SiloWriter.
class STLTxtMeshReader
STLTxtMeshReader : tk::Reader.
class TxtStatWriter
TxtStatWriter : tk::Writer.
class UGRIDMeshReader
UGRIDMeshReader : tk::Reader.
class ConjugateGradients
ConjugateGradients Charm++ chare array used to perform a distributed linear solve with the conjugate gradients algorithm.
class CSR
Compressed sparse row (CSR) storage for a sparse matrix.
class LinearMap
class UnsMeshMap
Charm++ array map for initial placement of array elements using an unstructured grid.
class LBSwitch
class RNGPrint
RNGPrint : Print.
class Around
Helper class simplifying client code for iterating on entries surrounding entries via linked lists derived from unstructured mesh connectivity.
class STLMesh
STLMesh.
class UnsMesh
3D unstructured mesh class
class Tracker
Tracker advances Lagrangian particles in state space.
class MKLRNG
MKL-based random number generator used polymorphically with tk::RNG.
template<class CBRNG>
class Random123
Random123-based random number generator used polymorphically with tk::RNG.
class RNG
Random number generator.
template<class State, typename SeqNumType, unsigned int(*)(State*) Generate>
class RNGSSE
RNGSSE-based random number generator used polymorphically with tk::RNG.
class RNGStack
Random number generator stack.
class BiPDF
Joint bivariate PDF estimator.
class Statistics
Statistics estimator.
class TriPDF
Joint trivariate PDF estimator.
class UniPDF
Univariate PDF estimator.
class QuietCerr

Enums

enum ErrCode { SUCCESS = EXIT_SUCCESS, FAILURE = EXIT_FAILURE }
Error codes for the OS (or whatever calls us)
enum Style { QUIET =0, VERBOSE =1 }
Output verbosity. C-style enum as this is used for template argument.
enum class ExoElemType: int { TET = 0, TRI = 1 }
enum class ExoWriter { CREATE, OPEN }
ExodusII writer constructor modes.
enum GmshElemType { LIN = 1, TRI = 2, TRI = 1, TET = 4, TET = 0, PNT = 15 }
Identifiers of supported Gmsh elements.
enum class GmshFileType { UNDEFINED = -1, ASCII = 0, BINARY = 1 }
Supported Gmsh mesh file types.
enum class MeshReaderType: uint8_t { GMSH = 0, NETGEN, EXODUSII, HYPER, ASC, OMEGA_H, UGRID, RDGFLO }
Supported mesh readers.
enum class MeshWriterType: uint8_t { GMSH = 0, NETGEN, EXODUSII }
Supported mesh writers.
enum class HeaderType: uint8_t { INCITER =0, RNGTEST, UNITTEST, MESHCONV, FILECONV, WALKER }
Executable types for which an ascii logo is available in tk::Print.
enum class Centering: char { NODE = 'n', ELEM = 'e' }

Typedefs

template<class li, class lo>
using cartesian_product = brigand::reverse_fold<brigand::list<li, lo>, brigand::list<brigand::list<>>, brigand::bind<brigand::join, brigand::bind<brigand::transform, brigand::_2, brigand::defer<brigand::bind<brigand::join, brigand::bind<brigand::transform, brigand::parent<brigand::_1>, brigand::defer<brigand::bind<brigand::list, brigand::bind<brigand::push_front, brigand::_1, brigand::parent<brigand::_1>>>>>>>>>>
using ChareState = TaggedTuple<brigand::list<tag::ch, std::string, tag::id, int, tag::pe, int, tag::it, uint64_t, tag::fn, std::string, tag::time, tk::real>>
Chare state.
template<std::size_t N>
using Table = std::vector<std::array<real, N+1>>
using real = double
Real number type used throughout the whole code.
using SiloErrorHandler = void(*)(char*)
Silo error handler function type.
using NodeSet = std::unordered_set<std::size_t>
Node list type used for node communication map.
using EdgeSet = UnsMesh::EdgeSet
Edge list type used for edge communication map.
using NodeCommMap = std::unordered_map<int, NodeSet>
using EdgeCommMap = std::unordered_map<int, EdgeSet>
using AllCommMaps = TaggedTuple<brigand::list<tag::node, NodeSet, tag::edge, EdgeSet>>
Type list of all communication maps bundled as a tagged tuple.
using CommMaps = std::map<int, AllCommMaps>
using InitializeFn = std::function<std::vector<real>(ncomp_t, ncomp_t, real, real, real, real)>
using RiemannFluxFn = std::function<std::vector<real>(const std::array<real, 3>&, const std::array<std::vector<real>, 2>&, const std::vector<std::array<real, 3>>&)>
using FluxFn = std::function<std::vector<std::array<real, 3>>(ncomp_t, ncomp_t, const std::vector<real>&, const std::vector<std::array<real, 3>>&)>
using VelFn = std::function<std::vector<std::array<tk::real, 3>>(ncomp_t, ncomp_t, real, real, real, real)>
using StateFn = std::function<std::array<std::vector<real>, 2>(ncomp_t, ncomp_t, const std::vector<real>&, real, real, real, real, const std::array<tk::real, 3>&)>
using CompFlowSrcFn = std::function<void(ncomp_t, tk::real, tk::real, tk::real, tk::real, tk::real&, tk::real&, tk::real&, tk::real&, tk::real&)>
using MultiMatSrcFn = std::function<void(ncomp_t, ncomp_t, tk::real, tk::real, tk::real, tk::real, tk::real&, tk::real&, tk::real&, tk::real&, tk::real&)>
using ElemGradFn = std::function<std::tuple<std::array<std::size_t, 4>, std::array<std::array<tk::real, 3>, 4>, std::vector<std::array<tk::real, 4>>, tk::real>(ncomp_t, ncomp_t, std::size_t, const std::array<std::vector<tk::real>, 3>&, const std::vector<std::size_t>&, const std::tuple<std::vector<tk::real>, std::vector<tk::real>>&, const tk::Fields&)>
Function prototype for computing the element gradient contribution to a nodal gradient in ALECG.
using GetVarFn = std::function<std::vector<real>(const tk::Fields&, ncomp_t, std::size_t)>
Prototype for functions to compute a variable from the numerical solution.
using MultiMatIdxFn = std::function<std::size_t(std::size_t, std::size_t)>
Prototype for functions to a compute multi-material index.
using RNGFactory = std::map<ctr::RNGType, std::function<RNG()>>
Random number generator factory: keys associated to their constructors.

Functions

template<class Container>
void unique(Container& c)
template<class Container>
auto uniquecopy(const Container& src) -> Container
template<typename Container>
auto cref_find(const Container& map, const typename Container::key_type& key) -> const typename Container::mapped_type & -> auto
Find and return a constant reference to value for key in container that provides a find() member function with error handling.
template<typename Container>
auto ref_find(const Container& map, const typename Container::key_type& key) -> typename Container::mapped_type & -> auto
Find and return a reference to value for key in a container that provides a find() member function with error handling.
template<typename T>
auto extents(const std::vector<T>& vec) -> std::array<T, 2>
Return minimum and maximum values of a vector.
template<typename Container>
auto extents(const Container& map) -> std::array< typename Container::mapped_type, 2 > -> auto
Find and return minimum and maximum values in associative container.
template<class T, std::size_t N>
auto operator+=(std::array<T, N>& dst, const std::array<T, N>& src) -> std::array<T, N>&
template<class T, class Allocator>
auto operator+=(std::vector<T, Allocator>& dst, const std::vector<T, Allocator>& src) -> std::vector<T, Allocator>&
template<class T, class Allocator>
auto operator/=(std::vector<T, Allocator>& dst, const std::vector<T, Allocator>& src) -> std::vector<T, Allocator>&
template<class C1, class C2>
auto keyEqual(const C1& a, const C2& b) -> bool
template<class Container>
auto sumsize(const Container& c) -> std::size_t
template<class Container>
auto numunique(const Container& c) -> std::size_t
template<class Map>
auto sumvalsize(const Map& c) -> std::size_t
template<class Container>
void destroy(Container& c)
template<typename Container, typename Predicate>
void erase_if(Container& items, const Predicate& predicate)
template<class T>
void concat(std::vector<T>&& src, std::vector<T>& dst)
template<class T>
void concat(std::vector<std::pair<bool, T>>&& src, std::vector<std::pair<bool, T>>& dst)
template<class Key, class Hash = std::hash<Key>, class Eq = std::equal_to<Key>>
void concat(std::unordered_set<Key, Hash, Eq>&& src, std::unordered_set<Key, Hash, Eq>& dst)
template<class Key, class Value>
auto operator<<(std::ostream& os, const std::pair<const Key, Value>& v) -> std::ostream&
template<typename T>
auto parameter(const T& v) -> std::string
Convert and return value as string.
template<typename V>
auto parameters(const V& v) -> std::string
Convert and return values from container as string.
template<uint8_t Layout>
auto operator*(tk::real lhs, const Data<Layout>& rhs) -> Data<Layout>
template<uint8_t Layout>
auto min(const Data<Layout>& a, const Data<Layout>& b) -> Data<Layout>
template<uint8_t Layout>
auto max(const Data<Layout>& a, const Data<Layout>& b) -> Data<Layout>
template<uint8_t Layout>
auto operator==(const Data<Layout>& lhs, const Data<Layout>& rhs) -> bool
template<uint8_t Layout>
auto operator!=(const Data<Layout>& lhs, const Data<Layout>& rhs) -> bool
template<uint8_t Layout>
auto maxdiff(const Data<Layout>& lhs, const Data<Layout>& rhs) -> std::pair<std::size_t, tk::real>
template<class C, class Key, class Factory, typename... ConstructorArgs>
void record(Factory& f, const Key& key, ConstructorArgs&&... args)
template<class Factory, class Key, class Obj = typename std::remove_pointer< typename Factory::mapped_type::result_type>::type>
auto instantiate(const Factory& f, const Key& key) -> std::unique_ptr<Obj>
template<class Host, class ModelConstructor, class Factory, class Key, typename... ModelConstrArgs>
void recordModel(Factory& f, const Key& key, ModelConstrArgs&&... args)
template<class Host, class ModelConstructor, class Factory, class Key, typename ModelConstrArg>
void recordModelLate(Factory& f, const Key& key, ModelConstrArg)
template<class Host, class ModelConstructor, class Factory, class Key, typename... ModelConstrArgs>
void recordCharmModel(Factory& f, const Key& key, ModelConstrArgs&&... args)
template<typename A, typename B>
auto flip_pair(const std::pair<A, B>& p) -> std::pair<B, A>
template<typename A, typename B>
auto flip_map(const std::map<A, B>& src) -> std::multimap<B, A>
template<class Key, class T, class Hash = std::hash<Key>, class Eq = std::equal_to<Key>>
auto serialize(const std::unordered_map<Key, T, Hash, Eq>& m) -> std::pair<int, std::unique_ptr<char[]>>
template<class Key, class T, class Hash = std::hash<Key>, class Eq = std::equal_to<Key>>
auto mergeHashMap(int nmsg, CkReductionMsg** msgs) -> CkReductionMsg*
Charm++ custom reducer for merging std::unordered_maps during reduction across PEs.
auto linearLoadDistributor(real virtualization, uint64_t load, int npe, uint64_t& chunksize, uint64_t& remainder) -> uint64_t
Compute linear load distribution for given total work and virtualization.
template<typename Enum, typename Ch, typename Tr, typename std::enable_if_t<std::is_enum_v<Enum>, int> = 0>
auto operator<<(std::basic_ostream<Ch, Tr>& os, const Enum& e) -> std::basic_ostream<Ch, Tr>&
template<class T, typename Ch, typename Tr>
auto operator<<(std::basic_ostream<Ch, Tr>& os, const std::vector<T>& v) -> std::basic_ostream<Ch, Tr>&
template<typename Ch, typename Tr, class Key, class Value, class Compare = std::less<Key>>
auto operator<<(std::basic_ostream<Ch, Tr>& os, const std::map<Key, Value, Compare>& m) -> std::basic_ostream<Ch, Tr>&
template<typename T, typename Ch, typename Tr>
auto operator<<(std::basic_string<Ch, Tr>& lhs, const T& e) -> std::basic_string<Ch, Tr>
template<typename T, typename Ch, typename Tr>
auto operator<<(std::basic_string<Ch, Tr>&& lhs, const T& e) -> std::basic_string<Ch, Tr>
auto splitLines(std::string str, std::string indent, const std::string& name = "", std::size_t width = 80) -> std::string
Clean up whitespaces and format a long string into multiple lines.
auto baselogname(const std::string& executable) -> std::string
auto logname(const std::string& executable, int numrestart = 0) -> std::string
Construct log file name.
void rm(const std::string& file)
Remove file from file system.
void signalHandler(int signum)
Signal handler for multiple signals, SIGABRT, SIGSEGV, etc.
auto setSignalHandlers() -> int
Set signal handlers for multiple signals, SIGABRT, SIGSEGV, etc.
void processExceptionCharm()
Process an exception from the Charm++ runtime system.
template<typename T>
auto swap_endian(T u) -> T
template<>
auto swap_endian(double u) -> double
template<std::size_t N>
auto sample(real x, const Table<N>& table) -> std::array<real, N>
template<class Tuple>
void print(std::ostream& os, const std::string& name, const Tuple& c)
template<class List>
auto operator<<(std::ostream& os, const tk::TaggedTuple<List>& t) -> std::ostream&
template<class List, class Ignore = brigand::set<>>
void print(std::ostream& os, const tk::TaggedTuple<List>& t)
Simple (unformatted, one-line) output of a TaggedTuple to output stream with ignore.
auto hms(tk::real stamp) -> Timer::Watch
Convert existing time stamp as a real to Watch (global scope)
void flip(std::array<real, 3>& v)
void cross(real v1x, real v1y, real v1z, real v2x, real v2y, real v2z, real& rx, real& ry, real& rz)
auto cross(const std::array<real, 3>& v1, const std::array<real, 3>& v2) -> std::array<real, 3>
void crossdiv(real v1x, real v1y, real v1z, real v2x, real v2y, real v2z, real j, real& rx, real& ry, real& rz)
auto crossdiv(const std::array<real, 3>& v1, const std::array<real, 3>& v2, real j) -> std::array<real, 3>
auto dot(const std::array<real, 3>& v1, const std::array<real, 3>& v2) -> real
auto length(real x, real y, real z) -> real
auto length(const std::array<real, 3>& v) -> real
void unit(std::array<real, 3>& v)
auto triple(real v1x, real v1y, real v1z, real v2x, real v2y, real v2z, real v3x, real v3y, real v3z) -> tk::real
auto triple(const std::array<real, 3>& v1, const std::array<real, 3>& v2, const std::array<real, 3>& v3) -> real
auto rotateX(const std::array<real, 3>& v, real angle) -> std::array<real, 3>
auto rotateY(const std::array<real, 3>& v, real angle) -> std::array<real, 3>
auto rotateZ(const std::array<real, 3>& v, real angle) -> std::array<real, 3>
auto Jacobian(const std::array<real, 3>& v1, const std::array<real, 3>& v2, const std::array<real, 3>& v3, const std::array<real, 3>& v4) -> real
Compute the determinant of the Jacobian of a coordinate transformation over a tetrahedron.
auto inverseJacobian(const std::array<real, 3>& v1, const std::array<real, 3>& v2, const std::array<real, 3>& v3, const std::array<real, 3>& v4) -> std::array<std::array<real, 3>, 3>
Compute the inverse of the Jacobian of a coordinate transformation over a tetrahedron.
auto determinant(const std::array<std::array<tk::real, 3>, 3>& a) -> tk::real
auto cramer(const std::array<std::array<tk::real, 3>, 3>& a, const std::array<tk::real, 3>& b) -> std::array<tk::real, 3>
auto detectInput(const std::string& filename) -> MeshReaderType
Detect input mesh file type.
auto pickOutput(const std::string& filename) -> MeshWriterType
Determine output mesh file type.
auto readUnsMesh(const tk::Print& print, const std::string& filename, std::pair<std::string, tk::real>& timestamp) -> UnsMesh
Read unstructured mesh from file.
auto writeUnsMesh(const tk::Print& print, const std::string& filename, UnsMesh& mesh, bool reorder) -> std::vector<std::pair<std::string, tk::real>>
Write unstructured mesh to file.
void SiloError(char* msg)
Silo error handler.
static auto workdir() -> std::string
auto curtime() -> std::string
Wrapper for the standard C library's gettimeofday() from.
void echoHeader(const Print& print, HeaderType header)
Echo program header.
void echoBuildEnv(const Print& print, const std::string& executable)
Echo build environment.
void echoRunEnv(const Print& print, int argc, char** argv, bool verbose, bool quiescence, bool charestate, bool trace, const std::string& screen_log, const std::string& input_log)
Echo runtime environment.
template<class Driver, class CmdLine>
auto Main(int argc, char* argv[], const CmdLine& cmdline, HeaderType header, const std::string& executable, const std::string& def, int nrestart) -> Driver
Generic Main() used for all executables for code-reuse and a uniform output.
template<class MainProxy, class CmdLine>
void MainCtor(MainProxy& mp, const MainProxy& thisProxy, std::vector<tk::Timer>& timer, const CmdLine& cmdline, const CkCallback& quiescenceTarget)
template<class CmdLine>
void dumpstate(const CmdLine& cmdline, const std::string& def, int nrestart, CkReductionMsg* msg)
template<class CmdLine>
void finalize(const CmdLine& cmdline, const std::vector<tk::Timer>& timer, tk::CProxy_ChareStateCollector& state, std::vector<std::pair<std::string, tk::Timer::Watch>>& timestamp, const std::string& def, int nrestart, const CkCallback& dumpstateTarget, bool clean = true)
auto slave(const NodeCommMap& map, std::size_t node, int chare) -> bool
Decide if a node is not counted by a chare.
auto count(const NodeCommMap& map, std::size_t node) -> tk::real
Count the number of contributions to a node.
auto orient(const UnsMesh::Edge& t, const UnsMesh::Edge& e) -> int
Determine edge orientation.
auto npoin_in_graph(const std::vector<std::size_t>& inpoel) -> std::size_t
Compute number of points (nodes) in mesh from connectivity.
auto genEsup(const std::vector<std::size_t>& inpoel, std::size_t nnpe) -> std::pair<std::vector<std::size_t>, std::vector<std::size_t>>
Generate derived data structure, elements surrounding points.
auto genPsup(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup) -> std::pair<std::vector<std::size_t>, std::vector<std::size_t>>
Generate derived data structure, points surrounding points.
auto genEdsup(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup) -> std::pair<std::vector<std::size_t>, std::vector<std::size_t>>
Generate derived data structure, edges surrounding points.
auto genInpoed(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup) -> std::vector<std::size_t>
Generate derived data structure, edge connectivity.
auto genEsupel(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup) -> std::pair<std::vector<std::size_t>, std::vector<std::size_t>>
Generate derived data structure, elements surrounding points of elements.
auto genEsuel(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup) -> std::pair<std::vector<std::size_t>, std::vector<std::size_t>>
Generate derived data structure, elements surrounding elements.
auto genInedel(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::vector<std::size_t>& inpoed) -> std::vector<std::size_t>
Generate derived data structure, edges of elements.
auto genEsued(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup) -> std::unordered_map<UnsMesh::Edge, std::vector<std::size_t>, UnsMesh::Hash<2>, UnsMesh::Eq<2>>
Generate derived data structure, elements surrounding edges.
auto genNbfacTet(std::size_t tnbfac, const std::vector<std::size_t>& inpoel, const std::vector<std::size_t>& triinpoel_complete, const std::map<int, std::vector<std::size_t>>& bface_complete, const std::unordered_map<std::size_t, std::size_t>& lid, std::vector<std::size_t>& triinpoel, std::map<int, std::vector<std::size_t>>& bface) -> std::size_t
Generate total number of boundary faces in this chunk.
auto genEsuelTet(const std::vector<std::size_t>& inpoel, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup) -> std::vector<int>
Generate derived data structure, elements surrounding elements as a fixed length data structure as a full vector, including boundary elements as -1.
auto genNipfac(std::size_t nfpe, std::size_t nbfac, const std::vector<int>& esuelTet) -> std::size_t
Generate number of internal and physical-boundary faces.
auto genEsuf(std::size_t nfpe, std::size_t nipfac, std::size_t nbfac, const std::vector<std::size_t>& belem, const std::vector<int>& esuelTet) -> std::vector<int>
Generate derived data structure, elements surrounding faces.
auto genInpofaTet(std::size_t nipfac, std::size_t nbfac, const std::vector<std::size_t>& inpoel, const std::vector<std::size_t>& triinpoel, const std::vector<int>& esuelTet) -> std::vector<std::size_t>
Generate derived data structure, node-face connectivity.
auto genBelemTet(std::size_t nbfac, const std::vector<std::size_t>& inpofa, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup) -> std::vector<std::size_t>
Generate derived data structure, host/boundary element.
auto genGeoFaceTri(std::size_t nipfac, const std::vector<std::size_t>& inpofa, const UnsMesh::Coords& coord) -> Fields
Generate derived data structure, face geometry.
auto normal(const std::array<real, 3>& x, const std::array<real, 3>& y, const std::array<real, 3>& z) -> std::array<real, 3>
Compute the unit normal vector of a triangle.
auto area(const std::array<real, 3>& x, const std::array<real, 3>& y, const std::array<real, 3>& z) -> real
Compute the area of a triangle.
auto geoFaceTri(const std::array<real, 3>& x, const std::array<real, 3>& y, const std::array<real, 3>& z) -> Fields
Compute geometry of the face given by three vertices.
auto genGeoElemTet(const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord) -> Fields
Generate derived data structure, element geometry.
auto leakyPartition(const std::vector<int>& esueltet, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord) -> bool
Perform leak-test on mesh (partition)
auto conforming(const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, bool cerr, const std::vector<std::size_t>& rid) -> bool
Check if mesh (partition) is conforming.
auto intet(const std::array<std::vector<real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<real>& p, std::size_t e, std::array<real, 4>& N) -> bool
Determine if a point is in a tetrahedron.
auto curl(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& v) -> tk::UnsMesh::Coords
Compute curl of a vector field at nodes of unstructured tetrahedra mesh.
auto div(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& v) -> std::vector<tk::real>
Compute divergence of vector field at nodes of unstructured tetrahedra mesh.
auto grad(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<tk::real>& phi) -> tk::UnsMesh::Coords
Compute gradient of a scalar field at nodes of unstructured tetrahedra mesh.
void normal(real x1, real x2, real x3, real y1, real y2, real y3, real z1, real z2, real z3, real& nx, real& ny, real& nz)
auto area(real x1, real x2, real x3, real y1, real y2, real y3, real z1, real z2, real z3) -> real
auto nodegrad(std::size_t node, const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup, const tk::Fields& U, ncomp_t c) -> std::array<tk::real, 3>
Compute gradient at a mesh node.
auto edgegrad(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<std::size_t>& esued, const tk::Fields& U, ncomp_t c) -> std::array<tk::real, 3>
Compute gradient at a mesh edge.
auto shiftToZero(std::vector<std::size_t>& inpoel) -> std::size_t
Shift node IDs to start with zero in element connectivity.
void remap(std::vector<std::size_t>& ids, const std::vector<std::size_t>& map)
Apply new mapping to vector of indices.
void remap(std::vector<tk::real>& r, const std::vector<std::size_t>& map)
Apply new mapping to vector of real numbers.
auto remap(const std::vector<std::size_t>& ids, const std::vector<std::size_t>& map) -> std::vector<std::size_t>
Create remapped vector of indices using a vector.
void remap(std::vector<std::size_t>& ids, const std::unordered_map<std::size_t, std::size_t>& map)
In-place remap vector of indices using a map.
auto remap(const std::vector<std::size_t>& ids, const std::unordered_map<std::size_t, std::size_t>& map) -> std::vector<std::size_t>
Create remapped vector of indices using a map.
auto remap(const std::map<int, std::vector<std::size_t>>& ids, const std::unordered_map<std::size_t, std::size_t>& map) -> std::map<int, std::vector<std::size_t>>
Create remapped map of vector of indices using a map.
auto renumber(const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& psup) -> std::vector<std::size_t>
Reorder mesh points with the advancing front technique.
auto assignLid(const std::vector<std::size_t>& gid) -> std::unordered_map<std::size_t, std::size_t>
Assign local ids to global ids.
auto global2local(const std::vector<std::size_t>& ginpoel) -> std::tuple<std::vector<std::size_t>, std::vector<std::size_t>, std::unordered_map<std::size_t, std::size_t>>
Generate element connectivity of local node IDs from connectivity of global node IDs also returning the mapping between local to global IDs.
auto positiveJacobians(const std::vector<std::size_t>& inpoel, const std::array<std::vector<real>, 3>& coord) -> bool
Test positivity of the Jacobian for all cells in a mesh.
auto bfacenodes(const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinpoel) -> std::map<int, std::vector<std::size_t>>
Generate nodes of side set faces.
auto eval_gp(const std::size_t igp, const std::array<std::array<tk::real, 3>, 3>& coordfa, const std::array<std::vector<tk::real>, 2>& coordgp) -> std::array<tk::real, 3>
Compute the coordinates of quadrature points for face integral.
auto eval_gp(const std::size_t igp, const std::array<std::array<tk::real, 3>, 4>& coord, const std::array<std::vector<tk::real>, 3>& coordgp) -> std::array<tk::real, 3>
Compute the coordinates of quadrature points for volume integral.
auto eval_dBdx_p1(const std::size_t ndof, const std::array<std::array<tk::real, 3>, 3>& jacInv) -> std::array<std::vector<tk::real>, 3>
Compute the derivatives of basis function for DG(P1)
void eval_dBdx_p2(const std::size_t igp, const std::array<std::vector<tk::real>, 3>& coordgp, const std::array<std::array<tk::real, 3>, 3>& jacInv, std::array<std::vector<tk::real>, 3>& dBdx)
Compute the derivatives of basis function for DG(P2)
auto eval_basis(const std::size_t ndof, const tk::real xi, const tk::real eta, const tk::real zeta) -> std::vector<tk::real>
Compute the Dubiner basis functions.
auto eval_state(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_el, const std::size_t e, const Fields& U, const std::vector<tk::real>& B, const std::array<std::size_t, 2>& VarRange) -> std::vector<tk::real>
Compute the state variables for the tetrahedron element.
auto DubinerToTaylor(ncomp_t ncomp, ncomp_t offset, const std::size_t e, const std::size_t ndof, const tk::Fields& U, const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& coord) -> std::vector<std::vector<tk::real>>
Transform the solution with Dubiner basis to the solution with Taylor basis.
void TaylorToDubiner(ncomp_t ncomp, std::size_t e, std::size_t ndof, const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& coord, const tk::Fields& geoElem, std::vector<std::vector<tk::real>>& unk)
Convert the solution with Taylor basis to the solution with Dubiner basis.
auto eval_TaylorBasis(const std::size_t ndof, const std::array<tk::real, 3>& x, const std::array<tk::real, 3>& x_c, const std::array<std::array<tk::real, 3>, 4>& coordel) -> std::vector<tk::real>
Evaluate the Taylor basis at points.
void bndSurfInt(ncomp_t system, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::vector<bcconf_t>& bcconfig, const inciter::FaceData& fd, const Fields& geoFace, const Fields& geoElem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, real t, const RiemannFluxFn& flux, const VelFn& vel, const StateFn& state, const Fields& U, const Fields& P, const std::vector<std::size_t>& ndofel, Fields& R, std::vector<std::vector<tk::real>>& vriem, std::vector<std::vector<tk::real>>& riemannLoc, std::vector<std::vector<tk::real>>& riemannDeriv, int intsharp)
Compute boundary surface flux integrals for a given boundary type for DG.
void update_rhs_bc(ncomp_t ncomp, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_l, const tk::real wt, const std::array<tk::real, 3>& fn, const std::size_t el, const std::vector<tk::real>& fl, const std::vector<tk::real>& B_l, Fields& R, std::vector<std::vector<tk::real>>& riemannDeriv)
Update the rhs by adding the boundary surface integration term.
void initialize(ncomp_t system, ncomp_t ncomp, ncomp_t offset, const Fields& L, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const InitializeFn& solution, Fields& unk, real t, const std::size_t nielem)
void update_rhs(ncomp_t ncomp, const std::size_t ndof, const tk::real wt, const std::vector<tk::real>& B, const std::vector<tk::real>& s, std::vector<tk::real>& R)
Update the rhs by adding the initial analytical solution term.
void eval_init(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::size_t e, const std::vector<tk::real>& R, const Fields& L, Fields& unk)
Compute the initial conditions.
template<class eq>
void BoxElems(std::size_t system, const tk::Fields& geoElem, std::size_t nielem, std::vector<std::unordered_set<std::size_t>>& inbox)
void mass(ncomp_t ncomp, ncomp_t offset, ncomp_t ndof, const Fields& geoElem, Fields& l)
Compute the block-diagnoal mass matrix for DG.
auto lump(ncomp_t ncomp, const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel) -> tk::Fields
Compute lumped mass matrix for CG.
void nonConservativeInt(] ncomp_t system, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const Fields& U, const Fields& P, const std::vector<std::vector<tk::real>>& riemannDeriv, const std::vector<std::vector<tk::real>>& vriempoly, const std::vector<std::size_t>& ndofel, Fields& R, int intsharp)
void updateRhsNonCons(ncomp_t ncomp, ncomp_t offset, const std::size_t nmat, const std::size_t ndof, ] const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::vector<tk::real>& B, ] const std::array<std::vector<tk::real>, 3>& dBdx, const std::vector<std::vector<tk::real>>& ncf, Fields& R)
void pressureRelaxationInt(ncomp_t system, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const Fields& U, const Fields& P, const std::vector<std::size_t>& ndofel, const tk::real ct, Fields& R, int intsharp)
Compute volume integrals of pressure relaxation terms in multi-material DG.
void updateRhsPre(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, ] const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::vector<tk::real>& B, std::vector<tk::real>& ncf, Fields& R)
auto solvevriem(std::size_t nelem, const std::vector<std::vector<tk::real>>& vriem, const std::vector<std::vector<tk::real>>& riemannLoc) -> std::vector<std::vector<tk::real>>
Solve the reconstruct velocity used for volume fraction equation.
void evaluRiemann(ncomp_t ncomp, const int e_left, const int e_right, const std::size_t nmat, const std::vector<tk::real>& fl, const std::array<tk::real, 3>& fn, const std::array<tk::real, 3>& gp, const std::array<std::vector<tk::real>, 2>& state, std::vector<std::vector<tk::real>>& vriem, std::vector<std::vector<tk::real>>& riemannLoc)
Compute the riemann velociry at the interface.
void nonConservativeInt(ncomp_t system, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const Fields& U, const Fields& P, const std::vector<std::vector<tk::real>>& riemannDeriv, const std::vector<std::vector<tk::real>>& vriempoly, const std::vector<std::size_t>& ndofel, Fields& R, int intsharp)
Compute volume integrals of non-conservative terms for multi-material DG.
void updateRhsNonCons(ncomp_t ncomp, ncomp_t offset, const std::size_t nmat, const std::size_t ndof, const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::vector<tk::real>& B, const std::array<std::vector<tk::real>, 3>& dBdx, const std::vector<std::vector<tk::real>>& ncf, Fields& R)
Update the rhs by adding the non-conservative term integrals.
void updateRhsPre(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::vector<tk::real>& B, std::vector<tk::real>& ncf, Fields& R)
Update the rhs by adding the pressure relaxation integrals.
auto NGvol(const std::size_t ndof) -> std::size_t constexpr
auto NGfa(const std::size_t ndof) -> std::size_t constexpr
auto NGdiag(const std::size_t ndof) -> std::size_t constexpr
Initialization of number of Gauss points for volume integration in error estimation.
auto NGinit(const std::size_t ndof) -> std::size_t constexpr
Initialization of number of Gauss points for volume integration in DG initialization.
void GaussQuadratureTet(std::size_t NG, std::array<std::vector<real>, 3>& coordgp, std::vector<real>& wgp)
Initialize Gaussian quadrature points locations and weights for a tetrahedron.
void GaussQuadratureTri(std::size_t NG, std::array<std::vector<real>, 2>& coordgp, std::vector<real>& wgp)
Initialize Gaussian quadrature points locations and weights for a triangle.
void srcInt(ncomp_t system, ncomp_t offset, real t, const std::size_t ndof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const CompFlowSrcFn& src, const std::vector<std::size_t>& ndofel, Fields& R)
Compute source term integrals for DG.
void update_rhs(ncomp_t offset, const std::size_t ndof, const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::vector<tk::real>& B, const std::array<tk::real, 5>& s, Fields& R)
Update the rhs by adding the source term integrals.
void surfInt(ncomp_t system, std::size_t nmat, ncomp_t offset, real t, const std::size_t ndof, const std::size_t rdof, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const inciter::FaceData& fd, const Fields& geoFace, const Fields& geoElem, const RiemannFluxFn& flux, const VelFn& vel, const Fields& U, const Fields& P, const std::vector<std::size_t>& ndofel, Fields& R, std::vector<std::vector<tk::real>>& vriem, std::vector<std::vector<tk::real>>& riemannLoc, std::vector<std::vector<tk::real>>& riemannDeriv, int intsharp)
Compute internal surface flux integrals for DG.
void update_rhs_fa(ncomp_t ncomp, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_l, const std::size_t ndof_r, const tk::real wt, const std::array<tk::real, 3>& fn, const std::size_t el, const std::size_t er, const std::vector<tk::real>& fl, const std::vector<tk::real>& B_l, const std::vector<tk::real>& B_r, Fields& R, std::vector<std::vector<tk::real>>& riemannDeriv)
void volInt(ncomp_t system, std::size_t nmat, ncomp_t offset, real t, const std::size_t ndof, const std::size_t rdof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const FluxFn& flux, const VelFn& vel, const Fields& U, const Fields& P, const std::vector<std::size_t>& ndofel, Fields& R, int intsharp = 0)
Compute volume integrals for DG.
void update_rhs(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::array<std::vector<tk::real>, 3>& dBdx, const std::vector<std::array<tk::real, 3>>& fl, Fields& R)
Update the rhs by adding the source term integrals.
void lhsLeastSq_P0P1(const inciter::FaceData& fd, const Fields& geoElem, const Fields& geoFace, std::vector<std::array<std::array<real, 3>, 3>>& lhs_ls)
Compute lhs matrix for the least-squares reconstruction.
void intLeastSq_P0P1(ncomp_t offset, const std::size_t rdof, const inciter::FaceData& fd, const Fields& geoElem, const Fields& W, std::vector<std::vector<std::array<real, 3>>>& rhs_ls, const std::array<std::size_t, 2>& varRange)
Compute internal surface contributions to the least-squares reconstruction.
void bndLeastSqConservedVar_P0P1(ncomp_t system, ncomp_t ncomp, ncomp_t offset, std::size_t rdof, const std::vector<bcconf_t>& bcconfig, const inciter::FaceData& fd, const Fields& geoFace, const Fields& geoElem, real t, const StateFn& state, const Fields& P, const Fields& U, std::vector<std::vector<std::array<real, 3>>>& rhs_ls, const std::array<std::size_t, 2>& varRange, std::size_t nprim)
Compute boundary surface contributions to rhs vector of the least-squares reconstruction of conserved quantities of the PDE system.
void solveLeastSq_P0P1(ncomp_t offset, const std::size_t rdof, const std::vector<std::array<std::array<real, 3>, 3>>& lhs, const std::vector<std::vector<std::array<real, 3>>>& rhs, Fields& W, const std::array<std::size_t, 2>& varRange)
Solve 3x3 system for least-squares reconstruction.
void recoLeastSqExtStencil(std::size_t rdof, std::size_t offset, std::size_t e, const std::map<std::size_t, std::vector<std::size_t>>& esup, const std::vector<std::size_t>& inpoel, const Fields& geoElem, Fields& W, const std::array<std::size_t, 2>& varRange)
Reconstruct the second-order solution using least-squares approach from an extended stencil involving the node-neighbors.
void transform_P0P1(ncomp_t offset, std::size_t rdof, std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, Fields& W, const std::array<std::size_t, 2>& varRange)
Transform the reconstructed P1-derivatives to the Dubiner dofs.
void THINCReco(std::size_t system, std::size_t offset, std::size_t rdof, std::size_t nmat, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const std::array<real, 3>& ref_xp, const Fields& U, const Fields& P, ] const std::vector<real>& vfmin, ] const std::vector<real>& vfmax, std::vector<real>& state)
void THINCRecoTransport(std::size_t system, std::size_t offset, std::size_t rdof, std::size_t, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const std::array<real, 3>& ref_xp, const Fields& U, const Fields&, ] const std::vector<real>& vfmin, ] const std::vector<real>& vfmax, std::vector<real>& state)
Compute THINC reconstructions for linear advection (transport)
void THINCFunction(std::size_t rdof, std::size_t nmat, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const std::array<real, 3>& ref_xp, real vol, real bparam, const std::vector<real>& alSol, bool intInd, const std::vector<std::size_t>& matInt, std::vector<real>& alReco)
Old THINC reconstruction function for volume fractions near interfaces.
void THINCFunction_new(std::size_t rdof, std::size_t nmat, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const std::array<real, 3>& ref_xp, real vol, real bparam, const std::vector<real>& alSol, bool intInd, const std::vector<std::size_t>& matInt, std::vector<real>& alReco)
New THINC reconstruction function for volume fractions near interfaces.
auto evalPolynomialSol(std::size_t system, std::size_t offset, int intsharp, std::size_t ncomp, std::size_t nprim, std::size_t rdof, std::size_t nmat, std::size_t e, std::size_t dof_e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const std::array<real, 3>& ref_gp, const std::vector<real>& B, const Fields& U, const Fields& P) -> std::vector<tk::real>
Evaluate polynomial solution at quadrature point.
void safeReco(std::size_t offset, std::size_t rdof, std::size_t nmat, std::size_t el, int er, const Fields& U, std::array<std::vector<real>, 2>& state)
Compute safe reconstructions near material interfaces.
void THINCReco(std::size_t system, std::size_t offset, std::size_t rdof, std::size_t nmat, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const std::array<real, 3>& xp, const Fields& U, const Fields& P, const std::vector<real>& vfmin, const std::vector<real>& vfmax, std::vector<real>& state)
Compute THINC reconstructions near material interfaces.
auto serialize(std::size_t meshid, const std::vector<tk::UniPDF>& u) -> std::pair<int, std::unique_ptr<char[]>>
Serialize univariate PDF to raw memory stream.
auto mergeUniPDFs(int nmsg, CkReductionMsg** msgs) -> CkReductionMsg*
Charm++ custom reducer for merging a univariate PDF during reduction across PEs.
auto serialize(const std::vector<tk::UniPDF>& u, const std::vector<tk::BiPDF>& b, const std::vector<tk::TriPDF>& t) -> std::pair<int, std::unique_ptr<char[]>>
Serialize vectors of PDFs to raw memory stream.
auto mergePDF(int nmsg, CkReductionMsg** msgs) -> CkReductionMsg*
Charm++ custom reducer for merging PDFs during reduction across PEs.
static auto operator<<(std::ostream& os, const tk::UniPDF& p) -> std::ostream&

Variables

const uint8_t UnkEqComp
Tags for selecting data layout policies.
const std::array<std::size_t, 2> ExoNnpe
const std::array<std::array<std::size_t, 3>, 4> expofa
const std::array<UnsMesh::Face, 4> lpofa
const std::array<UnsMesh::Edge, 6> lpoed
Const array defining the node ordering convention for tetrahedron edges.
const std::array<UnsMesh::Edge, 3> lpoet
Const array defining the node ordering convention for triangle edges.
static highwayhash::HH_U64 hh_key constexpr
static std::stringstream cerr_quiet
std::tringstream used to quiet std::cerr's stream by redirecting to it
static std::streambuf* cerr_old
std::streambuf used to store state of std::cerr before redirecting it

Enum documentation

enum tk::ErrCode

Error codes for the OS (or whatever calls us)

Enumerators
SUCCESS

Everything went fine.

FAILURE

Exceptions occurred.

enum class tk::ExoElemType: int

Supported ExodusII mesh cell types

Enumerators
TET
TRI

enum class tk::Centering: char

Mesh/scheme centering types

Enumerators
NODE
ELEM

Typedef documentation

template<class li, class lo>
using tk::cartesian_product = brigand::reverse_fold<brigand::list<li, lo>, brigand::list<brigand::list<>>, brigand::bind<brigand::join, brigand::bind<brigand::transform, brigand::_2, brigand::defer<brigand::bind<brigand::join, brigand::bind<brigand::transform, brigand::parent<brigand::_1>, brigand::defer<brigand::bind<brigand::list, brigand::bind<brigand::push_front, brigand::_1, brigand::parent<brigand::_1>>>>>>>>>>

Cartesian product of two brigand lists

template<std::size_t N>
using tk::Table = std::vector<std::array<real, N+1>>

Template parameters
N Number of ordinates in the table

Type alias for storing a discrete (y1,y2,...,yN) = f(x) function

using tk::NodeCommMap = std::unordered_map<int, NodeSet>

Node communication map type

Global mesh node IDs bordering the mesh chunk held by fellow chares associated to chare IDs

using tk::EdgeCommMap = std::unordered_map<int, EdgeSet>

Edge communication map type

Edge-end points with global mesh node IDs bordering the mesh chunk held by fellow chares associated to chare IDs

using tk::CommMaps = std::map<int, AllCommMaps>

Communication map bundle type

All types of communication maps bundled and associated to chare IDs

using tk::InitializeFn = std::function<std::vector<real>(ncomp_t, ncomp_t, real, real, real, real)>

Function prototype for Problem::intiialize() functions

Functions of this type are used to initialize the computed fields

using tk::RiemannFluxFn = std::function<std::vector<real>(const std::array<real, 3>&, const std::array<std::vector<real>, 2>&, const std::vector<std::array<real, 3>>&)>

Function prototype for Riemann flux functions

Functions of this type are used to compute numerical fluxes across a surface using a Riemann solver

using tk::FluxFn = std::function<std::vector<std::array<real, 3>>(ncomp_t, ncomp_t, const std::vector<real>&, const std::vector<std::array<real, 3>>&)>

Function prototype for flux vector functions

Functions of this type are used to compute physical flux functions in the PDEs being solved. These are different than the RiemannFluxFn because they compute the actual flux functions, not the solution to a Riemann problem.

using tk::VelFn = std::function<std::vector<std::array<tk::real, 3>>(ncomp_t, ncomp_t, real, real, real, real)>

Function prototype for evaluating a prescribed velocity field

Functions of this type are used to prescribe known velocity fields

using tk::StateFn = std::function<std::array<std::vector<real>, 2>(ncomp_t, ncomp_t, const std::vector<real>&, real, real, real, real, const std::array<tk::real, 3>&)>

Function prototype for physical boundary states

Functions of this type are used to provide the left and right states of boundary faces along physical boundaries

using tk::CompFlowSrcFn = std::function<void(ncomp_t, tk::real, tk::real, tk::real, tk::real, tk::real&, tk::real&, tk::real&, tk::real&, tk::real&)>

Function prototype for evaluating a source term for CompFlow

Functions of this type are used to evaluate an arbitrary source term specialized to a particular CompFlow problem, e.g., derived using the method of manufactured solutions

using tk::MultiMatSrcFn = std::function<void(ncomp_t, ncomp_t, tk::real, tk::real, tk::real, tk::real, tk::real&, tk::real&, tk::real&, tk::real&, tk::real&)>

Function prototype for evaluating a source term for MultiMat

Functions of this type are used to evaluate an arbitrary source term specialized to a particular MultiMat problem, e.g., derived using the method of manufactured solutions

Function documentation

template<class Container>
void tk::unique(Container& c)

Parameters
in/out Container

Make elements of container unique (in-place, overwriting source container)

template<class Container>
Container tk::uniquecopy(const Container& src)

Parameters
src in Container
Returns Container containing only unique elements compared to src

Make elements of container unique (on a copy, leaving the source as is)

template<typename Container>
auto tk::cref_find(const Container& map, const typename Container::key_type& key) -> const typename Container::mapped_type &

Find and return a constant reference to value for key in container that provides a find() member function with error handling.

Parameters
map in Map associating values to keys
key in Key to search for
Returns A constant reference to the value associated to the key in map

template<typename Container>
auto tk::ref_find(const Container& map, const typename Container::key_type& key) -> typename Container::mapped_type &

Find and return a reference to value for key in a container that provides a find() member function with error handling.

Parameters
map in Map associating values to keys
key in Key to search for
Returns A reference to the value associated to the key in map

template<typename T>
std::array<T, 2> tk::extents(const std::vector<T>& vec)

Return minimum and maximum values of a vector.

Parameters
vec in Vector whose extents to compute
Returns Array of two values with the minimum and maximum values

template<typename Container>
auto tk::extents(const Container& map) -> std::array< typename Container::mapped_type, 2 >

Find and return minimum and maximum values in associative container.

Parameters
map in Map whose extents of values to find
Returns Array of two values with the minimum and maximum values in the map

template<class T, std::size_t N>
std::array<T, N>& tk::operator+=(std::array<T, N>& dst, const std::array<T, N>& src)

Parameters
dst in/out Destination array, i.e., left-hand side of a1 += a2
src in Source array, i.e., righ-hand side of a1 += a2
Returns Destination containing a1[0] += a2[0], a1[1] += a2[1], ...

Add all elements of an array to those of another one

template<class T, class Allocator>
std::vector<T, Allocator>& tk::operator+=(std::vector<T, Allocator>& dst, const std::vector<T, Allocator>& src)

Parameters
dst in/out Destination vector, i.e., left-hand side of v1 += v2
src in Source vector, i.e., righ-hand side of v1 += v2
Returns Destination containing v1[0] += v2[0], v1[1] += v2[1], ...

Add all elements of a vector to those of another one If src.size() > dst.size() will grow dst to that of src.size() padding with zeros.

template<class T, class Allocator>
std::vector<T, Allocator>& tk::operator/=(std::vector<T, Allocator>& dst, const std::vector<T, Allocator>& src)

Parameters
dst in/out Destination vector, i.e., left-hand side of v1 /= v2
src in Source vector, i.e., righ-hand side of v1 /= v2
Returns Destination containing v1[0] /= v2[0], v1[1] /= v2[1], ...

Divide all elements of a vector with those of another one If src.size() > dst.size() will grow dst to that of src.size() padding with zeros.

template<class C1, class C2>
bool tk::keyEqual(const C1& a, const C2& b)

Parameters
in 1st container to compare
in 2nd container to compare
Returns True if the containers have the same size and all keys (and only the keys) of the two containers are equal

Test if all keys of two associative containers are equal

template<class Container>
std::size_t tk::sumsize(const Container& c)

Parameters
in Container of containers
Returns Sum of the sizes of the containers of the container

Compute the sum of the sizes of a container of containers

template<class Container>
std::size_t tk::numunique(const Container& c)

Parameters
in Container of containers
Returns Number of unique values in a container of containers

Compute the number of unique values in a container of containers

template<class Map>
std::size_t tk::sumvalsize(const Map& c)

Template parameters
Map Container of containers type
Parameters
in Container of containers
Returns Sum of the sizes of the values of the associative container

Compute the sum of the sizes of the values of an associative container

template<class Container>
void tk::destroy(Container& c)

Parameters
in Container defining a swap() member function

Free memory of a container See http://stackoverflow.com/a/10465032 as to why this is done with the swap() member function of the container.

template<typename Container, typename Predicate>
void tk::erase_if(Container& items, const Predicate& predicate)

Template parameters
Container Type of container to remove from
Predicate Type for functor defining the predicate
Parameters
items Container object to remove from
predicate Predicate object instance to use

Remove items from container based on predicate

template<class T>
void tk::concat(std::vector<T>&& src, std::vector<T>& dst)

Template parameters
T Vector value type
Parameters
src in/out Source vector (moved from)
dst in/out Destination vector

Concatenate vectors of T

template<class T>
void tk::concat(std::vector<std::pair<bool, T>>&& src, std::vector<std::pair<bool, T>>& dst)

Template parameters
T Vector value type
Parameters
src in/out Source vector (moved from)
dst in/out Destination vector

Overwrite vectors of pair< bool, tk::real >

template<class Key, class Hash = std::hash<Key>, class Eq = std::equal_to<Key>>
void tk::concat(std::unordered_set<Key, Hash, Eq>&& src, std::unordered_set<Key, Hash, Eq>& dst)

Template parameters
Key Set key
Hash Set hasher
Eq Set equality operator
Parameters
src in/out Source set (moved from)
dst in/out Destination set

Concatenate unordered sets

template<class Key, class Value>
std::ostream& tk::operator<<(std::ostream& os, const std::pair<const Key, Value>& v)

Parameters
os in/out Output stream to write to
in value_type entry of a map
Returns Updated output stream

Operator << for writing value_type of a standard map to output streams

template<typename T>
std::string tk::parameter(const T& v)

Convert and return value as string.

Template parameters
T Value type for input
Parameters
in Value for input to return as a string
Returns String for input value

template<typename V>
std::string tk::parameters(const V& v)

Convert and return values from container as string.

Template parameters
V Container range for works on
Parameters
in Container whose components to return as a string
Returns Concatenated string of values read from a container

template<uint8_t Layout>
Data<Layout> tk::operator*(tk::real lhs, const Data<Layout>& rhs)

Parameters
lhs in Scalar to multiply with
rhs in Date object to multiply
Returns New Data object with all items multipled with lhs

Operator * multiplying all items by a scalar from the left

template<uint8_t Layout>
Data<Layout> tk::min(const Data<Layout>& a, const Data<Layout>& b)

Parameters
in 1st Data object
in 2nd Data object
Returns New Data object containing the minimum of all values for each value in a and b

Operator min between two Data objects

template<uint8_t Layout>
Data<Layout> tk::max(const Data<Layout>& a, const Data<Layout>& b)

Parameters
in 1st Data object
in 2nd Data object
Returns New Data object containing the maximum of all values for each value in a and b

Operator max between two Data objects

template<uint8_t Layout>
bool tk::operator==(const Data<Layout>& lhs, const Data<Layout>& rhs)

Parameters
lhs in Data object to compare
rhs in Data object to compare
Returns True if all entries are equal up to epsilon

Operator == between two Data objects

template<uint8_t Layout>
bool tk::operator!=(const Data<Layout>& lhs, const Data<Layout>& rhs)

Parameters
lhs in Data object to compare
rhs in Data object to compare
Returns True if all entries are unequal up to epsilon

Operator != between two Data objects

template<uint8_t Layout>
std::pair<std::size_t, tk::real> tk::maxdiff(const Data<Layout>& lhs, const Data<Layout>& rhs)

Parameters
lhs in 1st Data object
rhs in 2nd Data object
Returns The index, i.e., the raw position, of and the largest absolute value of the difference between all corresponding elements of lhs and rhs.

Compute the maximum difference between the elements of two Data objects The position returned is the position in the underlying raw data structure, independent of components, offsets, etc. If lhs == rhs with precision std::numeric_limits< tk::real >::epsilon(), a pair of (0,0.0) is returned.

template<class C, class Key, class Factory, typename... ConstructorArgs>
void tk::record(Factory& f, const Key& key, ConstructorArgs&&... args)

Parameters
in Factory to register to (std::map with value using reference semantics)
key in Key used to identify the entry in the factory
args in Variable number of arguments to pass to the constructor being registered. Note that the constructor arguments are only bound to the constructor and stored in the factory (an std::map with value using reference semantics). The object is not instantiated here, i.e., the constructor is not called here. The object can be instantiated by function instantiate.

Register class into factory with given key. This is used to register a derived-class object's constructor (deriving from some base class) to a factory. The factory itself is a std::map< key, std::function< Child*() > >, i.e., an associative container, associating some key to a std::function object holding a pointer of Child's base class constructor. The constructor and its bound arguments are stored via boost::factory, which, in this use-case, yields the correct function object of type Base constructor pointer and thus facilitates runtime polymorphism. This function works in conjunction with boost::factory, i.e., uses reference semantics (works with storing pointers of objects). For a simple example on how to use this function, see tests/unit/Base/Factory.h.

template<class Factory, class Key, class Obj = typename std::remove_pointer< typename Factory::mapped_type::result_type>::type>
std::unique_ptr<Obj> tk::instantiate(const Factory& f, const Key& key)

Parameters
in Factory to instantiate object from (std::map with value using reference semantics)
key in Key used to identify the object to instantiate from factory
Returns std::unique_ptr pointing to the object instantiated from factory

Instantiate object from factory. Factory must have a mapped_value which must have a result_type ptr, e.g., std::map< Key, std::function< Obj*() > >. This wrapper function can be used to instantiate an derived-class object from a factory, repeatedly filled with wrapper function 'record' above. The factory, as described in the documentation of 'record', stores base class pointers in an associative container, thereby facilitating runtime polymorphism and a simple lookup-and-instantiate-style object creation. The object instantiated is of type Child class. This function works in conjunction with boost::factory, i.e., uses reference semantics (works with storing pointers of objects). For a simple example on how to use this function, see tests/unit//Base/Factory.h.

template<class Host, class ModelConstructor, class Factory, class Key, typename... ModelConstrArgs>
void tk::recordModel(Factory& f, const Key& key, ModelConstrArgs&&... args)

Parameters
in Factory to register to (std::map with value using value semantics)
key in Key used to identify the entry in the factory
args in Variable number of arguments to pass to the constructor being registered. Note that the constructor arguments are only bound to the constructor and stored in the factory (an std::map with value using value semantics). The object is not instantiated here, i.e., the constructor is not called here. The object can be instantiated by simply calling the function call operator () on the mapped value. For an example, RNGStack::selected() in RNG/RNGStack.C.

Register "model" class of "host" into factory with given key. This wrapper can be used to in a similar manner to 'record', but uses boost::value_factory to bind the model object constructor to its arguments and place it in the associative container storing host class objects. The container is thus of type std::map< key, std::function< T() > >, i.e., associating a key to a function holding a constructor (and not its pointer). Runtime polymorphism here is realized entirely within the "base" class. See walker::DiffEq in DiffEq/DiffEq.h for an example and more information on runtime polymorphism without client-side inheritance. As a result, this wrapper works with factories that use value semantics, as opposed to 'record' and instantiate which work with reference semantics factories. In order to differentiate between runtime polymorphic classes using reference semantics, consistent with classes realizing runtime polymorphism without client-side inheritance, we call Host as the "Base" class and Model as the "derived" (or child) class. This wrapper function works in conjunction with boost::value_factory, i.e., uses value semantics (works with storing objects instead of object pointers). For a simple example on how to use this function, see tests/unit//Base/Factory.h.

template<class Host, class ModelConstructor, class Factory, class Key, typename ModelConstrArg>
void tk::recordModelLate(Factory& f, const Key& key, ModelConstrArg)

Parameters
in Factory to register to (std::map with value using value semantics)
key in Key used to identify the entry in the factory

Register model class of host into factory with given key using late binding. This variant of 'record' is very similar to 'recordModel', but registers a model class constructor to a factory with late binding of the constructor argument. Late binding allows specifying the constructor argument at the time when the object is instantiated instead of at the time when it is registered. This has all the benefits of using a factory and allows passing information into the model object only when it is available. The late bind is facilitated via std::bind instead of std::bind using a placeholder, _1, which stands for the first argument (bound later, i.e., not here). The value of the model constructor argument is then not used here, only its type, used to perform the late binding. The binding happens to both the model constructor via std::function (passed to the host constructor) as well as explicitly to the host constructor. Prescribing late binding to the model constructor ensures that the compiler requires the argument to the model constructor, i.e., ensures that the host constructor is required to pass the argument to the model constructor. Prescribing late binding to the host constructor puts in the actual request that an argument (with the correct type) must be passed to the host constructor at instantiate time, which then will forward it to the model constructor. See also, for example, walker::DiffEq's corresponding constructor. An example of client-side code is in walker::DiffEqStack::registerDiffEq for registration into factory, and DiffEqStack::createDiffEq for instantiation late-passing the argument.

template<class Host, class ModelConstructor, class Factory, class Key, typename... ModelConstrArgs>
void tk::recordCharmModel(Factory& f, const Key& key, ModelConstrArgs&&... args)

Parameters
in Factory to register to (std::map with value using value semantics)
key in Key used to identify the entry in the factory
args in Variable number of arguments to pass to the constructor being registered.

Register Charm++ model class of host into factory with given key. We bind a host constructor to its arguments of which the first one is a std::function holding a model constructor type (modeling, i.e., used polymorhically with host), followed by an optional number of others (possibly zero) with arbitrary types. Note that the model constructor is a nullptr (default- constructed) and only used to forward its type to the call site inside std::function. The host constructor function is then placed into the factory. This is because Charm++ chares do not explicitly invoke constructors, only call ckNew() on their proxy, which requires all constructor arguments to be present and forwarded to the actual constructor that is only called at a later point in time. This can then be used by those constructors of hosts that invoke the model constructors' proxies' ckNew() and ignore the std::function. See, e.g., rngtest::Battery() and the associated unit tests in tests/unit//Base/Factory.h.

template<typename A, typename B>
std::pair<B, A> tk::flip_pair(const std::pair<A, B>& p)

Parameters
in std::pair of arbitrary types, A and B
Returns std::pair of arbitrary types, B and A

Flip a std::pair of arbitrary types

template<typename A, typename B>
std::multimap<B, A> tk::flip_map(const std::map<A, B>& src)

Parameters
src in std::map of arbitrary key and value pairs of types A and B
Returns std::multimap of arbitrary key and value pairs of types B and A

Flip a std::map of arbitrary types, yielding a std::multimap sorted by std::map::value_type.

template<class Key, class T, class Hash = std::hash<Key>, class Eq = std::equal_to<Key>>
std::pair<int, std::unique_ptr<char[]>> tk::serialize(const std::unordered_map<Key, T, Hash, Eq>& m)

Template parameters
Key Map key
T Map value
Hash Map hasher
Eq Map equality operator
Parameters
in Hash map to serialize
Returns Pair of the length and the raw stream containing the serialized map

Serialize std::unordered_map to raw memory stream

template<class Key, class T, class Hash = std::hash<Key>, class Eq = std::equal_to<Key>>
CkReductionMsg* tk::mergeHashMap(int nmsg, CkReductionMsg** msgs)

Charm++ custom reducer for merging std::unordered_maps during reduction across PEs.

Template parameters
Key Map key
T Map value
Hash Map hasher
Eq Map equality operator
Parameters
nmsg in Number of messages in msgs
msgs in Charm++ reduction message containing the serialized maps
Returns Aggregated std::unordered_maps built for further aggregation if needed

During aggregation the map keys are inserted, i.e., the keys remain unique and the mapped values, assuming containers defining begin() and end() iterators() are concatenated.

uint64_t tk::linearLoadDistributor(real virtualization, uint64_t load, int npe, uint64_t& chunksize, uint64_t& remainder)

Compute linear load distribution for given total work and virtualization.

Parameters
virtualization in Degree of virtualization [0.0...1.0]
load in Total load, e.g., number of particles, number of mesh cells
npe in Number of processing elements to distribute the load to
chunksize in/out Chunk size, see detailed description
remainder in/out Remainder, see detailed description
Returns Number of work units

Compute load distibution (number of chares and chunksize) based on total work (e.g., total number of particles) and virtualization

The virtualization parameter, specified by the user, is a real number between 0.0 and 1.0, inclusive, which controls the degree of virtualization or over-decomposition. Independent of the value of virtualization the work is approximately evenly distributed among the available processing elements, given by npe. For zero virtualization (no over-decomposition), the work is simply decomposed into total_work/numPEs, which yields the smallest number of Charm++ chares and the largest chunks of work units. The other extreme is unity virtualization, which decomposes the total work into the smallest size work units possible, yielding the largest number of Charm++ chares. Obviously, the optimum will be between 0.0 and 1.0, depending on the problem.

The formula implemented uses a linear relationship between the virtualization parameter and the number of work units with the extremes described above. The formula is given by

chunksize = (1 - n) * v + n;

where

  • v = degree of virtualization
  • n = load/npes
  • load = total work, e.g., number of particles, number of mesh cells
  • npes = number of hardware processing elements

template<typename Enum, typename Ch, typename Tr, typename std::enable_if_t<std::is_enum_v<Enum>, int> = 0>
std::basic_ostream<Ch, Tr>& tk::operator<<(std::basic_ostream<Ch, Tr>& os, const Enum& e)

Parameters
os in Output stream into to write to
in Value of enum-class type to write to stream
Returns Updated output stream for chain-use of the operator

Operator << for writing an enum class to an output stream

template<class T, typename Ch, typename Tr>
std::basic_ostream<Ch, Tr>& tk::operator<<(std::basic_ostream<Ch, Tr>& os, const std::vector<T>& v)

Parameters
os in Output stream to write to
in Vector to write to stream
Returns Updated output stream for chain-use of the operator

Operator << for writing a std::vector to an output stream

template<typename Ch, typename Tr, class Key, class Value, class Compare = std::less<Key>>
std::basic_ostream<Ch, Tr>& tk::operator<<(std::basic_ostream<Ch, Tr>& os, const std::map<Key, Value, Compare>& m)

Parameters
os in Output stream to write to
in Map to write to stream
Returns Updated output stream for chain-use of the operator

Operator << for writing an std::map to an output stream

template<typename T, typename Ch, typename Tr>
std::basic_string<Ch, Tr> tk::operator<<(std::basic_string<Ch, Tr>& lhs, const T& e)

Parameters
lhs in Output std::basic_string into which e is written
in Value of arbitrary type to write to string
Returns Updated string

Operator << for adding (concatenating) T to a std::basic_string for lvalues.

template<typename T, typename Ch, typename Tr>
std::basic_string<Ch, Tr> tk::operator<<(std::basic_string<Ch, Tr>&& lhs, const T& e)

Parameters
lhs in Output std::basic_string into which e is written
in Value of arbitrary type to write to string
Returns Updated string

Operator << for adding (concatenating) T to a std::basic_string for rvalues.

std::string tk::splitLines(std::string str, std::string indent, const std::string& name = "", std::size_t width = 80)

Clean up whitespaces and format a long string into multiple lines.

Parameters
str in String to format
indent in String to use as identation
name in String to insert before string to output
width in Width in characters to insert newlines for output

std::string tk::baselogname(const std::string& executable)

Parameters
executable in Name of the executable
Returns Base log file name

std::string tk::logname(const std::string& executable, int numrestart = 0)

Construct log file name.

Parameters
executable in Name of the executable
numrestart in Number of times restarted
Returns The name of the log file to use

void tk::rm(const std::string& file)

Remove file from file system.

Parameters
file in File name to delete (shell wildcards NOT expanded)

Since we use pstream's basic_ipstream constructor with signature ( const std::string & file, const argv_type & argv, pmode mode = pstdout ) and the file argument doesn't contain a slash, the actions of the shell are duplicated in searching for an executable in PATH. The shell will not interpret the other arguments, so wildcard expansion will not take place.

void tk::signalHandler(int signum)

Signal handler for multiple signals, SIGABRT, SIGSEGV, etc.

Parameters
signum in Signal number

Signals caught: SIGABRT is generated when the program calls the abort() function, such as when an assert() triggers SIGSEGV is generated when the program makes an illegal memory access, such as reading unaligned memory, dereferencing a null pointer, reading memory out of bounds etc. SIGILL is generated when the program tries to execute a malformed instruction. This happens when the execution pointer starts reading non-program data, or when a pointer to a function is corrupted. SIGFPE is generated when executing an illegal floating point instruction, most commonly division by zero or floating point overflow.

int tk::setSignalHandlers()

Set signal handlers for multiple signals, SIGABRT, SIGSEGV, etc.

Returns Ignore, used for calling in a constructor's initializer list

void tk::processExceptionCharm()

Process an exception from the Charm++ runtime system.

See Josuttis, The C++ Standard Library - A Tutorial and Reference, 2nd Edition, 2012.

template<typename T>
T tk::swap_endian(T u)

Parameters
in Integral type to convert
Returns Converted integer

Swap endianness of an integral type

template<>
double tk::swap_endian(double u)

Parameters
in Double to convert
Returns Converted double

Swap endianness of a double

template<std::size_t N>
std::array<real, N> tk::sample(real x, const Table<N>& table)

Template parameters
N Number of ordinates in the table
Parameters
in Abscissa to sample at
table in Table to sample
Returns Ordinates sampled

Sample a discrete (y1,y2,...,yN) = f(x) function at x

template<class Tuple>
void tk::print(std::ostream& os, const std::string& name, const Tuple& c)

Template parameters
Tuple Tuple object type
Parameters
os in/out Output stream to print to
name in Name of (root) Tuple
in Command line object to output to file

Output command line object (a TaggedTuple) to file

template<class List>
std::ostream& tk::operator<<(std::ostream& os, const tk::TaggedTuple<List>& t)

Template parameters
List brigand::list of types in the tagged tuple
Parameters
os in/out Output stream to output to
in TaggedTuple to print
Returns Output stream

Simple (unformatted, one-line) output of a TaggedTuple to output stream

template<class List, class Ignore = brigand::set<>>
void tk::print(std::ostream& os, const tk::TaggedTuple<List>& t)

Simple (unformatted, one-line) output of a TaggedTuple to output stream with ignore.

Template parameters
List brigand::list of types in the tagged tuple
Ignore brigand::list of types to not print
Parameters
os in/out Output stream to output to
in TaggedTuple to print

Timer::Watch tk::hms(tk::real stamp)

Convert existing time stamp as a real to Watch (global scope)

Parameters
stamp in Time stamp as a real number
Returns Time as hours, minutes, and seconds, as a Watch struct.

Convert existing time stamp as a real to Watch (global-scope)

void tk::flip(std::array<real, 3>& v)

Parameters
in Vector whose components to multiply by -1.0

Flip sign of vector components

void tk::cross(real v1x, real v1y, real v1z, real v2x, real v2y, real v2z, real& rx, real& ry, real& rz)

Parameters
v1x in x coordinate of the 1st vector
v1y in y coordinate of the 1st vector
v1z in z coordinate of the 1st vector
v2x in x coordinate of the 2nd vector
v2y in y coordinate of the 2nd vector
v2z in z coordinate of the 2nd vector
rx out x coordinate of the product vector
ry out y coordinate of the product vector
rz out z coordinate of the product vector

Compute the cross-product of two vectors

std::array<real, 3> tk::cross(const std::array<real, 3>& v1, const std::array<real, 3>& v2)

Parameters
v1 in 1st vector
v2 in 2nd vector
Returns Cross-product

Compute the cross-product of two vectors

void tk::crossdiv(real v1x, real v1y, real v1z, real v2x, real v2y, real v2z, real j, real& rx, real& ry, real& rz)

Parameters
v1x in x coordinate of the 1st vector
v1y in y coordinate of the 1st vector
v1z in z coordinate of the 1st vector
v2x in x coordinate of the 2nd vector
v2y in y coordinate of the 2nd vector
v2z in z coordinate of the 2nd vector
in The scalar to divide the product with
rx out x coordinate of the product vector
ry out y coordinate of the product vector
rz out z coordinate of the product vector

Compute the cross-product of two vectors divided by a scalar

std::array<real, 3> tk::crossdiv(const std::array<real, 3>& v1, const std::array<real, 3>& v2, real j)

Parameters
v1 in 1st vector
v2 in 2nd vector
in Scalar to divide each component by
Returns Cross-product divided by scalar

Compute the cross-product of two vectors divided by a scalar

real tk::dot(const std::array<real, 3>& v1, const std::array<real, 3>& v2)

Parameters
v1 in 1st vector
v2 in 2nd vector
Returns Dot-product

Compute the dot-product of two vectors

real tk::length(real x, real y, real z)

Parameters
in X coordinate of vector
in Y coordinate of vector
in Z coordinate of vector
Returns length

Compute length of a vector

real tk::length(const std::array<real, 3>& v)

Parameters
in vector
Returns length

Compute length of a vector

void tk::unit(std::array<real, 3>& v)

Parameters
in/out Vector to normalize

Scale vector to unit length

tk::real tk::triple(real v1x, real v1y, real v1z, real v2x, real v2y, real v2z, real v3x, real v3y, real v3z)

Parameters
v1x in x coordinate of the 1st vector
v1y in y coordinate of the 1st vector
v1z in z coordinate of the 1st vector
v2x in x coordinate of the 2nd vector
v2y in y coordinate of the 2nd vector
v2z in z coordinate of the 2nd vector
v3x in x coordinate of the 3rd vector
v3y in y coordinate of the 3rd vector
v3z in z coordinate of the 3rd vector
Returns Scalar value of the triple product

Compute the triple-product of three vectors

real tk::triple(const std::array<real, 3>& v1, const std::array<real, 3>& v2, const std::array<real, 3>& v3)

Parameters
v1 in 1st vector
v2 in 2nd vector
v3 in 3rd vector
Returns Triple-product

Compute the triple-product of three vectors

std::array<real, 3> tk::rotateX(const std::array<real, 3>& v, real angle)

Parameters
in Vector to rotate
angle in Angle to use to rotate with
Returns Rotated vector

Rotate vector about X axis

std::array<real, 3> tk::rotateY(const std::array<real, 3>& v, real angle)

Parameters
in Vector to rotate
angle in Angle to use to rotate with
Returns Rotated vector

Rotate vector about Y axis

std::array<real, 3> tk::rotateZ(const std::array<real, 3>& v, real angle)

Parameters
in Vector to rotate
angle in Angle to use to rotate with
Returns Rotated vector

Rotate vector about Z axis

real tk::Jacobian(const std::array<real, 3>& v1, const std::array<real, 3>& v2, const std::array<real, 3>& v3, const std::array<real, 3>& v4)

Compute the determinant of the Jacobian of a coordinate transformation over a tetrahedron.

Parameters
v1 in (x,y,z) coordinates of 1st vertex of the tetrahedron
v2 in (x,y,z) coordinates of 2nd vertex of the tetrahedron
v3 in (x,y,z) coordinates of 3rd vertex of the tetrahedron
v4 in (x,y,z) coordinates of 4th vertex of the tetrahedron
Returns Determinant of the Jacobian of transformation of physical tetrahedron to reference (xi, eta, zeta) space

std::array<std::array<real, 3>, 3> tk::inverseJacobian(const std::array<real, 3>& v1, const std::array<real, 3>& v2, const std::array<real, 3>& v3, const std::array<real, 3>& v4)

Compute the inverse of the Jacobian of a coordinate transformation over a tetrahedron.

Parameters
v1 in (x,y,z) coordinates of 1st vertex of the tetrahedron
v2 in (x,y,z) coordinates of 2nd vertex of the tetrahedron
v3 in (x,y,z) coordinates of 3rd vertex of the tetrahedron
v4 in (x,y,z) coordinates of 4th vertex of the tetrahedron
Returns Inverse of the Jacobian of transformation of physical tetrahedron to reference (xi, eta, zeta) space

tk::real tk::determinant(const std::array<std::array<tk::real, 3>, 3>& a)

Parameters
in 3x3 matrix
Returns Determinant of the 3x3 matrix

Compute the determinant of 3x3 matrix

std::array<tk::real, 3> tk::cramer(const std::array<std::array<tk::real, 3>, 3>& a, const std::array<tk::real, 3>& b)

Parameters
in 3x3 lhs matrix
in 3x1 rhs matrix
Returns Array of solutions of the 3x3 system

Solve a 3x3 system of equations using Cramer's rule

MeshReaderType tk::detectInput(const std::string& filename)

Detect input mesh file type.

Parameters
filename in File to open and detect its type
Returns enum specifying the mesh reader type

MeshWriterType tk::pickOutput(const std::string& filename)

Determine output mesh file type.

Parameters
filename in Filename to pick its type based on extension given
Returns enum specifying the mesh writer type

UnsMesh tk::readUnsMesh(const tk::Print& print, const std::string& filename, std::pair<std::string, tk::real>& timestamp)

Read unstructured mesh from file.

Parameters
print in Pretty printer
filename in Filename to read mesh from
timestamp out A time stamp consisting of a timer label (a string), and a time state (a tk::real in seconds) measuring the mesh read time
Returns Unstructured mesh object

Create unstructured mesh to store mesh

std::vector<std::pair<std::string, tk::real>> tk::writeUnsMesh(const tk::Print& print, const std::string& filename, UnsMesh& mesh, bool reorder)

Write unstructured mesh to file.

Parameters
print in Pretty printer
filename in Filename to write mesh to
mesh in Unstructured mesh object to write from
reorder in Whether to also reorder mesh nodes
Returns Vector of time stamps consisting of a timer label (a string), and a time state (a tk::real in seconds) measuring the renumber and the mesh write time

void tk::SiloError(char* msg)

Silo error handler.

Parameters
msg in Error message

static std::string tk::workdir()

Returns A stirng containing the current working directory

std::string tk::curtime()

Wrapper for the standard C library's gettimeofday() from.

Returns A stirng containing the current date and time

void tk::echoHeader(const Print& print, HeaderType header)

Echo program header.

Parameters
print in Pretty printer
header in Header type enum indicating which header to print

void tk::echoBuildEnv(const Print& print, const std::string& executable)

Echo build environment.

Parameters
print in Pretty printer
executable in Name of the executable

Echo information read from build_dir/Base/Config.h filled by CMake based on src/Main/Config.h.in.

void tk::echoRunEnv(const Print& print, int argc, char** argv, bool verbose, bool quiescence, bool charestate, bool trace, const std::string& screen_log, const std::string& input_log)

Echo runtime environment.

Parameters
print in Pretty printer
argc in Number of command-line arguments to executable
argv in C-style string array to command-line arguments to executable
verbose in True for verbose screen-output
quiescence in True if quiescence detection is enabled
charestate in True if chare state collection is enabled
trace in True if call and stack trace output is enabled
screen_log in Screen output log file name
input_log in Input log file name

template<class Driver, class CmdLine>
Driver tk::Main(int argc, char* argv[], const CmdLine& cmdline, HeaderType header, const std::string& executable, const std::string& def, int nrestart)

Generic Main() used for all executables for code-reuse and a uniform output.

Parameters
argc in Number of command-line arguments to executable
argv in C-style string array to command-line arguments to executable
cmdline in Command line object storing data parsed from the command line arguments
header in Header type enum indicating which executable header to print
executable in Name of the executable
def in Default log file name
nrestart in Number of times restarted
Returns Instantiated driver object which can then be used to execute() whatever it is intended to drive

The template arguments configure this Main class that is practically used instead of the usual main(). This allows code-reuse and a unfirom screen-output. The template arguments are:

  • Driver, specializaing the driver type to be created, see tk::Driver
  • Printer, specializaing the pretty printer type to use, see tk::Print
  • CmdLine, specializing the command line object storing data parsed from the command line

template<class MainProxy, class CmdLine>
void tk::MainCtor(MainProxy& mp, const MainProxy& thisProxy, std::vector<tk::Timer>& timer, const CmdLine& cmdline, const CkCallback& quiescenceTarget)

Template parameters
MainProxy Main Charm++ chare proxy for the executable
CmdLine Executable-specific tagged tuple storing the rusult of the command line parser
Parameters
mp in/out MainProxy to set for the main chare
thisProxy in 'thisProxy' to set as MainProxy
timer in/out Vector of timers, held by the main chare, in which to start the first timer, measuring the migration of global-scope data
cmdline in Command line grammar stack for the executable (assumed already parsed)
quiescenceTarget in Pre-created Charm++ callback to use as the target function to call if quiescence is detected

Generic Main Charm++ module constructor for all executables

template<class CmdLine>
void tk::dumpstate(const CmdLine& cmdline, const std::string& def, int nrestart, CkReductionMsg* msg)

Template parameters
CmdLine Executable-specific tagged tuple storing the rusult of the command line parser
Parameters
cmdline in Command line grammar stack for the executable
def in Default log file name
nrestart in Number of times restarted
msg in Charm++ reduction message containing the chare state aggregated from all PEs

Generic function to dump the Charm++ chare state (if collected)

template<class CmdLine>
void tk::finalize(const CmdLine& cmdline, const std::vector<tk::Timer>& timer, tk::CProxy_ChareStateCollector& state, std::vector<std::pair<std::string, tk::Timer::Watch>>& timestamp, const std::string& def, int nrestart, const CkCallback& dumpstateTarget, bool clean = true)

Parameters
cmdline in Command line grammar stack for the executable
timer in Vector of timers, held by the main chare
state in/out Chare state collector proxy
timestamp in/out Vector of time stamps in h:m:s with labels
def in Default log file name
nrestart in Number of times restarted
dumpstateTarget in Pre-created Charm++ callback to use as the target function for dumping chare state
clean in True if we should exit with a zero exit code, false to exit with a nonzero exit code

Generic finalize function for different executables

bool tk::slave(const NodeCommMap& map, std::size_t node, int chare)

Decide if a node is not counted by a chare.

Parameters
map in Node commuinication map to search in
node in Global node id to search for
chare in Caller chare id (but really can be any chare id)
Returns True if the node is a slave (counted by another chare with a lower chare id)

If a node is found in the node communication map and is associated to a lower chare id than the chare id given, it is counted by another chare (and not the caller one), hence a "slave" (for the purpose of this count).

tk::real tk::count(const NodeCommMap& map, std::size_t node)

Count the number of contributions to a node.

Parameters
map in Node commuinication map to search in
node in Global node id to search for
Returns Count of contributions to node

int tk::orient(const UnsMesh::Edge& t, const UnsMesh::Edge& e)

Determine edge orientation.

Returns -1.0 if edge t is oriented the same as edge e, +1.0 opposite

std::size_t tk::npoin_in_graph(const std::vector<std::size_t>& inpoel)

Compute number of points (nodes) in mesh from connectivity.

Parameters
inpoel in Inteconnectivity of points and elements. These are the
Returns Number of mesh points (nodes)

std::pair<std::vector<std::size_t>, std::vector<std::size_t>> tk::genEsup(const std::vector<std::size_t>& inpoel, std::size_t nnpe)

Generate derived data structure, elements surrounding points.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

nnpe in Number of nodes per element
Returns Linked lists storing elements surrounding points

The data generated here is stored in a linked list, more precisely, two linked arrays (vectors), esup1 and esup2, where esup2 holds the indices at which esup1 holds the element ids surrounding points. Looping over all elements surrounding all points can then be accomplished by the following loop:

for (std::size_t p=0; p<npoin; ++p)
  for (auto i=esup.second[p]+1; i<=esup.second[p+1]; ++i)
     use element id esup.first[i]

To find out the number of points, npoin, the mesh connectivity, inpoel, can be queried:

auto minmax = std::minmax_element( begin(inpoel), end(inpoel) );
Assert( *minmax.first == 0, "node ids should start from zero" );
auto npoin = *minmax.second + 1;

std::pair<std::vector<std::size_t>, std::vector<std::size_t>> tk::genPsup(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup)

Generate derived data structure, points surrounding points.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

nnpe in Number of nodes per element
esup in Elements surrounding points as linked lists, see tk::genEsup
Returns Linked lists storing points surrounding points

The data generated here is stored in a linked list, more precisely, two linked arrays (vectors), psup1 and psup2, where psup2 holds the indices at which psup1 holds the point ids surrounding points. Looping over all points surrounding all points can then be accomplished by the following loop:

for (std::size_t p=0; p<npoin; ++p)
  for (auto i=psup.second[p]+1; i<=psup.second[p+1]; ++i)
     use point id psup.first[i]

To find out the number of points, npoin, the mesh connectivity, inpoel, can be queried:

auto minmax = std::minmax_element( begin(inpoel), end(inpoel) );
Assert( *minmax.first == 0, "node ids should start from zero" );
auto npoin = *minmax.second + 1;

or the length-1 of the generated index list: auto npoin = psup.second.size()-1;

std::pair<std::vector<std::size_t>, std::vector<std::size_t>> tk::genEdsup(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup)

Generate derived data structure, edges surrounding points.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

nnpe in Number of nodes per element (3 or 4)
esup in Elements surrounding points as linked lists, see tk::genEsup
Returns Linked lists storing edges (point ids p < q) emanating from points

The data generated here is stored in a linked list, more precisely, two linked arrays (vectors), edsup1 and edsup2, where edsup2 holds the indices at which edsup1 holds the edge-end point ids emanating from points for all points. The generated data structure, linked lists edsup1 and edsup2, are very similar to psup1 and psup2, generated by genPsup(), except here only unique edges are stored, i.e., for edges with point ids p < q, only ids q are stored that are still associated to point p. Looping over all unique edges can then be accomplished by the following loop:

for (std::size_t p=0; p<npoin; ++p)
  for (auto i=edsup.second[p]+1; i<=edsup.second[p+1]; ++i)
    use edge with point ids p < edsup.first[i]

To find out the number of points, npoin, the mesh connectivity, inpoel, can be queried:

auto minmax = std::minmax_element( begin(inpoel), end(inpoel) );
Assert( *minmax.first == 0, "node ids should start from zero" );
auto npoin = *minmax.second + 1;

std::vector<std::size_t> tk::genInpoed(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup)

Generate derived data structure, edge connectivity.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

nnpe in Number of nodes per element (3 or 4)
esup in Elements surrounding points as linked lists, see tk::genEsup
Returns Linear vector storing edge connectivity (point ids p < q)

The data generated here is stored in a linear vector and is very similar to the linked lists, edsup1 and _edsup2, generated by genEdsup(). The difference is that in the linear vector, inpoed, generated here, both edge point ids are stored as a pair, p < q, as opposed to the linked lists edsup1 and edsup2, in which edsup1 only stores the edge-end point ids (still associated to edge-start point ids when used together with edsup2). The rationale is that while inpoed is larger in memory, it allows direct access to edges (pair of point ids making up an edge), edsup1 and edsup2 are smaller in memory, still allow accessing the same data (edge point id pairs) but only in a linear fashion, not by direct access to particular edges. Accessing all unique edges using the edge connectivity data structure, inpoed, generated here can be accomplished by

for (std::size_t e=0; e<inpoed.size()/2; ++e) {
  use point id p of edge e = inpoed[e*2];
  use point id q of edge e = inpoed[e*2+1];
}

std::pair<std::vector<std::size_t>, std::vector<std::size_t>> tk::genEsupel(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup)

Generate derived data structure, elements surrounding points of elements.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

nnpe in Number of nodes per element
esup in Elements surrounding points as linked lists, see tk::genEsup
Returns Linked lists storing elements surrounding points of elements

The data generated here is stored in a linked list, more precisely, two linked arrays (vectors), esupel1 and esupel2, where esupel2 holds the indices at which esupel1 holds the element ids surrounding points of elements. Looping over all elements surrounding the points of all elements can then be accomplished by the following loop:

for (std::size_t e=0; e<nelem; ++e)
  for (auto i=esupel.second[e]+1; i<=esupel.second[e+1]; ++i)
     use element id esupel.first[i]

To find out the number of elements, nelem, the size of the mesh connectivity vector, inpoel, can be devided by the number of nodes per elements, nnpe: auto nelem = inpoel.size()/nnpe;

std::pair<std::vector<std::size_t>, std::vector<std::size_t>> tk::genEsuel(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup)

Generate derived data structure, elements surrounding elements.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

nnpe in Number of nodes per element
esup in Elements surrounding points as linked lists, see tk::genEsup
Returns Linked lists storing elements surrounding elements

The data generated here is stored in a linked list, more precisely, two linked arrays (vectors), esuel1 and esuel2, where esuel2 holds the indices at which esuel1 holds the element ids surrounding elements. Looping over elements surrounding elements can then be accomplished by the following loop:

for (std::size_t e=0; e<nelem; ++e)
  for (auto i=esuel.second[e]+1; i<=esuel.second[e+1]; ++i)
     use element id esuel.first[i]

To find out the number of elements, nelem, the size of the mesh connectivity vector, inpoel, can be devided by the number of nodes per elements, nnpe: auto nelem = inpoel.size()/nnpe;

std::vector<std::size_t> tk::genInedel(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::vector<std::size_t>& inpoed)

Generate derived data structure, edges of elements.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

nnpe in Number of nodes per element
inpoed in Edge connectivity as linear vector, see tk::genInpoed
Returns Linear vector storing all edge ids * 2 of all elements

The data generated here is stored in a linear vector with all edge ids (as defined by inpoed) of all elements. The edge ids stored in inedel can be directly used to index the vector inpoed. Because the derived data structure generated here, inedel, is intended to be used in conjunction with the linear vector inpoed and not with the linked lists edsup1 and edsup2, this function takes inpoed as an argument. Accessing the edges of element e using the edge of elements data structure, inedel, generated here can be accomplished by

for (std::size_t e=0; e<nelem; ++e) {
  for (std::size_t i=0; i<nepe; ++i) {
    use edge id inedel[e*nepe+i] of element e, or
    use point ids p < q of edge id inedel[e*nepe+i] of element e as
      p = inpoed[ inedel[e*nepe+i]*2 ]
      q = inpoed[ inedel[e*nepe+i]*2+1 ]
  }
}

where nepe denotes the number of edges per elements: 3 for triangles, 6 for tetrahedra. To find out the number of elements, nelem, the size of the mesh connectivity vector, inpoel, can be devided by the number of nodes per elements, nnpe: auto nelem = inpoel.size()/nnpe;

std::unordered_map<UnsMesh::Edge, std::vector<std::size_t>, UnsMesh::Hash<2>, UnsMesh::Eq<2>> tk::genEsued(const std::vector<std::size_t>& inpoel, std::size_t nnpe, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup)

Generate derived data structure, elements surrounding edges.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

nnpe in Number of nodes per element (3 or 4)
esup in Elements surrounding points as linked lists, see tk::genEsup
Returns Associative container storing elements surrounding edges (value), assigned to edge-end points (key)

Looping over elements surrounding all edges can be accomplished by the following loop:

for (const auto& [edge,surr_elements] : esued) {
  use element edge-end-point ids edge[0] and edge[1]
  for (auto e : surr_elements) {
     use element id e
  }
}

esued.size() equals the number of edges.

std::size_t tk::genNbfacTet(std::size_t tnbfac, const std::vector<std::size_t>& inpoel, const std::vector<std::size_t>& triinpoel_complete, const std::map<int, std::vector<std::size_t>>& bface_complete, const std::unordered_map<std::size_t, std::size_t>& lid, std::vector<std::size_t>& triinpoel, std::map<int, std::vector<std::size_t>>& bface)

Generate total number of boundary faces in this chunk.

Parameters
tnbfac in Total number of boundary faces in the entire mesh.
inpoel in Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh.
triinpoel_complete in Interconnectivity of points and boundary-face in the entire mesh.
bface_complete in Map of boundary-face lists mapped to corresponding side set ids for the entire mesh.
lid in Mapping between the node indices used in the smaller inpoel connectivity (a subset of the entire triinpoel_complete connectivity), e.g., after mesh partitioning.
triinpoel in/out Interconnectivity of points and boundary-face in this mesh-partition.
bface in/out Map of boundary-face lists mapped to corresponding side set ids for this mesh-partition
Returns Number of boundary-faces on this chare/mesh-partition.

This function takes a mesh by its domain-element (tetrahedron-connectivity) in inpoel and a boundary-face (triangle) connectivity in triinpoel_complete. Based on these two arrays, it searches for those faces of triinpoel_complete that are also in inpoel and as a result it generates (1) the number of boundary faces shared with the mesh in inpoel and (2) the intersection of the triangle element connectivity whose faces are shared with inpoel. An example use case is where triinpoel_complete contains the connectivity for the boundary of the full problem/mesh and inpoel contains the connectivity for only a chunk of an already partitioned mesh. This function then intersects triinpoel_complete with inpoel and returns only those faces that share nodes with inpoel.

std::vector<int> tk::genEsuelTet(const std::vector<std::size_t>& inpoel, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup)

Generate derived data structure, elements surrounding elements as a fixed length data structure as a full vector, including boundary elements as -1.

Parameters
inpoel in

Inteconnectivity of points and elements. These are the node ids of each element of an unstructured mesh. Example:

std::vector< std::size_t > inpoel { 12, 14,  9, 11,
                                    10, 14, 13, 12 };

specifies two tetrahedra whose vertices (node ids) are { 12, 14, 9, 11 }, and { 10, 14, 13, 12 }.

esup in Elements surrounding points as linked lists, see tk::genEsup
Returns Vector storing elements surrounding elements

The data generated here is stored in a single vector, with length nfpe * nelem. Note however, that nelem is not explicitly provided, but calculated from inpoel. For boundary elements, at the boundary face, this esuelTet stores value -1 indicating that this is outside the domain. The convention for numbering the local face (triangle) connectivity is very important, e.g., in generating the inpofa array later. This node ordering convention is stored in tk::lpofa. Thus function is specific to tetrahedra, which is reflected in the fact that nnpe and nfpe are being set here in the function rather than being input arguments. To find out the number of elements, nelem, the size of the mesh connectivity vector, inpoel, can be devided by the number of nodes per elements, nnpe: auto nelem = inpoel.size()/nnpe;

std::size_t tk::genNipfac(std::size_t nfpe, std::size_t nbfac, const std::vector<int>& esuelTet)

Generate number of internal and physical-boundary faces.

Parameters
nfpe in Number of faces per element.
nbfac in Number of boundary faces.
esuelTet in Elements surrounding elements.
Returns Total number of faces in the mesh

The unsigned integer here gives the number of internal and

std::vector<int> tk::genEsuf(std::size_t nfpe, std::size_t nipfac, std::size_t nbfac, const std::vector<std::size_t>& belem, const std::vector<int>& esuelTet)

Generate derived data structure, elements surrounding faces.

Parameters
nfpe in Number of faces per element.
nipfac in Number of internal and physical-boundary faces.
nbfac in Number of boundary faces.
belem in Boundary element vector.
esuelTet in Elements surrounding elements.
Returns Elements surrounding faces.

The unsigned integer vector gives the IDs of the elements to the

std::vector<std::size_t> tk::genInpofaTet(std::size_t nipfac, std::size_t nbfac, const std::vector<std::size_t>& inpoel, const std::vector<std::size_t>& triinpoel, const std::vector<int>& esuelTet)

Generate derived data structure, node-face connectivity.

Parameters
nipfac in Number of internal and physical-boundary faces.
nbfac in Number of boundary faces.
inpoel in Element-node connectivity.
triinpoel in Face-node connectivity.
esuelTet in Elements surrounding elements.
Returns Points surrounding faces. The unsigned integer vector gives the elements to the left and to the right of each face in the mesh.

std::vector<std::size_t> tk::genBelemTet(std::size_t nbfac, const std::vector<std::size_t>& inpofa, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup)

Generate derived data structure, host/boundary element.

Parameters
nbfac in Number of boundary faces.
inpofa in Face-node connectivity.
esup in Elements surrounding points as linked lists, see tk::genEsup
Returns Host elements or boundary elements. The unsigned integer vector gives the elements to the left of each boundary face in the mesh.

Fields tk::genGeoFaceTri(std::size_t nipfac, const std::vector<std::size_t>& inpofa, const UnsMesh::Coords& coord)

Generate derived data structure, face geometry.

Parameters
nipfac in Number of internal and physical-boundary faces.
inpofa in Face-node connectivity.
coord in Co-ordinates of nodes in this mesh-chunk.
Returns Face geometry information. This includes face area, unit normal pointing outward of the element to the left of the face, and face centroid coordinates. Use the following examples to access this information for face-f.

face area: geoFace(f,0,0), unit-normal x-component: geoFace(f,1,0), y-component: geoFace(f,2,0), z-component: geoFace(f,3,0), centroid x-coordinate: geoFace(f,4,0), y-coordinate: geoFace(f,5,0), z-coordinate: geoFace(f,6,0).

std::array<real, 3> tk::normal(const std::array<real, 3>& x, const std::array<real, 3>& y, const std::array<real, 3>& z)

Compute the unit normal vector of a triangle.

Parameters
in x-coordinates of the three vertices of the triangle
in y-coordinates of the three vertices of the triangle
in z-coordinates of the three vertices of the triangle
Returns Unit normal

Compute the unit normal vector of a triangle

real tk::area(const std::array<real, 3>& x, const std::array<real, 3>& y, const std::array<real, 3>& z)

Compute the area of a triangle.

Parameters
in x-coordinates of the three vertices of the triangle
in y-coordinates of the three vertices of the triangle
in z-coordinates of the three vertices of the triangle
Returns Area

Compute the are of a triangle

Fields tk::geoFaceTri(const std::array<real, 3>& x, const std::array<real, 3>& y, const std::array<real, 3>& z)

Compute geometry of the face given by three vertices.

Parameters
in x-coordinates of the three vertices of the triangular face.
in y-coordinates of the three vertices of the triangular face.
in z-coordinates of the three vertices of the triangular face.
Returns Face geometry information. This includes face area, unit normal pointing outward of the element to the left of the face, and face centroid coordinates.

Compute geometry of the face given by three vertices face area: geoFace(f,0,0), unit-normal x-component: geoFace(f,1,0), y-component: geoFace(f,2,0), z-component: geoFace(f,3,0), centroid x-coordinate: geoFace(f,4,0), y-coordinate: geoFace(f,5,0), z-coordinate: geoFace(f,6,0).

Fields tk::genGeoElemTet(const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord)

Generate derived data structure, element geometry.

Parameters
inpoel in Element-node connectivity.
coord in Co-ordinates of nodes in this mesh-chunk.
Returns Element geometry information. This includes element volume, element centroid coordinates, and minimum edge length. Use the following examples to access this information for element-e. volume: geoElem(e,0,0), centroid x-coordinate: geoElem(e,1,0), y-coordinate: geoElem(e,2,0), z-coordinate: geoElem(e,3,0). minimum edge-length: geoElem(e,4,0).

bool tk::leakyPartition(const std::vector<int>& esueltet, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord)

Perform leak-test on mesh (partition)

Parameters
esueltet in Elements surrounding elements for tetrahedra, see tk::genEsueltet()
inpoel in Element connectivity
coord in Node coordinates
Returns True if partition leaks.

This function computes a surface integral over the boundary of the incoming mesh (partition). A non-zero vector result indicates a leak, e.g., a hole in the mesh (partition), which indicates an error either in the

bool tk::conforming(const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, bool cerr, const std::vector<std::size_t>& rid)

Check if mesh (partition) is conforming.

Parameters
inpoel in Element connectivity
coord in Node coordinates
cerr in True if hanging-node edge data should be output to std::cerr (true by default)
rid in AMR Lib node id map std::cerr (true by default)
Returns True if mesh (partition) has no hanging nodes and thus the mesh is conforming, false if non-conforming.

A conforming mesh by definition has no hanging nodes. A node is hanging if an edge of one element coincides with two (or more) edges (of two or more other elements). Thus, testing for conformity relies on checking the coordinates of all vertices: if any vertex coincides with that of a mid-point node of an edge, that is a hanging node. Note that this assumes that hanging nodes can only be at the mid-point of edges. This may happen after a mesh refinement step, due to a problem/bug, within the mesh refinement algorithm given by J. Waltz, Parallel adaptive refinement for unsteady flow calculations on 3D unstructured grids, International Journal for Numerical Methods in Fluids, 46: 37–57, 2004, which always adds/removes vertices at the mid-points of edges of a tetrahedron mesh within a single refinement step. Thus this algorithm is intended for this specific case, i.e., test for conformity after a single refinement step and not after multiple ones or for detecting hanging nodes in an arbitrary mesh.

bool tk::intet(const std::array<std::vector<real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<real>& p, std::size_t e, std::array<real, 4>& N)

Determine if a point is in a tetrahedron.

Parameters
coord in Mesh node coordinates
inpoel in Mesh element connectivity
in Point coordinates
in Mesh cell index
in/out Shapefunctions evaluated at the point
Returns True if ppoint is in mesh cell

tk::UnsMesh::Coords tk::curl(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& v)

Compute curl of a vector field at nodes of unstructured tetrahedra mesh.

Parameters
coord in Mesh node coordinates
inpoel in Mesh element connectivity
in Vector field whose curl to compute
Returns Weak (partial) result of curl of v (partial beacuse it still needs a division by the nodal volumes.

std::vector<tk::real> tk::div(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& v)

Compute divergence of vector field at nodes of unstructured tetrahedra mesh.

Parameters
coord in Mesh node coordinates
inpoel in Mesh element connectivity
in Vector field whose divergence to compute
Returns Weak (partial) result of div v (partial beacuse it still needs a division by the nodal volumes.

tk::UnsMesh::Coords tk::grad(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<tk::real>& phi)

Compute gradient of a scalar field at nodes of unstructured tetrahedra mesh.

Parameters
coord in Mesh node coordinates
inpoel in Mesh element connectivity
phi in Scalar field whose gradient to compute
Returns Weak (partial) result of grad phi (partial beacuse it still needs a division by the nodal volumes.

void tk::normal(real x1, real x2, real x3, real y1, real y2, real y3, real z1, real z2, real z3, real& nx, real& ny, real& nz)

Parameters
x1 in x coordinate of the 1st vertex of the triangle
x2 in x coordinate of the 2nd vertex of the triangle
x3 in x coordinate of the 3rd vertex of the triangle
y1 in y coordinate of the 1st vertex of the triangle
y2 in y coordinate of the 2nd vertex of the triangle
y3 in y coordinate of the 3rd vertex of the triangle
z1 in z coordinate of the 1st vertex of the triangle
z2 in z coordinate of the 2nd vertex of the triangle
z3 in z coordinate of the 3rd vertex of the triangle
nx out x coordinate of the unit normal
ny out y coordinate of the unit normal
nz out z coordinate of the unit normal

Compute the unit normal vector of a triangle

real tk::area(real x1, real x2, real x3, real y1, real y2, real y3, real z1, real z2, real z3)

Parameters
x1 in x coordinate of the 1st vertex of the triangle
x2 in x coordinate of the 2nd vertex of the triangle
x3 in x coordinate of the 3rd vertex of the triangle
y1 in y coordinate of the 1st vertex of the triangle
y2 in y coordinate of the 2nd vertex of the triangle
y3 in y coordinate of the 3rd vertex of the triangle
z1 in z coordinate of the 1st vertex of the triangle
z2 in z coordinate of the 2nd vertex of the triangle
z3 in z coordinate of the 3rd vertex of the triangle
Returns Area of the triangle

Compute the are of a triangle

std::array<tk::real, 3> tk::nodegrad(std::size_t node, const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup, const tk::Fields& U, ncomp_t c)

Compute gradient at a mesh node.

Parameters
node in Node id at which to compute gradient
coord in Mesh node coordinates
inpoel in Mesh element connectivity
esup in Linked lists storing elements surrounding points, see tk::genEsup()
in Field vector whose component gradient to compute
in Scalar component to compute gradient of
Returns Gradient of U(c) at mesh node

std::array<tk::real, 3> tk::edgegrad(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<std::size_t>& esued, const tk::Fields& U, ncomp_t c)

Compute gradient at a mesh edge.

Parameters
coord in Mesh node coordinates
inpoel in Mesh element connectivity
esued in List of elements surrounding edge, see tk::genEsued()
in Field vector whose component gradient to compute
in Scalar component to compute gradient of
Returns Gradient of U(c) at mesh edge

std::size_t tk::shiftToZero(std::vector<std::size_t>& inpoel)

Shift node IDs to start with zero in element connectivity.

Parameters
inpoel in/out Inteconnectivity of points and elements
Returns Amount shifted

This function implements a simple reordering of the node ids of the element connectivity in inpoel by shifting the node ids so that the smallest is zero.

void tk::remap(std::vector<std::size_t>& ids, const std::vector<std::size_t>& map)

Apply new mapping to vector of indices.

Parameters
ids in/out Vector of integer IDs to remap
map in Array of indices creating a new order

This function applies a mapping (reordering) to the integer IDs passed in using the map passed in. The mapping is expressed between the array index and its value. The function overwrites every value, i, of vector ids with map[i].

void tk::remap(std::vector<tk::real>& r, const std::vector<std::size_t>& map)

Apply new mapping to vector of real numbers.

Parameters
in/out Vector of real numbers to remap
map in Array of indices creating a new order

This function applies a mapping (reordering) to the real values passed in using the map passed in. The mapping is expressed between the array index and its value. The function moves every value r[i] to r[ map[i] ].

std::vector<std::size_t> tk::remap(const std::vector<std::size_t>& ids, const std::vector<std::size_t>& map)

Create remapped vector of indices using a vector.

Parameters
ids in Vector of integer IDs to remap
map in Array of indices creating a new order
Returns Remapped vector of ids

This function applies a mapping (reordering) to the integer IDs passed in using the map passed in. The mapping is expressed between the array index and its value. The function creates and returns a new container with remapped ids of identical size of the origin ids container.

void tk::remap(std::vector<std::size_t>& ids, const std::unordered_map<std::size_t, std::size_t>& map)

In-place remap vector of indices using a map.

Parameters
ids in Vector of integer IDs to remap
map in Hash-map of key->value creating a new order

This function applies a mapping (reordering) to the integer IDs passed in using the map passed in. The mapping is expressed as a hash-map of key->value pairs, where the key is the original and the value is the new ids of the mapping. The function overwrites the ids container with the remapped ids of identical size.

std::vector<std::size_t> tk::remap(const std::vector<std::size_t>& ids, const std::unordered_map<std::size_t, std::size_t>& map)

Create remapped vector of indices using a map.

Parameters
ids in Vector of integer IDs to create new container of ids from
map in Hash-map of key->value creating a new order
Returns Remapped vector of ids

This function applies a mapping (reordering) to the integer IDs passed in using the map passed in. The mapping is expressed as a hash-map of key->value pairs, where the key is the original and the value is the new ids of the mapping. The function creates and returns a new container with the remapped ids of identical size of the original ids container.

std::map<int, std::vector<std::size_t>> tk::remap(const std::map<int, std::vector<std::size_t>>& ids, const std::unordered_map<std::size_t, std::size_t>& map)

Create remapped map of vector of indices using a map.

Parameters
ids in Map of vector of integer IDs to create new container of ids from
map in Hash-map of key->value creating a new order
Returns Remapped vector of ids

This function applies a mapping (reordering) to the map of integer IDs passed in using the map passed in by applying remap(vector,map) on each vector of ids. The keys in the returned map will be the same as in ids.

std::vector<std::size_t> tk::renumber(const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& psup)

Reorder mesh points with the advancing front technique.

Parameters
psup in Points surrounding points
Returns Mapping created by renumbering (reordering)

std::unordered_map<std::size_t, std::size_t> tk::assignLid(const std::vector<std::size_t>& gid)

Assign local ids to global ids.

Parameters
gid in Global ids
Returns Map associating global ids to local ids

std::tuple<std::vector<std::size_t>, std::vector<std::size_t>, std::unordered_map<std::size_t, std::size_t>> tk::global2local(const std::vector<std::size_t>& ginpoel)

Generate element connectivity of local node IDs from connectivity of global node IDs also returning the mapping between local to global IDs.

Parameters
ginpoel in Element connectivity with global node IDs
Returns Tuple of (1) element connectivity with local node IDs, (2) the vector of unique global node IDs (i.e., the mapping between local to global node IDs), and (3) mapping between global to local node IDs.

bool tk::positiveJacobians(const std::vector<std::size_t>& inpoel, const std::array<std::vector<real>, 3>& coord)

Test positivity of the Jacobian for all cells in a mesh.

Parameters
inpoel in Element connectivity (zero-based, i.e., local if parallel)
coord in Node coordinates
Returns True if Jacobians of all mesh cells are positive

std::map<int, std::vector<std::size_t>> tk::bfacenodes(const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinpoel)

Generate nodes of side set faces.

Parameters
bface in Boundary-faces mapped to side set ids
triinpoel in Boundary-face connectivity
Returns Nodes of side set faces for each side set passed in

std::array<tk::real, 3> tk::eval_gp(const std::size_t igp, const std::array<std::array<tk::real, 3>, 3>& coordfa, const std::array<std::vector<tk::real>, 2>& coordgp)

Compute the coordinates of quadrature points for face integral.

Parameters
igp in Index of quadrature points
coordfa in Array of nodal coordinates for face element
coordgp in Array of coordinates for quadrature points in reference space
Returns Array of coordinates for quadrature points in physical space

std::array<tk::real, 3> tk::eval_gp(const std::size_t igp, const std::array<std::array<tk::real, 3>, 4>& coord, const std::array<std::vector<tk::real>, 3>& coordgp)

Compute the coordinates of quadrature points for volume integral.

Parameters
igp in Index of quadrature points
coord in Array of nodal coordinates for tetrahedron element
coordgp in Array of coordinates for quadrature points in reference space
Returns Array of coordinates for quadrature points in physical space

std::array<std::vector<tk::real>, 3> tk::eval_dBdx_p1(const std::size_t ndof, const std::array<std::array<tk::real, 3>, 3>& jacInv)

Compute the derivatives of basis function for DG(P1)

Parameters
ndof in Number of degrees of freedom
jacInv in Array of the inverse of Jacobian
Returns Array of the derivatives of basis functions

void tk::eval_dBdx_p2(const std::size_t igp, const std::array<std::vector<tk::real>, 3>& coordgp, const std::array<std::array<tk::real, 3>, 3>& jacInv, std::array<std::vector<tk::real>, 3>& dBdx)

Compute the derivatives of basis function for DG(P2)

Parameters
igp in Index of quadrature points
coordgp in Gauss point coordinates for tetrahedron element
jacInv in Array of the inverse of Jacobian
dBdx in/out Array of the derivatives of basis function

std::vector<tk::real> tk::eval_basis(const std::size_t ndof, const tk::real xi, const tk::real eta, const tk::real zeta)

Compute the Dubiner basis functions.

Parameters
ndof in Number of degrees of freedom
xi in Coordinates for quadrature points in reference space
eta in Coordinates for quadrature points in reference space
zeta in Coordinates for quadrature points in reference space
Returns Vector of basis functions

std::vector<tk::real> tk::eval_state(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_el, const std::size_t e, const Fields& U, const std::vector<tk::real>& B, const std::array<std::size_t, 2>& VarRange)

Compute the state variables for the tetrahedron element.

Parameters
ncomp in Number of scalar components in this PDE system
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
ndof_el in Number of degrees of freedom for the local element
in Index for the tetrahedron element
in Solution vector at recent time step
in Vector of basis functions
VarRange in Range of the variables to be evaluated
Returns Vector of state variable for tetrahedron element

std::vector<std::vector<tk::real>> tk::DubinerToTaylor(ncomp_t ncomp, ncomp_t offset, const std::size_t e, const std::size_t ndof, const tk::Fields& U, const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& coord)

Transform the solution with Dubiner basis to the solution with Taylor basis.

Parameters
ncomp in Number of scalar components in this PDE system
offset in Index for equation systems
in Id of element whose solution is to be limited
ndof in Maximum number of degrees of freedom
in High-order solution vector with Dubiner basis
inpoel in Element connectivity
coord in Array of nodal coordinates
Returns High-order solution vector with Taylor basis

void tk::TaylorToDubiner(ncomp_t ncomp, std::size_t e, std::size_t ndof, const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& coord, const tk::Fields& geoElem, std::vector<std::vector<tk::real>>& unk)

Convert the solution with Taylor basis to the solution with Dubiner basis.

Parameters
ncomp in Number of scalar components in this PDE system
in Id of element whose solution is to be limited
ndof in Maximum number of degrees of freedom
inpoel in Element connectivity
coord in Array of nodal coordinates
geoElem
unk in/out High-order solution vector with Taylor basis

std::vector<tk::real> tk::eval_TaylorBasis(const std::size_t ndof, const std::array<tk::real, 3>& x, const std::array<tk::real, 3>& x_c, const std::array<std::array<tk::real, 3>, 4>& coordel)

Evaluate the Taylor basis at points.

Parameters
ndof in Maximum number of degrees of freedom
in Nodal coordinates
x_c in Coordinates of the centroid
coordel in Array of nodal coordinates for the tetrahedron

void tk::bndSurfInt(ncomp_t system, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::vector<bcconf_t>& bcconfig, const inciter::FaceData& fd, const Fields& geoFace, const Fields& geoElem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, real t, const RiemannFluxFn& flux, const VelFn& vel, const StateFn& state, const Fields& U, const Fields& P, const std::vector<std::size_t>& ndofel, Fields& R, std::vector<std::vector<tk::real>>& vriem, std::vector<std::vector<tk::real>>& riemannLoc, std::vector<std::vector<tk::real>>& riemannDeriv, int intsharp)

Compute boundary surface flux integrals for a given boundary type for DG.

Parameters
system in Equation system index
nmat in Number of materials in this PDE system
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
rdof in Maximum number of reconstructed degrees of freedom
bcconfig in BC configuration vector for multiple side sets
fd in Face connectivity and boundary conditions object
geoFace in Face geometry array
geoElem in Element geometry array
inpoel in Element-node connectivity
coord in Array of nodal coordinates
in Physical time
flux in Riemann flux function to use
vel in Function to use to query prescribed velocity (if any)
state in Function to evaluate the left and right solution state at boundaries
in Solution vector at recent time step
in Vector of primitives at recent time step
ndofel in Vector of local number of degrees of freedom
in/out Right-hand side vector computed
vriem in/out Vector of the riemann velocity
riemannLoc in/out Vector of coordinates where Riemann velocity data is available
riemannDeriv in/out Derivatives of partial-pressures and velocities computed from the Riemann solver for use in the non-conservative terms. These derivatives are used only for multi-material hydro and unused for single-material compflow and linear transport.
intsharp in Interface compression tag, an optional argument, with default 0, so that it is unused for single-material and transport.

Compute boundary surface flux integrals for a given boundary type for DG

This function computes contributions from surface integrals along all faces for a particular boundary condition type, configured by the state function

void tk::update_rhs_bc(ncomp_t ncomp, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_l, const tk::real wt, const std::array<tk::real, 3>& fn, const std::size_t el, const std::vector<tk::real>& fl, const std::vector<tk::real>& B_l, Fields& R, std::vector<std::vector<tk::real>>& riemannDeriv)

Update the rhs by adding the boundary surface integration term.

Parameters
ncomp in Number of scalar components in this PDE system
nmat in Number of materials in this PDE system
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
ndof_l in Number of degrees of freedom for the left element
wt in Weight of gauss quadrature point
fn in Face/Surface normal
el in Left element index
fl in Surface flux
B_l in Basis function for the left element
in/out Right-hand side vector computed
riemannDeriv in/out Derivatives of partial-pressures and velocities computed from the Riemann solver for use in the non-conservative terms. These derivatives are used only for multi-material hydro and unused for single-material compflow and linear transport.

void tk::initialize(ncomp_t system, ncomp_t ncomp, ncomp_t offset, const Fields& L, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const InitializeFn& solution, Fields& unk, real t, const std::size_t nielem)

Parameters
system in Equation system index
ncomp in Number of scalar components in this PDE system
offset in Offset this PDE system operates from
in Block diagonal mass matrix
inpoel in Element-node connectivity
coord in Array of node coordinates
solution in Function to call to evaluate known solution or initial conditions at x,y,z,t
unk in/out Array of unknowns
in Physical time
nielem in Number of internal elements

Initalize a PDE system for DG by projecting the exact solution in the DG solution space

Initalize a system of DGPDEs by projecting the exact solution in the DG solution space

This is the public interface exposed to client code.

void tk::update_rhs(ncomp_t ncomp, const std::size_t ndof, const tk::real wt, const std::vector<tk::real>& B, const std::vector<tk::real>& s, std::vector<tk::real>& R)

Update the rhs by adding the initial analytical solution term.

Parameters
ncomp in Number of scalar components in this PDE system
ndof in Number of degrees of freedom
wt in Weight of gauss quadrature point
in Vector of basis functions
in Vector of analytical solution at quadrature point
in/out Right-hand side vector

void tk::eval_init(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::size_t e, const std::vector<tk::real>& R, const Fields& L, Fields& unk)

Compute the initial conditions.

Parameters
ncomp in Number of scalar components in this PDE system
offset in Offset this PDE system operates from
ndof in Number of degrees of freedom
rdof in Total number of reconstructed degrees of freedom
in Element index
in Right-hand side vector
in Block diagonal mass matrix
unk in/out Array of unknowns

template<class eq>
void tk::BoxElems(std::size_t system, const tk::Fields& geoElem, std::size_t nielem, std::vector<std::unordered_set<std::size_t>>& inbox)

Template parameters
eq Equation type to operate on, e.g., tag::compflow, tag::multimat
Parameters
system in Equation system index
geoElem in Element geometry array
nielem in Number of internal elements
inbox in/out List of nodes at which box user ICs are set for each IC box

Determine if elements lie inside user defined IC boxes

void tk::mass(ncomp_t ncomp, ncomp_t offset, ncomp_t ndof, const Fields& geoElem, Fields& l)

Compute the block-diagnoal mass matrix for DG.

Parameters
ncomp in Number of scalar components in this PDE system
offset in Offset this PDE system operates from
ndof in Number of solution degrees of freedom
geoElem in Element geometry array
in/out Block diagonal mass matrix

tk::Fields tk::lump(ncomp_t ncomp, const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel)

Compute lumped mass matrix for CG.

Parameters
ncomp in Total number of scalar components in the eq system
coord in Mesh node coordinates
inpoel in Mesh element connectivity
Returns Lumped mass matrix

void tk::nonConservativeInt(] ncomp_t system, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const Fields& U, const Fields& P, const std::vector<std::vector<tk::real>>& riemannDeriv, const std::vector<std::vector<tk::real>>& vriempoly, const std::vector<std::size_t>& ndofel, Fields& R, int intsharp)

Parameters
system in Equation system index
nmat in Number of materials in this PDE system
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
rdof in Maximum number of reconstructed degrees of freedom
nelem in Total number of elements
inpoel in Element-node connectivity
coord in Array of nodal coordinates
geoElem in Element geometry array
in Solution vector at recent time step
in Vector of primitive quantities at recent time step
riemannDeriv in Derivatives of partial-pressures and velocities computed from the Riemann solver for use in the non-conservative terms
vriempoly in Vector of Riemann velocity polynomial
ndofel in Vector of local number of degrees of freedome
in/out Right-hand side vector added to
intsharp in Interface reconstruction indicator

This is called for multi-material DG, computing volume integrals of terms in the volume fraction and energy equations, which do not exist in the single-material flow formulation (for CompFlow DG). For further details see Pelanti, M., & Shyue, K. M. (2019). A numerical model for multiphase liquid–vapor–gas flows with interfaces and cavitation. International Journal of Multiphase Flow, 113, 208-230.

void tk::updateRhsNonCons(ncomp_t ncomp, ncomp_t offset, const std::size_t nmat, const std::size_t ndof, ] const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::vector<tk::real>& B, ] const std::array<std::vector<tk::real>, 3>& dBdx, const std::vector<std::vector<tk::real>>& ncf, Fields& R)

Parameters
ncomp in Number of scalar components in this PDE system
offset in Offset this PDE system operates from
nmat in Number of materials
ndof in Maximum number of degrees of freedom
ndof_el in Number of degrees of freedom for local element
wt in Weight of gauss quadrature point
in Element index
in Basis function evaluated at local quadrature point
dBdx in Vector of basis function derivatives
ncf in Vector of non-conservative terms
in/out Right-hand side vector computed

void tk::pressureRelaxationInt(ncomp_t system, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t rdof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const Fields& U, const Fields& P, const std::vector<std::size_t>& ndofel, const tk::real ct, Fields& R, int intsharp)

Compute volume integrals of pressure relaxation terms in multi-material DG.

Parameters
system in Equation system index
nmat in Number of materials in this PDE system
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
rdof in Maximum number of reconstructed degrees of freedom
nelem in Total number of elements
inpoel in Element-node connectivity
coord in Array of nodal coordinates
geoElem in Element geometry array
in Solution vector at recent time step
in Vector of primitive quantities at recent time step
ndofel in Vector of local number of degrees of freedome
ct in Pressure relaxation time-scale for this system
in/out Right-hand side vector added to
intsharp in Interface reconstruction indicator

This is called for multi-material DG to compute volume integrals of finite pressure relaxation terms in the volume fraction and energy equations, which do not exist in the single-material flow formulation (for CompFlow DG). For further details see Dobrev, V. A., Kolev, T. V., Rieben, R. N., & Tomov, V. Z. (2016). Multi‐material closure model for high‐order finite element Lagrangian hydrodynamics. International Journal for Numerical Methods in Fluids, 82(10), 689-706.

void tk::updateRhsPre(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, ] const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::vector<tk::real>& B, std::vector<tk::real>& ncf, Fields& R)

Parameters
ncomp in Number of scalar components in this PDE system
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
ndof_el in Number of degrees of freedom for local element
wt in Weight of gauss quadrature point
in Element index
in Basis function evaluated at local quadrature point
ncf in Vector of non-conservative terms
in/out Right-hand side vector computed

std::vector<std::vector<tk::real>> tk::solvevriem(std::size_t nelem, const std::vector<std::vector<tk::real>>& vriem, const std::vector<std::vector<tk::real>>& riemannLoc)

Solve the reconstruct velocity used for volume fraction equation.

Parameters
nelem in Numer of elements
vriem in/out Vector of the riemann velocity
riemannLoc in/out Vector of coordinates where Riemann velocity data is available
Returns Vector of Riemann velocity polynomial solution

void tk::evaluRiemann(ncomp_t ncomp, const int e_left, const int e_right, const std::size_t nmat, const std::vector<tk::real>& fl, const std::array<tk::real, 3>& fn, const std::array<tk::real, 3>& gp, const std::array<std::vector<tk::real>, 2>& state, std::vector<std::vector<tk::real>>& vriem, std::vector<std::vector<tk::real>>& riemannLoc)

Compute the riemann velociry at the interface.

Parameters
ncomp in Number of scalar components in this PDE system
e_left in Index for the left element
e_right in Index for the right element
nmat in Number of materials in this PDE system
fl in Surface flux
fn in Face/Surface normal
gp in Gauss points coordinates
state in Vector of state variables for left and right side
vriem in/out Vector of the riemann velocity
riemannLoc in/out Vector of coordinates where Riemann velocity data is available

std::size_t tk::NGvol(const std::size_t ndof) constexpr

Parameters
ndof in Number of degrees of freedom

Initialization of number of Gauss points for volume integration

std::size_t tk::NGfa(const std::size_t ndof) constexpr

Parameters
ndof in Number of degrees of freedom

Initialization of number of Gauss points for face integration

std::size_t tk::NGdiag(const std::size_t ndof) constexpr

Initialization of number of Gauss points for volume integration in error estimation.

Parameters
ndof in Number of degrees of freedom

std::size_t tk::NGinit(const std::size_t ndof) constexpr

Initialization of number of Gauss points for volume integration in DG initialization.

Parameters
ndof in Number of degrees of freedom

void tk::GaussQuadratureTet(std::size_t NG, std::array<std::vector<real>, 3>& coordgp, std::vector<real>& wgp)

Initialize Gaussian quadrature points locations and weights for a tetrahedron.

Parameters
NG in number of quadrature points
coordgp in/out 3 spatial coordinates of quadrature points
wgp in/out Weights of quadrature points

Initialize Gaussian quadrature points locations and weights for a tetrahedron

void tk::GaussQuadratureTri(std::size_t NG, std::array<std::vector<real>, 2>& coordgp, std::vector<real>& wgp)

Initialize Gaussian quadrature points locations and weights for a triangle.

Parameters
NG in number of quadrature points
coordgp in/out 2 spatial coordinates of quadrature points
wgp in/out Weights of quadrature points

Initialize Gaussian quadrature points locations and weights for a triangle

void tk::srcInt(ncomp_t system, ncomp_t offset, real t, const std::size_t ndof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const CompFlowSrcFn& src, const std::vector<std::size_t>& ndofel, Fields& R)

Compute source term integrals for DG.

Parameters
system in Equation system index
offset in Offset this PDE system operates from
in Physical time
ndof in Maximum number of degrees of freedom
nelem in Maximum number of elements
inpoel in Element-node connectivity
coord in Array of nodal coordinates
geoElem in Element geometry array
src in Source function to use
ndofel in Vector of local number of degrees of freedome
in/out Right-hand side vector computed

void tk::update_rhs(ncomp_t offset, const std::size_t ndof, const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::vector<tk::real>& B, const std::array<tk::real, 5>& s, Fields& R)

Update the rhs by adding the source term integrals.

Parameters
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
ndof_el in Number of degrees of freedom for local element
wt in Weight of gauss quadrature point
in Element index
in Vector of basis functions
in Source terms for each of the 5 components
in/out Right-hand side vector computed

void tk::surfInt(ncomp_t system, std::size_t nmat, ncomp_t offset, real t, const std::size_t ndof, const std::size_t rdof, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const inciter::FaceData& fd, const Fields& geoFace, const Fields& geoElem, const RiemannFluxFn& flux, const VelFn& vel, const Fields& U, const Fields& P, const std::vector<std::size_t>& ndofel, Fields& R, std::vector<std::vector<tk::real>>& vriem, std::vector<std::vector<tk::real>>& riemannLoc, std::vector<std::vector<tk::real>>& riemannDeriv, int intsharp)

Compute internal surface flux integrals for DG.

Parameters
system in Equation system index
nmat in Number of materials in this PDE system
offset in Offset this PDE system operates from
in Physical time
ndof in Maximum number of degrees of freedom
rdof in Maximum number of reconstructed degrees of freedom
inpoel in Element-node connectivity
coord in Array of nodal coordinates
fd in Face connectivity and boundary conditions object
geoFace in Face geometry array
geoElem in Element geometry array
flux in Riemann flux function to use
vel in Function to use to query prescribed velocity (if any)
in Solution vector at recent time step
in Vector of primitives at recent time step
ndofel in Vector of local number of degrees of freedome
in/out Right-hand side vector computed
vriem in/out Vector of the riemann velocity
riemannLoc in/out Vector of coordinates where Riemann velocity data is available
riemannDeriv in/out Derivatives of partial-pressures and velocities computed from the Riemann solver for use in the non-conservative terms. These derivatives are used only for multi-material hydro and unused for single-material compflow and linear transport.
intsharp in Interface compression tag, an optional argument, with default 0, so that it is unused for single-material and transport.

void tk::update_rhs_fa(ncomp_t ncomp, std::size_t nmat, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_l, const std::size_t ndof_r, const tk::real wt, const std::array<tk::real, 3>& fn, const std::size_t el, const std::size_t er, const std::vector<tk::real>& fl, const std::vector<tk::real>& B_l, const std::vector<tk::real>& B_r, Fields& R, std::vector<std::vector<tk::real>>& riemannDeriv)

Parameters
ncomp in Number of scalar components in this PDE system
nmat in Number of materials in this PDE system
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
ndof_l in Number of degrees of freedom for left element
ndof_r in Number of degrees of freedom for right element
wt in Weight of gauss quadrature point
fn in Face/Surface normal
el in Left element index
er in Right element index
fl in Surface flux
B_l in Basis function for the left element
B_r in Basis function for the right element
in/out Right-hand side vector computed
riemannDeriv in/out Derivatives of partial-pressures and velocities computed from the Riemann solver for use in the non-conservative terms. These derivatives are used only for multi-material hydro and unused for single-material compflow and linear transport.

void tk::volInt(ncomp_t system, std::size_t nmat, ncomp_t offset, real t, const std::size_t ndof, const std::size_t rdof, const std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const FluxFn& flux, const VelFn& vel, const Fields& U, const Fields& P, const std::vector<std::size_t>& ndofel, Fields& R, int intsharp = 0)

Compute volume integrals for DG.

Parameters
system in Equation system index
nmat in Number of materials in this PDE system
offset in Offset this PDE system operates from
in Physical time
ndof in Maximum number of degrees of freedom
rdof in Total number of degrees of freedom included reconstructed ones
nelem in Maximum number of elements
inpoel in Element-node connectivity
coord in Array of nodal coordinates
geoElem in Element geometry array
flux in Flux function to use
vel in Function to use to query prescribed velocity (if any)
in Solution vector at recent time step
in Vector of primitives at recent time step
ndofel in Vector of local number of degrees of freedom
in/out Right-hand side vector added to
intsharp in Interface compression tag, an optional argument, with default 0, so that it is unused for single-material and transport.

void tk::update_rhs(ncomp_t ncomp, ncomp_t offset, const std::size_t ndof, const std::size_t ndof_el, const tk::real wt, const std::size_t e, const std::array<std::vector<tk::real>, 3>& dBdx, const std::vector<std::array<tk::real, 3>>& fl, Fields& R)

Update the rhs by adding the source term integrals.

Parameters
ncomp in Number of scalar components in this PDE system
offset in Offset this PDE system operates from
ndof in Maximum number of degrees of freedom
ndof_el in Number of degrees of freedom for local element
wt in Weight of gauss quadrature point
in Element index
dBdx in Vector of basis function derivatives
fl in Vector of numerical flux
in/out Right-hand side vector computed

void tk::lhsLeastSq_P0P1(const inciter::FaceData& fd, const Fields& geoElem, const Fields& geoFace, std::vector<std::array<std::array<real, 3>, 3>>& lhs_ls)

Compute lhs matrix for the least-squares reconstruction.

Parameters
fd in Face connectivity and boundary conditions object
geoElem in Element geometry array
geoFace in Face geometry array
lhs_ls in/out LHS reconstruction matrix

This function computing the lhs matrix for reconstruction, is common for primitive and conserved quantities.

void tk::intLeastSq_P0P1(ncomp_t offset, const std::size_t rdof, const inciter::FaceData& fd, const Fields& geoElem, const Fields& W, std::vector<std::vector<std::array<real, 3>>>& rhs_ls, const std::array<std::size_t, 2>& varRange)

Compute internal surface contributions to the least-squares reconstruction.

Parameters
offset in Offset this PDE system operates from
rdof in Maximum number of reconstructed degrees of freedom
fd in Face connectivity and boundary conditions object
geoElem in Element geometry array
in Solution vector to be reconstructed at recent time step
rhs_ls in/out RHS reconstruction vector
varRange in Range of indices in W, that need to be reconstructed

This function computing the internal face contributions to the rhs vector for reconstruction, is common for primitive and conserved quantities. If W == U, compute internal face contributions for the conserved variables. If W == P, compute internal face contributions for the primitive variables.

void tk::bndLeastSqConservedVar_P0P1(ncomp_t system, ncomp_t ncomp, ncomp_t offset, std::size_t rdof, const std::vector<bcconf_t>& bcconfig, const inciter::FaceData& fd, const Fields& geoFace, const Fields& geoElem, real t, const StateFn& state, const Fields& P, const Fields& U, std::vector<std::vector<std::array<real, 3>>>& rhs_ls, const std::array<std::size_t, 2>& varRange, std::size_t nprim)

Compute boundary surface contributions to rhs vector of the least-squares reconstruction of conserved quantities of the PDE system.

Parameters
system in Equation system index
ncomp in Number of scalar components in this PDE system
offset in Offset this PDE system operates from
rdof in Maximum number of reconstructed degrees of freedom
bcconfig in BC configuration vector for multiple side sets
fd in Face connectivity and boundary conditions object
geoFace in Face geometry array
geoElem in Element geometry array
in Physical time
state in Function to evaluate the left and right solution state at boundaries
in Primitive vector to be reconstructed at recent time step
in Solution vector to be reconstructed at recent time step
rhs_ls in/out RHS reconstruction vector
varRange in Range of indices in W, that need to be reconstructed
nprim in This is the number of primitive quantities stored for this PDE system. This is necessary to extend the state vector to the right size, so that correct boundary conditions are obtained. A default is set to 0, so that calling code for systems that do not store primitive quantities does not need to specify this argument.

This function computing the boundary face contributions to the rhs vector for reconstruction, is used for conserved quantities only.

void tk::solveLeastSq_P0P1(ncomp_t offset, const std::size_t rdof, const std::vector<std::array<std::array<real, 3>, 3>>& lhs, const std::vector<std::vector<std::array<real, 3>>>& rhs, Fields& W, const std::array<std::size_t, 2>& varRange)

Solve 3x3 system for least-squares reconstruction.

Parameters
offset in Offset this PDE system operates from
rdof in Maximum number of reconstructed degrees of freedom
lhs in LHS reconstruction matrix
rhs in RHS reconstruction vector
in/out Solution vector to be reconstructed at recent time step
varRange in Range of indices in W, that need to be reconstructed

Solves the 3x3 linear system for each element, individually. For systems that require reconstructions of primitive quantities, this should be called twice, once with the argument 'W' as U (conserved), and again with 'W' as P (primitive).

void tk::recoLeastSqExtStencil(std::size_t rdof, std::size_t offset, std::size_t e, const std::map<std::size_t, std::vector<std::size_t>>& esup, const std::vector<std::size_t>& inpoel, const Fields& geoElem, Fields& W, const std::array<std::size_t, 2>& varRange)

Reconstruct the second-order solution using least-squares approach from an extended stencil involving the node-neighbors.

Parameters
rdof in Maximum number of reconstructed degrees of freedom
offset in Offset this PDE system operates from
in Element whoes solution is being reconstructed
esup in Elements surrounding points
inpoel in Element-node connectivity
geoElem in Element geometry array
in/out Solution vector to be reconstructed at recent time step
varRange in Range of indices in W, that need to be reconstructed

A second-order (piecewise linear) solution polynomial is obtained from the first-order (piecewise constant) FV solutions by using a least-squares (LS) reconstruction process. This LS reconstruction function using the nodal-neighbors of a cell, to get an overdetermined system of equations for the derivatives of the solution. This overdetermined system is solved in the least-squares sense using the normal equations approach.

void tk::transform_P0P1(ncomp_t offset, std::size_t rdof, std::size_t nelem, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, Fields& W, const std::array<std::size_t, 2>& varRange)

Transform the reconstructed P1-derivatives to the Dubiner dofs.

Parameters
offset in Index for equation systems
rdof in Total number of reconstructed dofs
nelem in Total number of elements
inpoel in Element-node connectivity
coord in Array of nodal coordinates
in/out Second-order reconstructed vector which gets transformed to the Dubiner reference space
varRange in Range of indices in W, that need to be reconstructed

Since the DG solution (and the primitive quantities) are assumed to be stored in the Dubiner space, this transformation from Taylor coefficients to Dubiner coefficients is necessary.

void tk::THINCReco(std::size_t system, std::size_t offset, std::size_t rdof, std::size_t nmat, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const std::array<real, 3>& ref_xp, const Fields& U, const Fields& P, ] const std::vector<real>& vfmin, ] const std::vector<real>& vfmax, std::vector<real>& state)

Parameters
system in Equation system index
offset in Index for equation systems
rdof in Total number of reconstructed dofs
nmat in Total number of materials
in Element for which interface reconstruction is being calculated
inpoel in Element-node connectivity
coord in Array of nodal coordinates
geoElem in Element geometry array
ref_xp in Quadrature point in reference space
in Solution vector
in Vector of primitives
vfmin in Vector containing min volume fractions for each material in this cell
vfmax in Vector containing max volume fractions for each material in this cell
state in/out Unknown/state vector at quadrature point, modified if near interfaces using THINC

This function is an interface for the multimat PDEs that use the algebraic multi-material THINC reconstruction. This particular function should only be called for multimat.

void tk::THINCRecoTransport(std::size_t system, std::size_t offset, std::size_t rdof, std::size_t, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const std::array<real, 3>& ref_xp, const Fields& U, const Fields&, ] const std::vector<real>& vfmin, ] const std::vector<real>& vfmax, std::vector<real>& state)

Compute THINC reconstructions for linear advection (transport)

Parameters
system in Equation system index
offset in Index for equation systems
rdof in Total number of reconstructed dofs
in Element for which interface reconstruction is being calculated
inpoel in Element-node connectivity
coord in Array of nodal coordinates
geoElem in Element geometry array
ref_xp in Quadrature point in reference space
in Solution vector
vfmin in Vector containing min volume fractions for each material in this cell
vfmax in Vector containing max volume fractions for each material in this cell
state in/out Unknown/state vector at quadrature point, modified if near interfaces using THINC

This function is an interface for the transport PDEs that use the algebraic multi-material THINC reconstruction. This particular function should only be called for transport.

void tk::THINCFunction(std::size_t rdof, std::size_t nmat, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const std::array<real, 3>& ref_xp, real vol, real bparam, const std::vector<real>& alSol, bool intInd, const std::vector<std::size_t>& matInt, std::vector<real>& alReco)

Old THINC reconstruction function for volume fractions near interfaces.

Parameters
rdof in Total number of reconstructed dofs
nmat in Total number of materials
in Element for which interface reconstruction is being calculated
inpoel in Element-node connectivity
coord in Array of nodal coordinates
ref_xp in Quadrature point in reference space
vol in Element volume
bparam in User specified Beta for THINC, from the input file
alSol in Volume fraction solution vector for element e
intInd in Interface indicator, true if e is interface element
matInt in Vector indicating materials which constitute interface
alReco in/out Unknown/state vector at quadrature point, which gets modified if near interface using MM-THINC

This function computes the interface reconstruction using the algebraic multi-material THINC reconstruction for each material at the given (ref_xp) quadrature point. This function is based on the following: Pandare A. K., Waltz J., & Bakosi J. (2021) Multi-Material Hydrodynamics with Algebraic Sharp Interface Capturing. Computers & Fluids, doi: https://doi.org/10.1016/j.compfluid.2020.104804. This function will be removed after the newer version (see THINCFunction_new) is sufficiently tested.

void tk::THINCFunction_new(std::size_t rdof, std::size_t nmat, std::size_t e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const std::array<real, 3>& ref_xp, real vol, real bparam, const std::vector<real>& alSol, bool intInd, const std::vector<std::size_t>& matInt, std::vector<real>& alReco)

New THINC reconstruction function for volume fractions near interfaces.

Parameters
rdof in Total number of reconstructed dofs
nmat in Total number of materials
in Element for which interface reconstruction is being calculated
inpoel in Element-node connectivity
coord in Array of nodal coordinates
ref_xp in Quadrature point in reference space
vol in Element volume
bparam in User specified Beta for THINC, from the input file
alSol in Volume fraction solution vector for element e
intInd in Interface indicator, true if e is interface element
matInt in Vector indicating materials which constitute interface
alReco in/out Unknown/state vector at quadrature point, which gets modified if near interface using MM-THINC

This function computes the interface reconstruction using the algebraic multi-material THINC reconstruction for each material at the given (ref_xp) quadrature point. This function succeeds the older version of the mm-THINC (see THINCFunction), but is still under testing and is currently experimental.

std::vector<tk::real> tk::evalPolynomialSol(std::size_t system, std::size_t offset, int intsharp, std::size_t ncomp, std::size_t nprim, std::size_t rdof, std::size_t nmat, std::size_t e, std::size_t dof_e, const std::vector<std::size_t>& inpoel, const UnsMesh::Coords& coord, const Fields& geoElem, const std::array<real, 3>& ref_gp, const std::vector<real>& B, const Fields& U, const Fields& P)

Evaluate polynomial solution at quadrature point.

Parameters
system in Equation system index
offset in Index for equation systems
intsharp in Interface reconstruction indicator
ncomp in Number of components in the PDE system
nprim in Number of primitive quantities
rdof in Total number of reconstructed dofs
nmat in Total number of materials
in Element for which polynomial solution is being evaluated
dof_e in Degrees of freedom for element
inpoel in Element-node connectivity
coord in Array of nodal coordinates
geoElem in Element geometry array
ref_gp in Quadrature point in reference space
in Basis function at given quadrature point
in Solution vector
in Vector of primitives
Returns High-order unknown/state vector at quadrature point, modified if near interfaces using THINC

void tk::safeReco(std::size_t offset, std::size_t rdof, std::size_t nmat, std::size_t el, int er, const Fields& U, std::array<std::vector<real>, 2>& state)

Compute safe reconstructions near material interfaces.

Parameters
offset in Index for equation systems
rdof in Total number of reconstructed dofs
nmat in Total number of material is PDE system
el in Element on the left-side of face
er in Element on the right-side of face
in Solution vector at recent time-stage
state in/out Second-order reconstructed state, at cell-face, that is being modified for safety

When the consistent limiting is applied, there is a possibility that the material densities and energies violate TVD bounds. This function enforces the TVD bounds locally

std::pair<int, std::unique_ptr<char[]>> tk::serialize(std::size_t meshid, const std::vector<tk::UniPDF>& u)

Serialize univariate PDF to raw memory stream.

Parameters
meshid in Mesh ID
in Univariate PDFs
Returns Pair of the length and the raw stream containing the serialized PDFs

CkReductionMsg* tk::mergeUniPDFs(int nmsg, CkReductionMsg** msgs)

Charm++ custom reducer for merging a univariate PDF during reduction across PEs.

Parameters
nmsg in Number of messages in msgs
msgs in Charm++ reduction message containing the serialized PDF
Returns Aggregated PDF built for further aggregation if needed

std::pair<int, std::unique_ptr<char[]>> tk::serialize(const std::vector<tk::UniPDF>& u, const std::vector<tk::BiPDF>& b, const std::vector<tk::TriPDF>& t)

Serialize vectors of PDFs to raw memory stream.

Parameters
in Vector of univariate PDFs
in Vector of bivariate PDFs
in Vector of trivariate PDFs
Returns Pair of the length and the raw stream containing the serialized PDFs

CkReductionMsg* tk::mergePDF(int nmsg, CkReductionMsg** msgs)

Charm++ custom reducer for merging PDFs during reduction across PEs.

Parameters
nmsg in Number of messages in msgs
msgs in Charm++ reduction message containing the serialized PDFs
Returns Aggregated PDFs built for further aggregation if needed

static std::ostream& tk::operator<<(std::ostream& os, const tk::UniPDF& p)

Parameters
os in/out Stream to output to
in PDF to output
Returns Updated stream

Output univariate PDF to output stream

Variable documentation

const std::array<std::size_t, 2> tk::ExoNnpe

ExodusII mesh cell number of nodes

List of number of nodes per element for different element types supported in the order of tk::ExoElemType

const std::array<std::array<std::size_t, 3>, 4> tk::expofa

ExodusII face-node numbering for tetrahedron side sets

const std::array<UnsMesh::Face, 4> tk::lpofa

Const array defining the node ordering convention for tetrahedron faces

This two-dimensional array stores the naming/ordering convention of the node indices of a tetrahedron (tet) element. The dimensions are 4x3 as a tetrahedron has a total of 4 nodes and each (triangle) face has 3 nodes. Thus the array below associates tet node 0 with nodes {1,2,3}, tet node 1 with {2,0,3}, tet node 2 with {3,0,1}, and tet node 3 with {0,2,1}. Note that not only these mappings are important, but also the order of the nodes within the triplets as this specific order also defines the outwards normal of each face.

static highwayhash::HH_U64 tk::hh_key constexpr

Highway hash "secret" key