Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66809454
mesh_utils.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, Jun 17, 17:21
Size
8 KB
Mime Type
text/x-c++
Expires
Wed, Jun 19, 17:21 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18289586
Attached To
rAKA akantu
mesh_utils.hh
View Options
/**
* @file mesh_utils.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author David Simon Kammer <david.kammer@epfl.ch>
* @author Leonardo Snozzi <leonardo.snozzi@epfl.ch>
* @author Nicolas Richart <nicolas.richart@epfl.ch>
* @author Marco Vocialta <marco.vocialta@epfl.ch>
*
* @date Fri Aug 20 12:19:44 2010
*
* @brief All mesh utils necessary for various tasks
*
* @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 "aka_common.hh"
#include "mesh.hh"
#include "aka_csr.hh"
/* -------------------------------------------------------------------------- */
#include <vector>
/* -------------------------------------------------------------------------- */
#ifndef __AKANTU_MESH_UTILS_HH__
#define __AKANTU_MESH_UTILS_HH__
/* -------------------------------------------------------------------------- */
__BEGIN_AKANTU__
class
MeshUtils
{
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public
:
MeshUtils
();
virtual
~
MeshUtils
();
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public
:
/// build map from nodes to elements
static
void
buildNode2Elements
(
const
Mesh
&
mesh
,
CSR
<
UInt
>
&
node_to_elem
,
UInt
spatial_dimension
=
0
);
static
void
buildNode2Elements
(
const
Mesh
&
mesh
,
CSR
<
Element
>
&
node_to_elem
,
UInt
spatial_dimension
=
0
);
// static void buildNode2Elements(const Mesh & mesh, Array<UInt> & node_offset, Array<UInt> & node_to_elem, UInt spatial_dimension = 0);
/// build map from nodes to elements for a specific element type
static
void
buildNode2ElementsByElementType
(
const
Mesh
&
mesh
,
ElementType
type
,
CSR
<
UInt
>
&
node_to_elem
);
// static void buildNode2ElementsByElementType(const Mesh & mesh, ElementType type, Array<UInt> & node_offset, Array<UInt> & node_to_elem);
/// build facets elements on boundary
static
void
buildFacets
(
Mesh
&
mesh
);
/// build facets elements : boundary and internals
static
void
buildAllFacets
(
Mesh
&
mesh
,
Mesh
&
mesh_facets
);
/// build facets for a given spatial dimension
static
void
buildFacetsDimension
(
Mesh
&
mesh
,
Mesh
&
mesh_facets
,
bool
boundary_only
,
UInt
dimension
,
ByElementTypeReal
&
barycenter
);
/// build normal to some elements
// static void buildNormals(Mesh & mesh, UInt spatial_dimension=0);
/// take the local_connectivity array as the array of local and ghost
/// connectivity, renumber the nodes and set the connectivity of the mesh
static
void
renumberMeshNodes
(
Mesh
&
mesh
,
UInt
*
local_connectivities
,
UInt
nb_local_element
,
UInt
nb_ghost_element
,
ElementType
type
,
Array
<
UInt
>
&
old_nodes
);
static
void
setUIntData
(
Mesh
&
mesh
,
UInt
*
data
,
UInt
nb_tags
,
const
ElementType
&
type
);
/// Detect closed surfaces of the mesh and save the surface id
/// of the surface elements in the array surface_id
static
void
buildSurfaceID
(
Mesh
&
mesh
);
/// compute pbc pair for on given direction
static
void
computePBCMap
(
const
Mesh
&
mymesh
,
const
UInt
dir
,
std
::
map
<
UInt
,
UInt
>
&
pbc_pair
);
/// compute pbc pair for a surface pair
static
void
computePBCMap
(
const
Mesh
&
mymesh
,
const
std
::
pair
<
Surface
,
Surface
>
&
surface_pair
,
const
ElementType
type
,
std
::
map
<
UInt
,
UInt
>
&
pbc_pair
);
// /// tweak mesh connectivity to activate pbc
// static void tweakConnectivityForPBC(Mesh & mesh,
// bool flag_x,
// bool flag_y = false,
// bool flag_z = false);
/// create a multimap of nodes per surfaces
static
void
buildNodesPerSurface
(
const
Mesh
&
mesh
,
CSR
<
UInt
>
&
nodes_per_surface
);
/// function to print the contain of the class
// virtual void printself(std::ostream & stream, int indent = 0) const;
/// remove not connected nodes /!\ this functions renumbers the nodes.
static
void
purifyMesh
(
Mesh
&
mesh
);
/// function to insert intrinsic cohesive elements on the selected
/// facets
static
void
insertIntrinsicCohesiveElements
(
Mesh
&
mesh
,
Mesh
&
mesh_facets
,
ElementType
type_facet
,
const
Array
<
UInt
>
&
facet_insertion
);
/// function to insert cohesive elements on the selected facets
static
void
insertCohesiveElements
(
Mesh
&
mesh
,
Mesh
&
mesh_facets
,
ElementType
type_facet
,
const
Array
<
UInt
>
&
facet_insertion
,
Array
<
UInt
>
&
doubled_nodes
,
Array
<
UInt
>
&
doubled_facets
);
private
:
/// match pairs that are on the associated pbc's
static
void
matchPBCPairs
(
const
Mesh
&
mymesh
,
const
UInt
dir
,
std
::
vector
<
UInt
>
&
selected_left
,
std
::
vector
<
UInt
>
&
selected_right
,
std
::
map
<
UInt
,
UInt
>
&
pbc_pair
);
/// function used by all the renumbering functions
static
void
renumberNodesInConnectivity
(
UInt
*
list_nodes
,
UInt
nb_nodes
,
std
::
map
<
UInt
,
UInt
>
&
renumbering_map
);
/// function to double a given facet and update the list of doubled
/// nodes
static
void
doubleFacet
(
Mesh
&
mesh
,
Mesh
&
mesh_facets
,
Element
&
facet
,
Array
<
UInt
>
&
doubled_nodes
,
Array
<
UInt
>
&
doubled_facets
);
/// function to double a subfacet given start and end index for
/// local facet_to_subfacet vector, and update the list of doubled
/// nodes
static
void
doubleSubfacet
(
Mesh
&
mesh
,
Mesh
&
mesh_facets
,
const
Element
&
subfacet
,
UInt
start
,
UInt
end
,
Array
<
UInt
>
&
doubled_nodes
);
/// double middle nodes if facets are _segment_3
static
void
doubleMiddleNode
(
Mesh
&
mesh
,
Mesh
&
mesh_facets
,
ElementType
type_facet
,
Array
<
UInt
>
&
doubled_nodes
,
const
Array
<
UInt
>
&
doubled_facets
);
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
public
:
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
private
:
};
class
ElementSorter
{
public
:
ElementSorter
(
const
ElementSorter
&
e
)
:
atan2
(
e
.
atan2
)
{}
ElementSorter
(
std
::
map
<
Element
,
Real
,
CompElementLess
>
&
atan2
)
:
atan2
(
atan2
)
{}
inline
bool
operator
()(
const
Element
&
first
,
const
Element
&
second
);
private
:
std
::
map
<
Element
,
Real
,
CompElementLess
>
&
atan2
;
};
/* -------------------------------------------------------------------------- */
/* inline functions */
/* -------------------------------------------------------------------------- */
#if defined (AKANTU_INCLUDE_INLINE_IMPL)
# include "mesh_utils_inline_impl.cc"
#endif
/// standard output stream operator
// inline std::ostream & operator <<(std::ostream & stream, const MeshUtils & _this)
// {
// _this.printself(stream);
// return stream;
// }
__END_AKANTU__
#endif
/* __AKANTU_MESH_UTILS_HH__ */
Event Timeline
Log In to Comment