source: CPL/oasis3-mct_5.0/pyoasis/examples/5-points/python/sender-points.py @ 6328

Last change on this file since 6328 was 6328, checked in by aclsce, 17 months ago

First import of oasis3-mct_5.0 (from oasis git server, branch OASIS3-MCT_5.0)

File size: 671 bytes
Line 
1#!/usr/bin/env python3
2
3import pyoasis
4from pyoasis import OASIS
5from mpi4py import MPI
6
7comm = MPI.COMM_WORLD
8
9component_name = "sender-points"
10
11comp = pyoasis.Component(component_name, True, comm)
12
13print(comp)
14
15n_points = 16
16
17comm_rank = comp.localcomm.rank
18comm_size = comp.localcomm.size
19
20local_size = int(n_points/comm_size)
21offset = comm_rank*local_size
22
23indices = []
24for i in range(local_size):
25    indices.append(offset + i)
26
27partition = pyoasis.PointsPartition(indices)
28print(partition)
29
30variable = pyoasis.Var("FSENDOCN", partition, OASIS.OUT)
31print(variable)
32
33comp.enddef()
34
35date = int(0)
36
37field = pyoasis.asarray(indices)
38
39variable.put(date, field)
40
41del comp
Note: See TracBrowser for help on using the repository browser.