Ejemplo n.º 1
0
HYPRE_Int
hypre_CommInfoSetTransforms( hypre_CommInfo  *comm_info,
                             HYPRE_Int        num_transforms,
                             hypre_Index     *coords,
                             hypre_Index     *dirs,
                             HYPRE_Int      **send_transforms,
                             HYPRE_Int      **recv_transforms )
{
   hypre_CommInfoNumTransforms(comm_info)  = num_transforms;
   hypre_CommInfoCoords(comm_info)         = coords;
   hypre_CommInfoDirs(comm_info)           = dirs;
   hypre_CommInfoSendTransforms(comm_info) = send_transforms;
   hypre_CommInfoRecvTransforms(comm_info) = recv_transforms;

   return hypre_error_flag;
}
Ejemplo n.º 2
0
HYPRE_Int
hypre_CommInfoCreate( hypre_BoxArrayArray  *send_boxes,
                      hypre_BoxArrayArray  *recv_boxes,
                      HYPRE_Int           **send_procs,
                      HYPRE_Int           **recv_procs,
                      HYPRE_Int           **send_rboxnums,
                      HYPRE_Int           **recv_rboxnums,
                      hypre_BoxArrayArray  *send_rboxes,
                      hypre_BoxArrayArray  *recv_rboxes,
                      HYPRE_Int             boxes_match,
                      hypre_CommInfo      **comm_info_ptr )
{
   hypre_CommInfo  *comm_info;

   comm_info = hypre_TAlloc(hypre_CommInfo, 1);

   hypre_CommInfoNDim(comm_info)          = hypre_BoxArrayArrayNDim(send_boxes);
   hypre_CommInfoSendBoxes(comm_info)     = send_boxes;
   hypre_CommInfoRecvBoxes(comm_info)     = recv_boxes;
   hypre_CommInfoSendProcesses(comm_info) = send_procs;
   hypre_CommInfoRecvProcesses(comm_info) = recv_procs;
   hypre_CommInfoSendRBoxnums(comm_info)  = send_rboxnums;
   hypre_CommInfoRecvRBoxnums(comm_info)  = recv_rboxnums;
   hypre_CommInfoSendRBoxes(comm_info)    = send_rboxes;
   hypre_CommInfoRecvRBoxes(comm_info)    = recv_rboxes;

   hypre_CommInfoNumTransforms(comm_info)  = 0;
   hypre_CommInfoCoords(comm_info)         = NULL;
   hypre_CommInfoDirs(comm_info)           = NULL;
   hypre_CommInfoSendTransforms(comm_info) = NULL;
   hypre_CommInfoRecvTransforms(comm_info) = NULL;

   hypre_CommInfoBoxesMatch(comm_info)    = boxes_match;
   hypre_SetIndex(hypre_CommInfoSendStride(comm_info), 1);
   hypre_SetIndex(hypre_CommInfoRecvStride(comm_info), 1);

   *comm_info_ptr = comm_info;

   return hypre_error_flag;
}
Ejemplo n.º 3
0
HYPRE_Int
hypre_CommInfoDestroy( hypre_CommInfo  *comm_info )
{
   HYPRE_Int           **processes;
   HYPRE_Int           **rboxnums;
   HYPRE_Int           **transforms;
   HYPRE_Int             i, size;

   size = hypre_BoxArrayArraySize(hypre_CommInfoSendBoxes(comm_info));
   hypre_BoxArrayArrayDestroy(hypre_CommInfoSendBoxes(comm_info));
   processes = hypre_CommInfoSendProcesses(comm_info);
   for (i = 0; i < size; i++)
   {
      hypre_TFree(processes[i]);
   }
   hypre_TFree(processes);
   rboxnums = hypre_CommInfoSendRBoxnums(comm_info);
   if (rboxnums != NULL)
   {
      for (i = 0; i < size; i++)
      {
         hypre_TFree(rboxnums[i]);
      }
      hypre_TFree(rboxnums);
   }
   hypre_BoxArrayArrayDestroy(hypre_CommInfoSendRBoxes(comm_info));
   transforms = hypre_CommInfoSendTransforms(comm_info);
   if (transforms != NULL)
   {
      for (i = 0; i < size; i++)
      {
         hypre_TFree(transforms[i]);
      }
      hypre_TFree(transforms);
   }

   size = hypre_BoxArrayArraySize(hypre_CommInfoRecvBoxes(comm_info));
   hypre_BoxArrayArrayDestroy(hypre_CommInfoRecvBoxes(comm_info));
   processes = hypre_CommInfoRecvProcesses(comm_info);
   for (i = 0; i < size; i++)
   {
      hypre_TFree(processes[i]);
   }
   hypre_TFree(processes);
   rboxnums = hypre_CommInfoRecvRBoxnums(comm_info);
   if (rboxnums != NULL)
   {
      for (i = 0; i < size; i++)
      {
         hypre_TFree(rboxnums[i]);
      }
      hypre_TFree(rboxnums);
   }
   hypre_BoxArrayArrayDestroy(hypre_CommInfoRecvRBoxes(comm_info));
   transforms = hypre_CommInfoRecvTransforms(comm_info);
   if (transforms != NULL)
   {
      for (i = 0; i < size; i++)
      {
         hypre_TFree(transforms[i]);
      }
      hypre_TFree(transforms);
   }

   hypre_TFree(hypre_CommInfoCoords(comm_info));
   hypre_TFree(hypre_CommInfoDirs(comm_info));

   hypre_TFree(comm_info);

   return hypre_error_flag;
}