Skip to Content.
Sympa Menu

charm - [charm] Calling FEM_Add_ghost_layer & FEM_Add_ghost_elem

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

[charm] Calling FEM_Add_ghost_layer & FEM_Add_ghost_elem


Chronological Thread 
  • From: Fernando Stump <fernando.stump AT gmail.com>
  • To: Charm Mailing List <charm AT cs.illinois.edu>
  • Subject: [charm] Calling FEM_Add_ghost_layer & FEM_Add_ghost_elem
  • Date: Thu, 31 Mar 2011 14:14:49 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

Hi,

 I would like to know if someone can explain why the call for add ghost layer need to be done on the Init() function and cannot be  nested in function inside Init(). Bellow it is and example how It works or not.

Thanks
Fernando

I'm using ParFUM in a C++ library called Yafeq (Yanhua and Osman are somehow familiar with yafeq). I have my init function as:

extern "C" void
init(void)
{
CkPrintf("init started\n");

int mesh=FEM_Mesh_default_write(); // Tell framework we are writing to the mesh
yafeq::FEM<2> fem_init;

// read abaqus file
char path[] = "../tests/input/abaqus_patch_tests/ece3sfp1_step1_yafeq.inp";
fem_init.read_abaqus_file_on_init(path); 
// Add the nodal ghost layer. Not edge based.
const int trianglefaces[3] = {0,1,2};
FEM_Add_ghost_layer(1,1);
FEM_Add_ghost_elem(0,3,trianglefaces);


CkPrintf("Finished with init (Reading took %.f s)\n",CmiWallTimer()-startTime);
FEM_Mesh_print(mesh);
}

And the class yafeq::FEM<d> has the class Mesh<d> which has the function "read_abaqus_file_on_init" which read the mesh and provides it to parfum as below

template <int d>
void Mesh<d>::read_abaqus_file_on_init(char* filename) {

.
.
.
.
{
//Pass Information to ParFUM
int mesh=FEM_Mesh_default_write(); // Tell framework we are writing to the mesh


//Plain data type to be passed to ParFUM
int n_nodes=num_nodes();
double *coord= new double[d*n_nodes];


int count=0;
//loop over nodes
for (id_node_map_iterator nit = nodeMap.begin(); nit != nodeMap.end(); ++nit) {
for (size_t i = 0; i < d; ++i) {
coord[count++]=(*(nit->second))[i];
}
}


CkPrintf("Passing node coords to framework\n");
//Passing the nodes to parfum
FEM_Mesh_data(mesh,        // Add nodes to the current mesh
  FEM_NODE,        // We are registering nodes
  FEM_DATA+0,      // Register the point locations which are normally 
  // the first data elements for an FEM_NODE
  (double *)coord,   // The array of point locations
  0,               // 0 based indexing
  n_nodes,         // The number of points
  FEM_DOUBLE,      // Coordinates are doubles
  d);              // Points have dimension 2 (x,y)





//Plain data type to be passed to ParFUM
int n_elements=num_elements();
int *elements= new int[3*n_elements];



count=0;
//loop over elements
for (id_element_map_iterator elem_it = elementMap.begin(); elem_it != elementMap.end(); ++elem_it) {
for (typename element_type::node_iterator node_it = ((elem_it->second)->nodes_begin()); node_it != ((elem_it->second)->nodes_end()); ++node_it){
int id = nodeIdMap[*node_it];
elements[count++]=id;
}
}



CkPrintf("Passing elements to framework\n");

FEM_Mesh_data(mesh,      // Add nodes to the current mesh
  FEM_ELEM+0,      // We are registering elements with type 0
// The next type of element could be registered with FEM_ELEM+1
  FEM_CONN,        // Register the connectivity table for this
// data elements for this type of FEM entity
  (int *)elements,      // The array of point locations
  0,               // 0 based indexing
  n_elements,            // The number of elements
  FEM_INDEX_0,     // We use zero 1 node numbering
  3);              // Elements have degree 3, since triangles are defined 



delete[] elements;
delete[] coord;


// Setup a node-adjacent ghost layer as we need all the elements around a node to compute
    //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// THIS FUNCTIONS CANNOT BE CALLED HERE, THEY NEED TO BE CALLED AT THE INIT() ELEVEL
// Add the nodal ghost layer. Not edge based. 
// const int trianglefaces[3] = {0,1,2};
//FEM_Add_ghost_layer(1,1);
//FEM_Add_ghost_elem(0,3,trianglefaces);



}




  • [charm] Calling FEM_Add_ghost_layer & FEM_Add_ghost_elem, Fernando Stump, 03/31/2011

Archive powered by MHonArc 2.6.16.

Top of Page