Skip to main content

MeshSelection

MeshSelection_ class is designed for selecting the parts of the domain (mesh).

MeshSelection is often used when we need to assign a material to a part of domain. Also, it is used to select boundary of the domain.

Currently, we have following ways select a mesh.

  1. Mesh selection by meshID
  2. Mesh selection by node numbers
  3. Mesh selection by element numbers
  4. Mesh selection by bounding box

Constructor methods​

We will use the following example to understand the API of MeshSelection_.

Click here to see the example

This example shows how to use MeshSelection_ with meshSelectionByID option.

PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( MeshSelection_ ) :: obj
type(ParameterList_) :: param

Let us initiate an instance of MeshSelection_ wherein we will select the mesh by using mesh-ids.

CALL FPL_INIT(); call param%Initiate()
CALL SetMeshSelectionParam(param=param, isSelectionByMeshID=.TRUE., prefix=obj%GetPrefix())
CALL obj%Initiate( param=param )

Adding mesh regions:

CALL obj%Add( dim=0, meshID=[1,2,3,4,5,6])
CALL obj%Add( dim=1, meshID=[2,5,6,7])
CALL obj%Add( dim=2, meshID=[1,3,5,6,8])
CALL obj%Add( dim=3, meshID=[1,8])

After adding the regions in the MeshSelection_, we should call set() method. This call will do all the necessary steps.

CALL obj%Set()

Display the content.

CALL obj%Display( "" )

cleanup

  CALL obj%Deallocate()
CALL param%Deallocate()
CALL FPL_FINALIZE
END PROGRAM main
Click here to see the results
IsInitiated : TRUE
IsSelectionByMeshID : TRUE
IsSelectionByElemNum : FALSE
IsSelectionByNodeNum : FALSE
IsSelectionByBox : FALSE
PointMeshID ALLOCATED : TRUE
CurveMeshID ALLOCATED : TRUE
SurfaceMeshID ALLOCATED : TRUE
VolumeMeshID ALLOCATED : TRUE
PointElemNum ALLOCATED : FALSE
CurveElemNum ALLOCATED : FALSE
SurfaceElemNum ALLOCATED : FALSE
VolumeElemNum ALLOCATED : FALSE
PointNodeNum ALLOCATED : FALSE
CurveNodeNum ALLOCATED : FALSE
SurfaceNodeNum ALLOCATED : FALSE
VolumeNodeNum ALLOCATED : FALSE
PointBox ALLOCATED : FALSE
CurveBox ALLOCATED : FALSE
SurfaceBox ALLOCATED : FALSE
VolumeBox ALLOCATED : FALSE

# PointMeshID :
# size : 6
1
2
3
4
5
6

# CurveMeshID :
# size : 4
2
5
6
7

# SurfaceMeshID :
# size : 5
1
3
5
6
8

# VolumeMeshID :
# size : 2
1
8
  1. To construct an instance of MeshSelection first we set the parameters in ParameterList_ by calling the method called SetMeshSelectionParam.

  2. After setting the parameters you should call Initiate method.

  3. Now we will add mesh region to MeshSelection_. See Add method.

  4. After you are done adding the mesh parts, do not forget to call Set method.

You can Display the content of MeshSelection by using Display method.

Get methods​

  • To get the meshid you should you GetMeshID method
  • To get the element number, use the GetElemNum method
  • To get the node number, you should use the GetNodeNum method.

All methods​