Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92053278
ref_elem_akantu.hh
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
Sat, Nov 16, 23:22
Size
10 KB
Mime Type
text/x-c++
Expires
Mon, Nov 18, 23:22 (2 d)
Engine
blob
Format
Raw Data
Handle
22352685
Attached To
rLIBMULTISCALE LibMultiScale
ref_elem_akantu.hh
View Options
/**
* @file ref_elem_akantu.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
* @author Srinivasa Babu Ramisetti <srinivasa.ramisetti@epfl.ch>
*
* @date Tue Jun 24 22:58:02 2014
*
* @brief This is a reference to Akantu elements
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __LIBMULTISCALE_REF_ELEM_AKANTU_HH__
#define __LIBMULTISCALE_REF_ELEM_AKANTU_HH__
/* -------------------------------------------------------------------------- */
#include "ref_element.hh"
#include "akantu_dof_wrapper.hh"
#include "units.hh"
/* -------------------------------------------------------------------------- */
#include <fe_engine.hh>
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template
<
UInt
Dim
>
class
IteratorElemsAkantu
;
template
<
UInt
Dim
>
class
ContainerElemsAkantu
;
template
<
UInt
Dim
>
class
RefNodeAkantu
;
/* -------------------------------------------------------------------------- */
/**
* Class RefElementLibMesh
* implementation from libmesh of the generic reference to elements
*/
template
<
UInt
_Dim
>
class
RefElemAkantu
:
public
RefElement
<
_Dim
>
{
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
public
:
typedef
typename
AkantuDOFWrapper
<
_Dim
>::
MyFEM
MyFEM
;
static
const
UInt
Dim
=
_Dim
;
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public
:
RefElemAkantu
();
RefElemAkantu
(
UInt
ind
);
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
//! equality operator
bool
operator
==
(
RefElemAkantu
<
_Dim
>
&
ref
);
//! return normal to element when dimension of element is <= 2
void
normal
(
Real
&
x
,
Real
&
y
,
Real
&
z
);
//! get integral of potential energy density of the element
Real
getEPot
();
//! get integral of kinetic energy of the element
Real
getEKin
();
#ifdef AKANTU_HEAT_TRANSFER
//! get integral of thermal energy of the element
Real
getEThermal
();
#endif
//! geometric ownership test of a given space poUInt for referenced element
bool
contains
(
Real
*
x
);
//! give the number of nodes connected in referenced element
UInt
nNodes
();
//! return the condensed (averaged) stress tensor component coord
Real
stress
(
UInt
coord
);
//! return the condensed (averaged) strain tensor component coord
Real
strain
(
UInt
coord
);
//! function that computes the nodal shape values for a given element at a given space point
void
computeShapes
(
std
::
vector
<
Real
>
&
target
,
Real
*
x
);
//! return the local indexes (in DOF vector) for connected nodes
void
localIndexes
(
std
::
vector
<
UInt
>
&
nodes
);
//! return the global indexes (in DOF vector) for connected nodes
void
globalIndexes
(
std
::
vector
<
UInt
>
&
nodes
);
//! return a ref to the i-est node
RefNodeAkantu
<
_Dim
>
&
getNode
(
UInt
i
);
Real
length
(){
LM_TOIMPLEMENT
;};
/// function to print the contain of the class
virtual
void
printself
(
std
::
ostream
&
stream
,
int
indent
=
0
)
const
;
protected
:
//! set internal index to provide direct acess
void
setIndex
(
UInt
ind
);
//! set pointers to akantu objects
void
setAkantuPointers
(
AkantuDOFWrapper
<
_Dim
>
&
dof
);
//! set heat transfer flag
void
setHeatTransferFlag
(
bool
flag
);
//! get heat transfer flag
bool
getHeatTransferFlag
();
/* ------------------------------------------------------------------------ */
/* Typedefs */
/* ------------------------------------------------------------------------ */
//! iterators may need a privileged access
friend
class
ContainerElemsAkantu
<
_Dim
>
;
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
private
:
//! internal index
UInt
index
;
//! direct access to the shape object (for interpolation and other things)
MyFEM
*
fem
;
//! direct acces to the dof-wrapper
AkantuDOFWrapper
<
_Dim
>
*
dofs
;
//! direct access to the shape object (for interpolation and other things)
akantu
::
SolidMechanicsModel
*
model
;
#ifdef AKANTU_HEAT_TRANSFER
// direct access to the heat transfer model
akantu
::
HeatTransferModel
*
heat_transfer_model
;
#endif
// AKANTU_HEAT_TRANSFER
RefNodeAkantu
<
_Dim
>
nd
;
};
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
RefElemAkantu
<
_Dim
>::
RefElemAkantu
()
:
index
(
0
){
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
RefElemAkantu
<
_Dim
>::
RefElemAkantu
(
UInt
ind
){
LM_TOIMPLEMENT
;
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
bool
RefElemAkantu
<
_Dim
>::
operator
==
(
RefElemAkantu
<
_Dim
>
&
ref
){
LM_TOIMPLEMENT
;
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
void
RefElemAkantu
<
_Dim
>::
normal
(
Real
&
x
,
Real
&
y
,
Real
&
z
){
LM_TOIMPLEMENT
;
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
UInt
RefElemAkantu
<
_Dim
>::
nNodes
(){
return
this
->
dofs
->
getNbNodesPerElem
();
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
Real
RefElemAkantu
<
_Dim
>::
stress
(
UInt
coord
){
UInt
mat_id
=
this
->
dofs
->
getMaterialID
(
this
->
index
);
UInt
id_in_mat
=
this
->
dofs
->
getIDInMaterial
(
this
->
index
);
UInt
nb_quadrature_points
=
this
->
dofs
->
getNbQuadraturePoints
();
const
akantu
::
Array
<
Real
>
&
stress
=
this
->
dofs
->
getStress
(
mat_id
);
Real
retval
=
0
;
for
(
UInt
quad_pt
=
0
;
quad_pt
<
nb_quadrature_points
;
++
quad_pt
)
{
retval
+=
stress
(
nb_quadrature_points
*
id_in_mat
+
quad_pt
,
coord
);
}
return
retval
/
nb_quadrature_points
;
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
Real
RefElemAkantu
<
_Dim
>::
strain
(
UInt
coord
){
UInt
mat_id
=
this
->
dofs
->
getMaterialID
(
this
->
index
);
UInt
id_in_mat
=
this
->
dofs
->
getIDInMaterial
(
this
->
index
);
UInt
nb_quadrature_points
=
this
->
dofs
->
getNbQuadraturePoints
();
const
akantu
::
Array
<
Real
>
&
strain
=
this
->
dofs
->
getStrain
(
mat_id
);
Real
retval
=
0
;
UInt
col
=
coord
/
_Dim
;
UInt
row
=
coord
%
_Dim
;
for
(
UInt
quad_pt
=
0
;
quad_pt
<
nb_quadrature_points
;
++
quad_pt
)
{
retval
+=
.5
*
strain
(
nb_quadrature_points
*
id_in_mat
+
quad_pt
,
row
+
col
*
_Dim
);
retval
+=
.5
*
strain
(
nb_quadrature_points
*
id_in_mat
+
quad_pt
,
col
+
row
*
_Dim
);
}
return
retval
/
nb_quadrature_points
;
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
void
RefElemAkantu
<
_Dim
>::
computeShapes
(
std
::
vector
<
Real
>
&
target
,
Real
*
X
){
target
.
resize
(
this
->
dofs
->
getNbNodesPerElem
());
akantu
::
RVector
shapes
(
&
target
[
0
],
this
->
dofs
->
getNbNodesPerElem
());
akantu
::
RVector
real_coords
(
_Dim
);
for
(
UInt
i
=
0
;
i
<
_Dim
;
++
i
)
real_coords
[
i
]
=
X
[
i
];
return
fem
->
computeShapes
(
real_coords
,
index
,
this
->
dofs
->
getType
(),
shapes
);
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
bool
RefElemAkantu
<
_Dim
>::
contains
(
Real
*
x
){
akantu
::
RVector
real_coords
(
_Dim
);
for
(
UInt
i
=
0
;
i
<
_Dim
;
++
i
)
real_coords
[
i
]
=
x
[
i
];
return
fem
->
contains
(
real_coords
,
index
,
this
->
dofs
->
getType
());
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
void
RefElemAkantu
<
_Dim
>::
localIndexes
(
std
::
vector
<
UInt
>
&
nodes
){
LM_ASSERT
(
this
->
dofs
->
getNbNodesPerElem
(),
"ref to akantu element was badly initialized"
);
nodes
.
resize
(
this
->
dofs
->
getNbNodesPerElem
());
for
(
UInt
i
=
0
;
i
<
this
->
dofs
->
getNbNodesPerElem
();
++
i
)
{
nodes
[
i
]
=
this
->
dofs
->
getConnectivity
()[
this
->
dofs
->
getNbNodesPerElem
()
*
index
+
i
];
}
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
void
RefElemAkantu
<
_Dim
>::
globalIndexes
(
std
::
vector
<
UInt
>
&
nodes
){
localIndexes
(
nodes
);
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
RefNodeAkantu
<
_Dim
>
&
RefElemAkantu
<
_Dim
>::
getNode
(
UInt
i
){
nd
.
index
=
this
->
dofs
->
getConnectivity
()[
this
->
dofs
->
getNbNodesPerElem
()
*
index
+
i
];
return
nd
;
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
void
RefElemAkantu
<
_Dim
>::
setHeatTransferFlag
(
bool
flag
){
nd
.
setHeatTransferFlag
(
flag
);
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
bool
RefElemAkantu
<
_Dim
>::
getHeatTransferFlag
(){
return
nd
.
getHeatTransferFlag
();
}
/* -------------------------------------------------------------------------- */
template
<
UInt
Dim
>
void
RefElemAkantu
<
Dim
>::
printself
(
std
::
ostream
&
stream
,
int
indent
)
const
{
stream
<<
"RefElemAkantu: "
<<
this
<<
" "
<<
this
->
dofs
<<
" "
<<
*
(
this
->
dofs
);
}
/* -------------------------------------------------------------------------- */
template
<
UInt
_Dim
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
RefElemAkantu
<
_Dim
>
&
ref
){
ref
.
printself
(
os
);
return
os
;
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif
/* __LIBMULTISCALE_REF_ELEM_AKANTU_HH__ */
Event Timeline
Log In to Comment