Exemplo n.º 1
0
Arquivo: box.c Projeto: tpatki/sequoia
int
hypre_BoxArrayArrayDestroy( hypre_BoxArrayArray *box_array_array )
{
    int  ierr = 0;
    int  i;

    if (box_array_array)
    {
        hypre_ForBoxArrayI(i, box_array_array)
        hypre_BoxArrayDestroy(
            hypre_BoxArrayArrayBoxArray(box_array_array, i));

        hypre_TFree(hypre_BoxArrayArrayBoxArrays(box_array_array));
        hypre_TFree(box_array_array);
    }

    return ierr;
}
Exemplo n.º 2
0
  hypre_CommPkg *
  hypre_CommPkgCreate( hypre_BoxArrayArray   *send_boxes,
                       hypre_BoxArrayArray   *recv_boxes,
                       hypre_Index            send_stride,
                       hypre_Index            recv_stride,
                       hypre_BoxArray        *send_data_space,
                       hypre_BoxArray        *recv_data_space,
                       int                  **send_processes,
                       int                  **recv_processes,
                       int                    num_values,
                       MPI_Comm               comm,
                       hypre_Index            periodic            )
{
   hypre_CommPkg    *comm_pkg;
                  
   int               num_sends;
   int              *send_procs;
   hypre_CommType  **send_types;
   int               num_recvs;
   int              *recv_procs;
   hypre_CommType  **recv_types;

   hypre_CommType   *copy_from_type;
   hypre_CommType   *copy_to_type;

   int               i;

   /*------------------------------------------------------
    * Put arguments into hypre_CommPkg
    *------------------------------------------------------*/

   comm_pkg = hypre_CTAlloc(hypre_CommPkg, 1);

   hypre_CommPkgNumValues(comm_pkg)     = num_values;
   hypre_CommPkgComm(comm_pkg)          = comm;

   /*------------------------------------------------------
    * Set up communication information
    *------------------------------------------------------*/

   hypre_CommPkgCreateInfo(send_boxes, send_stride,
                           send_data_space, send_processes,
                           num_values, comm, periodic,
                           &num_sends, &send_procs,
                           &send_types, &copy_from_type);

   hypre_CommPkgNumSends(comm_pkg)     = num_sends;
   hypre_CommPkgSendProcs(comm_pkg)    = send_procs;
   hypre_CommPkgSendTypes(comm_pkg)    = send_types;
   hypre_CommPkgCopyFromType(comm_pkg) = copy_from_type;

   hypre_CommPkgCreateInfo(recv_boxes, recv_stride,
                           recv_data_space, recv_processes,
                           num_values, comm,  periodic,
                           &num_recvs, &recv_procs,
                           &recv_types, &copy_to_type);

   hypre_CommPkgNumRecvs(comm_pkg)   = num_recvs;
   hypre_CommPkgRecvProcs(comm_pkg)  = recv_procs;
   hypre_CommPkgRecvTypes(comm_pkg)  = recv_types;
   hypre_CommPkgCopyToType(comm_pkg) = copy_to_type;

   /*------------------------------------------------------
    * Destroy the input boxes and processes
    *------------------------------------------------------*/

   hypre_ForBoxArrayI(i, send_boxes)
      hypre_TFree(send_processes[i]);
   hypre_BoxArrayArrayDestroy(send_boxes);
   hypre_TFree(send_processes);

   hypre_ForBoxArrayI(i, recv_boxes)
      hypre_TFree(recv_processes[i]);
   hypre_BoxArrayArrayDestroy(recv_boxes);
   hypre_TFree(recv_processes);

#if defined(HYPRE_COMM_SIMPLE) || defined(HYPRE_COMM_VOLATILE)
#else
   hypre_CommPkgCommit(comm_pkg);

   /* free up comm types */
   for (i = 0; i < hypre_CommPkgNumSends(comm_pkg); i++)
      hypre_CommTypeDestroy(hypre_CommPkgSendType(comm_pkg, i));
   hypre_TFree(hypre_CommPkgSendTypes(comm_pkg));
   for (i = 0; i < hypre_CommPkgNumRecvs(comm_pkg); i++)
      hypre_CommTypeDestroy(hypre_CommPkgRecvType(comm_pkg, i));
   hypre_TFree(hypre_CommPkgRecvTypes(comm_pkg));
#endif

   return comm_pkg;
}