Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91008936
boundary_functions.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
Wed, Nov 6, 21:39
Size
1 KB
Mime Type
text/x-c
Expires
Fri, Nov 8, 21:39 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
22172546
Attached To
rAKA akantu
boundary_functions.cc
View Options
#include "boundary_functions.hh"
__BEGIN_SIMTOOLS__
/* -------------------------------------------------------------------------- */
Real
integrateResidual
(
const
std
::
string
&
sub_boundary_name
,
const
SolidMechanicsModel
&
model
,
UInt
dir
)
{
Real
int_res
=
0.
;
const
Mesh
&
mesh
=
model
.
getMesh
();
const
Array
<
Real
>
&
residual
=
model
.
getResidual
();
// do not need try catch, as all subboundaries should be everywhere.
// try {
const
ElementGroup
&
boundary
=
mesh
.
getElementGroup
(
sub_boundary_name
);
ElementGroup
::
const_node_iterator
nit
=
boundary
.
node_begin
();
ElementGroup
::
const_node_iterator
nend
=
boundary
.
node_end
();
for
(;
nit
!=
nend
;
++
nit
)
{
bool
is_local_node
=
mesh
.
isLocalOrMasterNode
(
*
nit
);
if
(
is_local_node
)
{
int_res
+=
residual
(
*
nit
,
dir
);
}
}
// } catch(debug::Exception e) {
// // AKANTU_DEBUG_ERROR("Error computing integrateResidual. Cannot get SubBoundary: "
// // << sub_boundary_name << " [" << e.what() << "]");
// }
StaticCommunicator
::
getStaticCommunicator
().
allReduce
(
&
int_res
,
1
,
_so_sum
);
return
int_res
;
}
/* -------------------------------------------------------------------------- */
void
boundaryFix
(
Mesh
&
mesh
,
const
std
::
vector
<
std
::
string
>
&
sub_boundary_names
)
{
std
::
vector
<
std
::
string
>::
const_iterator
it
=
sub_boundary_names
.
begin
();
std
::
vector
<
std
::
string
>::
const_iterator
end
=
sub_boundary_names
.
end
();
for
(;
it
!=
end
;
++
it
)
{
if
(
mesh
.
element_group_find
(
*
it
)
==
mesh
.
element_group_end
())
{
mesh
.
createElementGroup
(
*
it
,
mesh
.
getSpatialDimension
()
-
1
);
// empty element group
}
}
}
__END_SIMTOOLS__
Event Timeline
Log In to Comment