Chi-Tech
chi_mesh_meshhandler_utils.cc
Go to the documentation of this file.
1#include "chi_mesh.h"
2#include<iostream>
3
5#include "chi_runtime.h"
6
7
8//###################################################################
9/**Obtains a reference to the current mesh handler from the global stack.
10 *
11 * If the stack is empty this routine will through `std::logic_error`.
12\author Jan*/
14{
15 if (Chi::meshhandler_stack.empty())
16 throw std::logic_error("chi_mesh::GetCurrentHandler: No handlers on stack");
17
18 return Chi::GetStackItem<chi_mesh::MeshHandler>(Chi::meshhandler_stack,
20}
21
22//###################################################################
23/**Adds a new mesh handler to the stack, sets it as the current handler
24 * and returns a handle to it.*/
26{
27 Chi::meshhandler_stack.push_back(std::make_shared<chi_mesh::MeshHandler>());
28
29 int index = (int)Chi::meshhandler_stack.size() - 1;
31
32 return index;
33}
34
35
static std::vector< chi_mesh::MeshHandlerPtr > meshhandler_stack
Definition: chi_runtime.h:83
static int current_mesh_handler
Definition: chi_runtime.h:84
size_t PushNewHandlerAndGetIndex()
MeshHandler & GetCurrentHandler()