Chi-Tech
chi_mesh_meshhandler_utils.cc
Go to the documentation of this file.
1
#include "
chi_mesh.h
"
2
#include<iostream>
3
4
#include "
MeshHandler/chi_meshhandler.h
"
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*/
13
chi_mesh::MeshHandler
&
chi_mesh::GetCurrentHandler
()
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
,
19
Chi::current_mesh_handler
);
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.*/
25
size_t
chi_mesh::PushNewHandlerAndGetIndex
()
26
{
27
Chi::meshhandler_stack
.push_back(std::make_shared<chi_mesh::MeshHandler>());
28
29
int
index = (int)
Chi::meshhandler_stack
.size() - 1;
30
Chi::current_mesh_handler
= index;
31
32
return
index;
33
}
34
35
chi_mesh.h
chi_meshhandler.h
chi_runtime.h
Chi::meshhandler_stack
static std::vector< chi_mesh::MeshHandlerPtr > meshhandler_stack
Definition:
chi_runtime.h:83
Chi::current_mesh_handler
static int current_mesh_handler
Definition:
chi_runtime.h:84
chi_mesh::MeshHandler
Definition:
chi_meshhandler.h:13
chi_mesh::PushNewHandlerAndGetIndex
size_t PushNewHandlerAndGetIndex()
Definition:
chi_mesh_meshhandler_utils.cc:25
chi_mesh::GetCurrentHandler
MeshHandler & GetCurrentHandler()
Definition:
chi_mesh_meshhandler_utils.cc:13
framework
mesh
chi_mesh_meshhandler_utils.cc
Generated by
1.9.3