// ##################################################################
// begin main program
// ##################################################################
int main(int argc, char **argv)
{
   int i,ierr,nproc,myid;

   // start MPI communication
   ierr = MPI_Init(&argc,&argv);
   ierr = MPI_Comm_rank(MPI_COMM_WORLD, &myid);
   ierr = MPI_Comm_size(MPI_COMM_WORLD, &nproc);

   // welcome
   if(myid == 0) welcome();
 
   // read inputs
   readInputs(myid);

   ierr = MPI_Barrier(MPI_COMM_WORLD);

   // create output folder to store data in
   createOutputFolder(myid);
   
   // create list of triangles containing a given node
   createTriangleList(&g[myid]);

   // find cell loops and vertex loops
   triCellAndVertexLoops(&g[myid]);

   // colouring algorithm
   greedyColouringAlgorithm(&g[myid]);

   // extract edges from triangulation 
   findTriangleEdges(&g[myid]);
            
   // invert edge list (reverse list)
   createEdgeList(&g[myid]);

   // create vertices on each edge (and quad edges)
   createVerticesOnEdge(&g[myid]);

   // create quad cells
   createInteriorVertices(&g[myid]);

   // find quad loops
   quadLoops(&g[myid]);

   // smoothing
   if(strcmp(smoothTechnique,"lagrangian")==0)
   {
   	smoothGrid(&g[myid],numSmooth);
	}
	else if(strcmp(smoothTechnique,"blend")==0)
	{
		smoothTriangleGrid(&g[myid],numSmooth);
     	recreateVerticesOnEdge(&g[myid]);
     	recreateInteriorVertices(&g[myid]);
	}

   // create boundary information
   boundaryNodeConnection_MPI(myid); 

   // create strand template
   if(iStrand) 
   {      
      // wait till thread 0 has finished
      ierr = MPI_Barrier(MPI_COMM_WORLD);

      createStrands(myid, &g[myid]);
   }

   // check quality and output statistics
   meshQuality(myid,&g[myid]);   
      
   // write tecplot outputs
   writeTecplot(myid,&g[myid]);

   ierr = MPI_Barrier(MPI_COMM_WORLD);

   //thanks
   if(myid == 0) thanks();

   MPI_Finalize();
	return 0;	
}
Example #2
0
int main(int argc, char* argv[])
{
     struct rusage before, after;

    /**
     * Alguns 'sanity checks'
     */ 
    if (argc > 2)
    {
        printf("Uso: ./projeto2 [nomeOutput.dat] \n");
        return 1;
    }
    
    /** Nome padrão - malha.dat - ou o que o usuário escolher */
    //char* fileName = (argc == 1) ? MESH_NAME : argv[1];
 
    /** benchmarks para o cálculo do tempo*/
    double time = 0.0;
    
    domain biconvex;
    

    getrusage(RUSAGE_SELF, &before);
    
    
    meshInit( &biconvex );
    innerBC ( &biconvex );
    outerBC ( &biconvex );
    
    parabolicMesh( &biconvex );
    
    getrusage(RUSAGE_SELF, &after); 
    time = calculate(&before, &after);

    FILE * fw = fopen("geometry.dat", "w");
    
    for (int i = 0 ; i <= IMAX-1; i++)
    {
        fprintf(fw, "%f  %f,\n", biconvex.x[i][0], biconvex.y[i][0]);
    }

    fclose(fw);
    /*
    for(int i = 0; i < JMAX; i++)
  printf("x[0][%d] = %f, xRef[0][%d] = %f\n", i, biconvex.x[0][i],i, biconvex.xRef[0][i]);
  
  printf("\n");
    for(int i = 0; i < JMAX; i++)
  printf("y[23][%d] = %f, yRef[23][%d] = %f\n", i, biconvex.y[0][i],i, biconvex.yRef[0][i]);
  */
  
  writeTecplot("malha.dat", &biconvex);
  
  meshDestroy( &biconvex );
  
  
    /************ END PROGRAM ****************/

    
    /** Roda script para plotar residuos no gnuplot */    
    system("gnuplot gnuscript");
    /** That's all folks! */
    
    return 0;
}