Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92259053
mesh_tree_constructor_tmpl.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
Mon, Nov 18, 20:52
Size
3 KB
Mime Type
text/x-c
Expires
Wed, Nov 20, 20:52 (2 d)
Engine
blob
Format
Raw Data
Handle
22406937
Attached To
rAKA akantu
mesh_tree_constructor_tmpl.hh
View Options
/**
* @file mesh_tree_constructor_tmpl.hh
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @date creation: Thu Feb 26 2015
* @date last modification: Thu Feb 26 2015
*
* @brief Class for constructing the CGAL primitives of a mesh
*
* @section LICENSE
*
* Copyright (©) 2015 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/>.
*
*/
/* -------------------------------------------------------------------------- */
#ifndef _AKANTU_MESH_TREE_CONSTRUCTOR_TMPL_HH__
#define _AKANTU_MESH_TREE_CONSTRUCTOR_TMPL_HH__
#include "aka_common.hh"
#include "mesh_tree_constructor.hh"
#include "tree_type_helper.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_AKANTU__
template
<
UInt
d
,
ElementType
type
>
MeshTreeConstructor
<
d
,
type
>::~
MeshTreeConstructor
()
{
delete
data_tree
;
}
template
<>
void
MeshTreeConstructor
<
2
,
_triangle_3
>::
constructData
()
{
/// Variable declaration instead of template arguments
const
UInt
d
=
2
;
const
ElementType
type
=
_triangle_3
;
const
GhostType
ghost_type
=
_not_ghost
;
primitive_list
.
clear
();
UInt
nb_nodes_per_element
=
mesh
.
getNbNodesPerElement
(
type
);
const
Array
<
UInt
>
&
connectivity
=
mesh
.
getConnectivity
(
type
,
ghost_type
);
const
Array
<
Real
>
&
nodes
=
mesh
.
getNodes
();
Array
<
UInt
>::
const_vector_iterator
it
=
connectivity
.
begin
(
nb_nodes_per_element
);
Array
<
UInt
>::
const_vector_iterator
end
=
connectivity
.
end
(
nb_nodes_per_element
);
/// This loop builds the list of triangle primitives
for
(;
it
!=
end
;
++
it
)
{
const
Vector
<
UInt
>
&
el_connectivity
=
*
it
;
Matrix
<
Real
>
node_coordinates
(
d
,
nb_nodes_per_element
);
for
(
UInt
i
=
0
;
i
<
nb_nodes_per_element
;
i
++
)
for
(
UInt
j
=
0
;
j
<
d
;
j
++
)
node_coordinates
(
j
,
i
)
=
nodes
(
el_connectivity
(
i
),
j
);
/// There's a problem here with constructors :
/// - 2D constructors take 2 arguments
/// - 3D constructors take 3 arguments
/// Need for a solution that can treat the two cases together
TreeTypeHelper
<
d
,
type
>::
point_type
a
(
node_coordinates
(
0
,
0
),
node_coordinates
(
1
,
0
),
0.
);
TreeTypeHelper
<
d
,
type
>::
point_type
b
(
node_coordinates
(
0
,
1
),
node_coordinates
(
1
,
1
),
0.
);
TreeTypeHelper
<
d
,
type
>::
point_type
c
(
node_coordinates
(
0
,
2
),
node_coordinates
(
1
,
2
),
0.
);
/// Number of arguments here should not be a problem with polygon/polyhedra
/// Also it is possible to create tree or lists from polyhedric surfaces
TreeTypeHelper
<
d
,
type
>::
primitive_type
t
(
a
,
b
,
c
);
primitive_list
.
push_back
(
t
);
}
/// Construct the tree
if
(
data_tree
)
{
delete
data_tree
;
data_tree
=
NULL
;
}
data_tree
=
new
TreeTypeHelper
<
d
,
type
>::
tree
(
primitive_list
.
begin
(),
primitive_list
.
end
());
}
__END_AKANTU__
#endif
// _AKANTU_MESH_TREE_CONSTRUCTOR_TMPL_HH__
Event Timeline
Log In to Comment