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:
1.1 KB
|
Line | |
---|
1 | #!/usr/bin/env python3 |
---|
2 | |
---|
3 | import pyoasis |
---|
4 | from pyoasis import OASIS |
---|
5 | import numpy |
---|
6 | from mpi4py import MPI |
---|
7 | |
---|
8 | |
---|
9 | component_name = "receiver" |
---|
10 | |
---|
11 | comp = pyoasis.Component(component_name) |
---|
12 | print(comp) |
---|
13 | |
---|
14 | n_points = 16 |
---|
15 | |
---|
16 | partition = pyoasis.SerialPartition(n_points) |
---|
17 | print(partition) |
---|
18 | |
---|
19 | variable = pyoasis.Var("FRECVATM", partition, OASIS.IN) |
---|
20 | print(variable) |
---|
21 | |
---|
22 | comp.enddef() |
---|
23 | |
---|
24 | intracomm = comp.get_intracomm("sender-box") |
---|
25 | intercomm = comp.get_intercomm("sender-box") |
---|
26 | |
---|
27 | print("Receiver intra_comm: rank = {} of {}".format(intracomm.rank, |
---|
28 | intracomm.size)) |
---|
29 | print("Receiver inter_comm: rank = {} of {} Remote size = {}".format(intercomm.rank, |
---|
30 | intercomm.size, |
---|
31 | intercomm.remote_size)) |
---|
32 | |
---|
33 | date = int(0) |
---|
34 | field = pyoasis.asarray(numpy.zeros(n_points)) |
---|
35 | |
---|
36 | print(variable.get(date, field)) |
---|
37 | |
---|
38 | expected_field = pyoasis.asarray(range(n_points)) |
---|
39 | epsilon = 1e-8 |
---|
40 | error = numpy.abs(field-expected_field).sum() |
---|
41 | if error < epsilon: |
---|
42 | print("Data received successfully") |
---|
43 | |
---|
44 | del comp |
---|
Note: See
TracBrowser
for help on using the repository browser.