Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102514498
constitutive_law_inline_impl.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
Fri, Feb 21, 12:54
Size
10 KB
Mime Type
text/x-c++
Expires
Sun, Feb 23, 12:54 (1 d, 6 h)
Engine
blob
Format
Raw Data
Handle
24340803
Attached To
rAKA akantu
constitutive_law_inline_impl.hh
View Options
/**
* @file constitutive_law_inline_impl.hh
*
* @author Mohit Pundir <mohit.pundir@ethz.ch>
*
* @date creation: Sun May 8 2022
* @date last modification: Sun May 8 2022
*
* @brief Constitutive law implementation of inline functions
*
*
* @section LICENSE
*
* Copyright (©) 2018-2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* Akantu 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.
*
* Akantu 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 Akantu. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "poisson_model.hh"
/* -------------------------------------------------------------------------- */
#ifndef __AKANTU_CONSTITUTIVE_LAW_INLINE_IMPL_CC__
#define __AKANTU_CONSTITUTIVE_LAW_INLINE_IMPL_CC__
namespace
akantu
{
/* -------------------------------------------------------------------------- */
inline
const
Parameter
&
ConstitutiveLaw
::
getParam
(
const
ID
&
param
)
const
{
try
{
return
get
(
param
);
}
catch
(...)
{
AKANTU_EXCEPTION
(
"No parameter "
<<
param
<<
" in the constitutive law "
<<
getID
());
}
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
inline
void
ConstitutiveLaw
::
setParam
(
const
ID
&
param
,
T
value
)
{
try
{
set
<
T
>
(
param
,
value
);
}
catch
(...)
{
AKANTU_EXCEPTION
(
"No parameter "
<<
param
<<
" in the constitutive law "
<<
getID
());
}
}
/* -------------------------------------------------------------------------- */
inline
UInt
ConstitutiveLaw
::
addElement
(
const
ElementType
&
type
,
UInt
element
,
const
GhostType
&
ghost_type
)
{
Array
<
UInt
>
&
el_filter
=
this
->
element_filter
(
type
,
ghost_type
);
el_filter
.
push_back
(
element
);
return
el_filter
.
size
()
-
1
;
}
/* -------------------------------------------------------------------------- */
inline
UInt
ConstitutiveLaw
::
addElement
(
const
Element
&
element
)
{
return
this
->
addElement
(
element
.
type
,
element
.
element
,
element
.
ghost_type
);
}
/* -------------------------------------------------------------------------- */
template
<>
inline
void
ConstitutiveLaw
::
registerInternal
<
Real
>
(
InternalConstitutiveLaw
<
Real
>
&
vect
)
{
internal_vectors_real
[
vect
.
getID
()]
=
&
vect
;
}
template
<>
inline
void
ConstitutiveLaw
::
registerInternal
<
UInt
>
(
InternalConstitutiveLaw
<
UInt
>
&
vect
)
{
internal_vectors_uint
[
vect
.
getID
()]
=
&
vect
;
}
template
<>
inline
void
ConstitutiveLaw
::
registerInternal
<
bool
>
(
InternalConstitutiveLaw
<
bool
>
&
vect
)
{
internal_vectors_bool
[
vect
.
getID
()]
=
&
vect
;
}
/* -------------------------------------------------------------------------- */
template
<>
inline
void
ConstitutiveLaw
::
unregisterInternal
<
Real
>
(
InternalConstitutiveLaw
<
Real
>
&
vect
)
{
internal_vectors_real
.
erase
(
vect
.
getID
());
}
template
<>
inline
void
ConstitutiveLaw
::
unregisterInternal
<
UInt
>
(
InternalConstitutiveLaw
<
UInt
>
&
vect
)
{
internal_vectors_uint
.
erase
(
vect
.
getID
());
}
template
<>
inline
void
ConstitutiveLaw
::
unregisterInternal
<
bool
>
(
InternalConstitutiveLaw
<
bool
>
&
vect
)
{
internal_vectors_bool
.
erase
(
vect
.
getID
());
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
inline
bool
ConstitutiveLaw
::
isInternal
(
__attribute__
((
unused
))
const
ID
&
id
,
__attribute__
((
unused
))
const
ElementKind
&
element_kind
)
const
{
AKANTU_TO_IMPLEMENT
();
}
template
<>
inline
bool
ConstitutiveLaw
::
isInternal
<
Real
>
(
const
ID
&
id
,
const
ElementKind
&
element_kind
)
const
{
auto
internal_array
=
internal_vectors_real
.
find
(
this
->
getID
()
+
":"
+
id
);
return
!
(
internal_array
==
internal_vectors_real
.
end
()
||
internal_array
->
second
->
getElementKind
()
!=
element_kind
);
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
inline
const
InternalConstitutiveLaw
<
T
>
&
ConstitutiveLaw
::
getInternal
([[
gnu
::
unused
]]
const
ID
&
int_id
)
const
{
AKANTU_TO_IMPLEMENT
();
return
NULL
;
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
inline
InternalConstitutiveLaw
<
T
>
&
ConstitutiveLaw
::
getInternal
([[
gnu
::
unused
]]
const
ID
&
int_id
)
{
AKANTU_TO_IMPLEMENT
();
return
NULL
;
}
/* -------------------------------------------------------------------------- */
template
<>
inline
const
InternalConstitutiveLaw
<
Real
>
&
ConstitutiveLaw
::
getInternal
(
const
ID
&
int_id
)
const
{
auto
it
=
internal_vectors_real
.
find
(
getID
()
+
":"
+
int_id
);
if
(
it
==
internal_vectors_real
.
end
())
{
AKANTU_SILENT_EXCEPTION
(
"The constitutive law "
<<
name
<<
"("
<<
getID
()
<<
") does not contain an internal "
<<
int_id
<<
" ("
<<
(
getID
()
+
":"
+
int_id
)
<<
")"
);
}
return
*
it
->
second
;
}
/* -------------------------------------------------------------------------- */
template
<>
inline
InternalConstitutiveLaw
<
Real
>
&
ConstitutiveLaw
::
getInternal
(
const
ID
&
int_id
)
{
auto
it
=
internal_vectors_real
.
find
(
getID
()
+
":"
+
int_id
);
if
(
it
==
internal_vectors_real
.
end
())
{
AKANTU_SILENT_EXCEPTION
(
"The constitutive law "
<<
name
<<
"("
<<
getID
()
<<
") does not contain an internal "
<<
int_id
<<
" ("
<<
(
getID
()
+
":"
+
int_id
)
<<
")"
);
}
return
*
it
->
second
;
}
/* -------------------------------------------------------------------------- */
template
<>
inline
const
InternalConstitutiveLaw
<
UInt
>
&
ConstitutiveLaw
::
getInternal
(
const
ID
&
int_id
)
const
{
auto
it
=
internal_vectors_uint
.
find
(
getID
()
+
":"
+
int_id
);
if
(
it
==
internal_vectors_uint
.
end
())
{
AKANTU_SILENT_EXCEPTION
(
"The constitutive law "
<<
name
<<
"("
<<
getID
()
<<
") does not contain an internal "
<<
int_id
<<
" ("
<<
(
getID
()
+
":"
+
int_id
)
<<
")"
);
}
return
*
it
->
second
;
}
/* -------------------------------------------------------------------------- */
template
<>
inline
InternalConstitutiveLaw
<
UInt
>
&
ConstitutiveLaw
::
getInternal
(
const
ID
&
int_id
)
{
auto
it
=
internal_vectors_uint
.
find
(
getID
()
+
":"
+
int_id
);
if
(
it
==
internal_vectors_uint
.
end
())
{
AKANTU_SILENT_EXCEPTION
(
"The constitutive law "
<<
name
<<
"("
<<
getID
()
<<
") does not contain an internal "
<<
int_id
<<
" ("
<<
(
getID
()
+
":"
+
int_id
)
<<
")"
);
}
return
*
it
->
second
;
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
inline
const
Array
<
T
>
&
ConstitutiveLaw
::
getArray
(
const
ID
&
vect_id
,
ElementType
type
,
GhostType
ghost_type
)
const
{
try
{
return
this
->
template
getInternal
<
T
>
(
vect_id
)(
type
,
ghost_type
);
}
catch
(
debug
::
Exception
&
e
)
{
AKANTU_SILENT_EXCEPTION
(
"The constitutive law "
<<
name
<<
"("
<<
getID
()
<<
") does not contain a vector "
<<
vect_id
<<
" ["
<<
e
<<
"]"
);
}
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
inline
Array
<
T
>
&
ConstitutiveLaw
::
getArray
(
const
ID
&
vect_id
,
ElementType
type
,
GhostType
ghost_type
)
{
try
{
return
this
->
template
getInternal
<
T
>
(
vect_id
)(
type
,
ghost_type
);
}
catch
(
debug
::
Exception
&
e
)
{
AKANTU_SILENT_EXCEPTION
(
"The constitutive law "
<<
name
<<
"("
<<
getID
()
<<
") does not contain a vector "
<<
vect_id
<<
" ["
<<
e
<<
"]"
);
}
}
/* -------------------------------------------------------------------------- */
inline
UInt
ConstitutiveLaw
::
getNbData
(
__attribute__
((
unused
))
const
Array
<
Element
>
&
elements
,
__attribute__
((
unused
))
const
SynchronizationTag
&
tag
)
const
{
return
0
;
}
/* -------------------------------------------------------------------------- */
inline
void
ConstitutiveLaw
::
packData
(
__attribute__
((
unused
))
CommunicationBuffer
&
buffer
,
__attribute__
((
unused
))
const
Array
<
Element
>
&
elements
,
__attribute__
((
unused
))
const
SynchronizationTag
&
tag
)
const
{}
/* -------------------------------------------------------------------------- */
inline
void
ConstitutiveLaw
::
unpackData
(
__attribute__
((
unused
))
CommunicationBuffer
&
buffer
,
__attribute__
((
unused
))
const
Array
<
Element
>
&
elements
,
__attribute__
((
unused
))
const
SynchronizationTag
&
tag
)
{
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
inline
void
ConstitutiveLaw
::
packElementDataHelper
(
const
ElementTypeMapArray
<
T
>
&
data_to_pack
,
CommunicationBuffer
&
buffer
,
const
Array
<
Element
>
&
elements
,
const
ID
&
fem_id
)
const
{
DataAccessor
::
packElementalDataHelper
<
T
>
(
data_to_pack
,
buffer
,
elements
,
true
,
model
.
getFEEngine
(
fem_id
));
}
/* -------------------------------------------------------------------------- */
template
<
typename
T
>
inline
void
ConstitutiveLaw
::
unpackElementDataHelper
(
ElementTypeMapArray
<
T
>
&
data_to_unpack
,
CommunicationBuffer
&
buffer
,
const
Array
<
Element
>
&
elements
,
const
ID
&
fem_id
)
{
DataAccessor
::
unpackElementalDataHelper
<
T
>
(
data_to_unpack
,
buffer
,
elements
,
true
,
model
.
getFEEngine
(
fem_id
));
}
}
// namespace akantu
#endif
Event Timeline
Log In to Comment