Last change
on this file since 6331 was
6331,
checked in by aclsce, 15 months ago
|
Moved oasis-mct_5.0 in oasis3-mct/branches directory.
|
File size:
657 bytes
|
Rev | Line | |
---|
[6331] | 1 | #!/usr/bin/env python3 |
---|
| 2 | |
---|
| 3 | import pyoasis |
---|
| 4 | from pyoasis import OASIS |
---|
| 5 | import numpy |
---|
| 6 | from mpi4py import MPI |
---|
| 7 | |
---|
| 8 | comm = MPI.COMM_WORLD |
---|
| 9 | |
---|
| 10 | component_name = "receiver" |
---|
| 11 | |
---|
| 12 | comp = pyoasis.Component(component_name, True, comm) |
---|
| 13 | print(comp) |
---|
| 14 | |
---|
| 15 | n_points = 16 |
---|
| 16 | |
---|
| 17 | partition = pyoasis.SerialPartition(n_points) |
---|
| 18 | print(partition) |
---|
| 19 | |
---|
| 20 | variable = pyoasis.Var("FRECVATM", partition, OASIS.IN) |
---|
| 21 | print(variable) |
---|
| 22 | |
---|
| 23 | comp.enddef() |
---|
| 24 | |
---|
| 25 | date = int(0) |
---|
| 26 | field = pyoasis.asarray(numpy.zeros(n_points)) |
---|
| 27 | |
---|
| 28 | variable.get(date, field) |
---|
| 29 | |
---|
| 30 | expected_field = pyoasis.asarray(range(n_points)) |
---|
| 31 | epsilon = 1e-8 |
---|
| 32 | error = numpy.abs(field-expected_field).sum() |
---|
| 33 | if error < epsilon: |
---|
| 34 | print("Data received successfully") |
---|
| 35 | |
---|
| 36 | del comp |
---|
Note: See
TracBrowser
for help on using the repository browser.