Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F74547981
non_local_manager.cc
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
Sun, Jul 28, 09:43
Size
6 KB
Mime Type
text/x-c
Expires
Tue, Jul 30, 09:43 (2 d)
Engine
blob
Format
Raw Data
Handle
19245826
Attached To
rAKA akantu
non_local_manager.cc
View Options
/**
* @file non_local_manager.cc
* @author Aurelia Isabel Cuba Ramos <aurelia.cubaramos@epfl.ch>
* @date Mon Sep 21 15:32:10 2015
*
* @brief Implementation of non-local manager
*
* @section LICENSE
*
* Copyright (©) 2010-2011 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 "non_local_manager.hh"
#include "non_local_neighborhood.hh"
#include "material_non_local.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_AKANTU__
/* -------------------------------------------------------------------------- */
NonLocalManager
::
NonLocalManager
(
SolidMechanicsModel
&
model
,
const
ID
&
id
,
const
MemoryID
&
memory_id
)
:
Memory
(
id
,
memory_id
),
model
(
model
),
default_neighborhood
(
"default_neighborhood"
),
quad_positions
(
"quad_positions"
,
id
),
volumes
(
"volumes"
,
id
)
{
UInt
spatial_dimension
=
this
->
model
.
getSpatialDimension
();
Mesh
&
mesh
=
this
->
model
.
getMesh
();
/// initialize the element type map arrays
mesh
.
initElementTypeMapArray
(
volumes
,
1
,
spatial_dimension
,
false
,
_ek_regular
,
true
);
mesh
.
initElementTypeMapArray
(
quad_positions
,
spatial_dimension
,
spatial_dimension
,
false
,
_ek_regular
,
true
);
#ifdef AKANTU_IGFEM
mesh
.
initElementTypeMapArray
(
volumes
,
1
,
spatial_dimension
,
false
,
_ek_igfem
,
true
);
mesh
.
initElementTypeMapArray
(
quad_positions
,
spatial_dimension
,
spatial_dimension
,
false
,
_ek_igfem
,
true
);
#endif
}
/* -------------------------------------------------------------------------- */
NonLocalManager
::~
NonLocalManager
()
{
NeighborhoodMap
::
iterator
it
;
for
(
it
=
neighborhoods
.
begin
();
it
!=
neighborhoods
.
end
();
++
it
)
{
if
(
it
->
second
)
delete
it
->
second
;
}
}
/* -------------------------------------------------------------------------- */
void
NonLocalManager
::
setJacobians
(
const
FEEngine
&
fe_engine
,
const
ElementKind
&
kind
)
{
Mesh
&
mesh
=
this
->
model
.
getMesh
();
UInt
spatial_dimension
=
this
->
model
.
getSpatialDimension
();
for
(
UInt
g
=
_not_ghost
;
g
<=
_ghost
;
++
g
)
{
GhostType
gt
=
(
GhostType
)
g
;
Mesh
::
type_iterator
it
=
mesh
.
firstType
(
spatial_dimension
,
gt
,
kind
);
Mesh
::
type_iterator
last_type
=
mesh
.
lastType
(
spatial_dimension
,
gt
,
kind
);
for
(;
it
!=
last_type
;
++
it
)
{
jacobians
(
*
it
,
gt
)
=
&
fe_engine
.
getIntegratorInterface
().
getJacobians
(
*
it
,
gt
);
}
}
}
/* -------------------------------------------------------------------------- */
void
NonLocalManager
::
createNeighborhood
(
const
ID
&
type
,
Real
radius
,
const
ID
&
name
)
{
AKANTU_DEBUG_IN
();
/// check if neighborhood already exists
NeighborhoodMap
::
const_iterator
it
=
neighborhoods
.
find
(
name
);
if
(
it
==
neighborhoods
.
end
()
)
{
/// create new neighborhood for given ID
std
::
stringstream
sstr
;
sstr
<<
"neighborhood:"
<<
name
;
neighborhoods
[
name
]
=
new
NonLocalNeighborhood
(
*
this
,
radius
,
type
,
this
->
quad_positions
,
sstr
.
str
());
}
AKANTU_DEBUG_OUT
();
}
/* -------------------------------------------------------------------------- */
void
NonLocalManager
::
createNeighborhoodSynchronizers
()
{
NeighborhoodMap
::
iterator
it
;
for
(
it
=
neighborhoods
.
begin
();
it
!=
neighborhoods
.
end
();
++
it
)
{
it
->
second
->
createGridSynchronizer
();
}
}
/* -------------------------------------------------------------------------- */
void
NonLocalManager
::
flattenInternal
(
ElementTypeMapReal
&
internal_flat
,
const
GhostType
&
ghost_type
,
const
ElementKind
&
kind
)
{
internal_flat
.
clear
();
const
ID
field_name
=
internal_flat
.
getName
();
for
(
UInt
m
=
0
;
m
<
this
->
non_local_materials
.
size
();
++
m
)
{
Material
&
material
=
*
(
this
->
non_local_materials
[
m
]);
if
(
material
.
isInternal
(
field_name
,
kind
))
material
.
flattenInternal
(
field_name
,
internal_flat
,
ghost_type
,
kind
);
}
}
/* -------------------------------------------------------------------------- */
void
NonLocalManager
::
averageInternals
(
const
GhostType
&
ghost_type
)
{
/// update the flattened version of the internals
std
::
map
<
ID
,
NonLocalVariable
*>::
iterator
non_local_variable_it
=
non_local_variables
.
begin
();
std
::
map
<
ID
,
NonLocalVariable
*>::
iterator
non_local_variable_end
=
non_local_variables
.
end
();
for
(;
non_local_variable_it
!=
non_local_variable_end
;
++
non_local_variable_it
)
{
for
(
UInt
gt
=
_not_ghost
;
gt
<=
_ghost
;
++
gt
)
{
GhostType
ghost_type
=
(
GhostType
)
gt
;
this
->
flattenInternal
(
non_local_variable_it
->
second
->
local
,
ghost_type
,
_ek_regular
);
this
->
flattenInternal
(
non_local_variable_it
->
second
->
non_local
,
ghost_type
,
_ek_regular
);
}
}
/// loop over all neighborhoods and compute the non-local variables
NeighborhoodMap
::
iterator
neighborhood_it
=
neighborhoods
.
begin
();
NeighborhoodMap
::
iterator
neighborhood_end
=
neighborhoods
.
end
();
for
(;
neighborhood_it
!=
neighborhood_end
;
++
neighborhood_it
)
{
non_local_variable_it
=
non_local_variables
.
begin
();
non_local_variable_end
=
non_local_variables
.
end
();
for
(;
non_local_variable_it
!=
non_local_variable_end
;
++
non_local_variable_it
)
{
NonLocalVariable
*
non_local_var
=
non_local_variable_it
->
second
;
neighborhood_it
->
second
->
weightedAvergageOnNeighbours
(
non_local_var
->
local
,
non_local_var
->
non_local
,
non_local_var
->
nb_component
,
ghost_type
);
}
}
}
/* -------------------------------------------------------------------------- */
void
NonLocalManager
::
init
(){
UInt
spatial_dimension
=
this
->
model
.
getSpatialDimension
();
/// exchange the missing ghosts for the non-local neighborhoods
this
->
createNeighborhoodSynchronizers
();
/// insert the ghost quadrature points of the non-local materials into the non-local neighborhoods
for
(
UInt
m
=
0
;
m
<
this
->
non_local_materials
.
size
();
++
m
)
{
switch
(
spatial_dimension
)
{
case
1
:
dynamic_cast
<
MaterialNonLocal
<
1
>
&>
(
*
(
this
->
non_local_materials
[
m
])).
insertQuadsInNeighborhoods
(
_ghost
);
break
;
case
2
:
dynamic_cast
<
MaterialNonLocal
<
2
>
&>
(
*
(
this
->
non_local_materials
[
m
])).
insertQuadsInNeighborhoods
(
_ghost
);
break
;
case
3
:
dynamic_cast
<
MaterialNonLocal
<
3
>
&>
(
*
(
this
->
non_local_materials
[
m
])).
insertQuadsInNeighborhoods
(
_ghost
);
break
;
}
}
this
->
setJacobians
(
this
->
model
.
getFEEngine
(),
_ek_regular
);
this
->
updatePairLists
();
this
->
computeWeights
();
}
__END_AKANTU__
Event Timeline
Log In to Comment