FrontISTR  5.7.0
Large-scale structural analysis program with finit element method
hecmw_couple_get_mesh.c
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 
10 #include "hecmw_struct.h"
11 #include "hecmw_io_get_mesh.h"
12 #include "hecmw_dist_free.h"
13 
14 #include "hecmw_couple_struct.h"
15 #include "hecmw_couple_info.h"
16 
17 extern struct hecmwST_local_mesh *HECMW_couple_get_mesh(char *name_ID,
18  char *unit_ID) {
19  struct hecmwST_local_mesh *mesh = NULL;
20  struct hecmw_couple_comm *intracomm = NULL;
21 
22  if ((mesh = HECMW_get_mesh(name_ID)) == NULL) return NULL;
23  if ((intracomm = HECMW_couple_get_intracomm_u(unit_ID)) == NULL) goto error;
24 
25  mesh->HECMW_COMM = intracomm->comm;
26  mesh->PETOT = intracomm->psize;
27  mesh->my_rank = intracomm->rank;
28 
29  HECMW_couple_free_comm(intracomm);
30 
31  return mesh;
32 
33 error:
35  return NULL;
36 }
HECMW_couple_get_mesh
struct hecmwST_local_mesh * HECMW_couple_get_mesh(char *name_ID, char *unit_ID)
Definition: hecmw_couple_get_mesh.c:17
hecmwST_local_mesh::my_rank
int my_rank
Definition: hecmw_struct.h:212
HECMW_couple_get_intracomm_u
struct hecmw_couple_comm * HECMW_couple_get_intracomm_u(const char *unit_id)
Definition: hecmw_couple_info.c:1452
HECMW_couple_free_comm
void HECMW_couple_free_comm(struct hecmw_couple_comm *comm)
Definition: hecmw_couple_info.c:79
HECMW_dist_free
void HECMW_dist_free(struct hecmwST_local_mesh *mesh)
Definition: hecmw_dist_free.c:218
mesh
struct hecmwST_local_mesh * mesh
Definition: hecmw_repart.h:71
hecmwST_local_mesh
Definition: hecmw_struct.h:139
hecmw_dist_free.h
hecmw_struct.h
hecmwST_local_mesh::PETOT
int PETOT
Definition: hecmw_struct.h:210
hecmw_couple_comm::rank
int rank
Definition: hecmw_couple_struct.h:17
hecmw_couple_comm
Definition: hecmw_couple_struct.h:12
hecmw_io_get_mesh.h
HECMW_get_mesh
struct hecmwST_local_mesh * HECMW_get_mesh(char *name_ID)
Definition: hecmw_io_get_mesh.c:62
hecmw_couple_comm::psize
int psize
Definition: hecmw_couple_struct.h:16
hecmw_couple_struct.h
hecmw_couple_info.h
NULL
#define NULL
Definition: hecmw_io_nastran.c:30
hecmw_couple_comm::comm
HECMW_Comm comm
Definition: hecmw_couple_struct.h:19
hecmwST_local_mesh::HECMW_COMM
HECMW_Comm HECMW_COMM
Definition: hecmw_struct.h:209