Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90038251
uniform_mesh1d.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Oct 28, 17:46
Size
1 KB
Mime Type
text/x-c++
Expires
Wed, Oct 30, 17:46 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
21997622
Attached To
rSPECMICP SpecMiCP / ReactMiCP
uniform_mesh1d.hpp
View Options
/*-------------------------------------------------------
- Module : reactmicp/meshes
- File : uniform_mesh1d
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget, Princeton University
---------------------------------------------------------*/
#ifndef SPECMICP_REACTMICP_MESH_UNIFORMMESH1D_HPP
#define SPECMICP_REACTMICP_MESH_UNIFORMMESH1D_HPP
#include "mesh1d.hpp"
// \file uniform_mesh1d.hpp Uniform 1D mesh
namespace
specmicp
{
namespace
mesh
{
//! \brief A uniform 1D mesh
class
UniformMesh1D
:
public
Mesh1D
{
public
:
UniformMesh1D
(
index_t
nb_nodes
,
scalar_t
dx
,
scalar_t
cross_section
)
:
Mesh1D
(
nb_nodes
),
m_dx
(
dx
),
m_crosssection
(
cross_section
)
{}
scalar_t
get_position
(
index_t
node
)
{
return
m_dx
*
node
;}
scalar_t
get_dx
(
index_t
_
)
{
return
m_dx
;}
scalar_t
get_face_area
(
index_t
_
)
{
return
m_crosssection
;}
scalar_t
get_volume_element
(
index_t
_
)
{
return
m_dx
*
m_crosssection
;}
scalar_t
get_volume_cell
(
index_t
node
)
{
if
(
node
==
0
or
node
==
nb_nodes
()
-
1
)
return
m_dx
*
m_crosssection
/
2
;
else
return
m_dx
*
m_crosssection
;
}
scalar_t
get_volume_cell_element
(
index_t
element
,
index_t
enode
)
{
return
m_dx
*
m_crosssection
/
2
;
}
private
:
scalar_t
m_dx
;
scalar_t
m_crosssection
;
};
//! \brief Factory method to build a pointer to a uniform 1D mesh
inline
Mesh1DPtr
uniform_mesh1d
(
index_t
nb_nodes
,
scalar_t
dx
,
scalar_t
cross_section
)
{
return
std
::
static_pointer_cast
<
Mesh1D
>
(
std
::
make_shared
<
UniformMesh1D
>
(
nb_nodes
,
dx
,
cross_section
));
}
}
// end namespace mesh
}
// end namespace specmicp
#endif
// SPECMICP_REACTMICP_MESH_UNIFORMMESH1D_HPP
Event Timeline
Log In to Comment