Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F69834724
compute_mesh.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, Jul 3, 18:48
Size
3 KB
Mime Type
text/x-c++
Expires
Fri, Jul 5, 18:48 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18760814
Attached To
rLIBMULTISCALE LibMultiScale
compute_mesh.cc
View Options
/**
* @file compute_mesh.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Wed Jul 09 21:59:47 2014
*
* @brief This computes generate an independent mesh from points and
* connectivities provided as computes
*
* @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/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "action_manager.hh"
#include "communicator.hh"
#include "compute_interface.hh"
#include "compute_point_set.hh"
#include "filter_manager.hh"
#include "lib_continuum.hh"
#include "lib_dd.hh"
#include "lib_dumper.hh"
#include "lib_filter.hh"
#include "lib_md.hh"
#include "lib_stimulation.hh"
#include "lm_common.hh"
#include "container_mesh.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template
<
typename
Cont
>
void
ComputeMesh
::
build
(
Cont
&
cont
)
{
constexpr
UInt
Dim
=
Cont
::
Dim
;
using
MeshType
=
ContainerGenericMesh
<
Dim
>
;
auto
&
output
=
this
->
getCastedOutput
<
MeshType
>
();
// copy the nodes
auto
&
nds
=
output
.
getContainerNodes
();
nds
.
clear
();
RefPointData
<
Cont
::
Dim
>
tmp_nd
;
for
(
UInt
i
=
0
;
i
<
cont
.
size
();
++
i
)
{
tmp_nd
=
cont
[
i
];
nds
.
add
(
tmp_nd
);
}
// construct the connectivity
ComputeInterface
*
conn_ptr
=
dynamic_cast
<
ComputeInterface
*>
(
FilterManager
::
getManager
().
getObject
(
this
->
connectivity
));
conn_ptr
->
build
();
auto
&
els
=
output
.
getContainerElems
();
els
.
clear
();
RefGenericElem
<
Cont
::
Dim
>
tmp_el
;
Real
*
_ptr
=
&
((
*
conn_ptr
)[
0
]);
for
(
UInt
i
=
0
;
i
<
conn_ptr
->
size
()
/
this
->
nb_nodes_per_elem
;
++
i
,
_ptr
+=
this
->
nb_nodes_per_elem
)
{
tmp_el
.
setConnectivity
(
_ptr
,
this
->
nb_nodes_per_elem
);
els
.
add
(
tmp_el
);
}
}
/* -------------------------------------------------------------------------- */
/* LMDESC MESH
This computes generate an independent mesh from a compute
which contains positions and a compute which contains connectivities.
*/
/* LMEXAMPLE COMPUTE pset MESH INPUT coords */
void
ComputeMesh
::
declareParams
()
{
/* LMKEYWORD CONN
Specify the filter ID where the connectivity is stored
*/
this
->
parseKeyword
(
"CONN"
,
connectivity
);
/* LMKEYWORD NB_NODES_PER_ELEM
Specify the number of nodes per elem
*/
this
->
parseKeyword
(
"NB_NODES_PER_ELEM"
,
nb_nodes_per_elem
);
};
void
ComputeMesh
::
compute_make_call
()
{
call_compute
(
*
this
,
[
&
](
auto
&
...
args
)
{
this
->
build
(
args
...);
},
this
->
getInput
(
"input"
));
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
Event Timeline
Log In to Comment