Skip to content
Snippets Groups Projects
Commit d625a4a6 authored by Eric Dalissier's avatar Eric Dalissier
Browse files

Systeme synchronization, but the test dont always work...

parent 19827488
No related branches found
No related tags found
No related merge requests found
...@@ -68,4 +68,4 @@ find_library(FFTWFloat_LIBRARY ...@@ -68,4 +68,4 @@ find_library(FFTWFloat_LIBRARY
set(FFTW_PROCESS_INCLUDES FFTW_INCLUDE_DIR) set(FFTW_PROCESS_INCLUDES FFTW_INCLUDE_DIR)
set(FFTW_PROCESS_LIBS FFTW_LIBRARY FFTWFloat_LIBRARY FFTW_MPI_LIBRARY) set(FFTW_PROCESS_LIBS FFTW_LIBRARY FFTWFloat_LIBRARY FFTW_MPI_LIBRARY)
libfind_process(FFTW) libfind_process(FFTW)
...@@ -18,6 +18,7 @@ Requirements : ...@@ -18,6 +18,7 @@ Requirements :
- fftw - fftw
- cmake > 2.8 - cmake > 2.8
- a python implementation including numpy and mpi4py. - a python implementation including numpy and mpi4py.
- pytest library (install with python-pip)
The install consists in 3 steps. First configuration of the package, makefile, setup.py and other files generation, then build of the underlying fortran libraries and of the python package and finally copy of the required files in the appropriate place. The install consists in 3 steps. First configuration of the package, makefile, setup.py and other files generation, then build of the underlying fortran libraries and of the python package and finally copy of the required files in the appropriate place.
......
""" """
@file synchronizeGhosts.py @package parmepy.operator.synchronizeGhosts
Update ghost points for some fields defined on a specific topology. Update ghost points for some fields defined on a specific topology.
""" """
from parmepy.operator.continuous import Operator
from parmepy.operator import Operator from parmepy.operator.synchronizeGhosts_d import SynchronizeGhosts_d
from parmepy.constants import debug from parmepy.constants import debug
...@@ -14,38 +14,45 @@ class SynchronizeGhosts(Operator): ...@@ -14,38 +14,45 @@ class SynchronizeGhosts(Operator):
""" """
@debug @debug
def __init__(self, fieldslist, topology, transferMethod): def __init__(self, fieldslist, resolution=None,
method='', **other_config):
""" """
Defines a way to send/recv values at ghosts points for a list Defines a way to send/recv values at ghosts points for a list
of fields, discretized on a given topology. of fields, discretized on a given topology.
@param fieldslist : a list of fields @param fieldslist : a list of fields
@param topology : the topology common to all fields.
@param transferMethod : which type of exchange is used.
""" """
if isinstance(fieldslist, list):
Operator.__init__(self, fieldslist, method)
else:
Operator.__init__(self, [fieldslist], method)
self.fieldslist = fieldslist
self.resolution = resolution
self.method = method
self.config = other_config
@debug @debug
def setUp(self): def setUp(self):
""" """
Transport operator discretization method. SynchroGhost operator discretization method.
Create an discrete Transport operator from given specifications. Create an discrete SynchroGhost operator from given specifications.
""" """
# 1 - get discrete fields arrays for v in self.variables:
# 2 - get list of ghosts area # the topology for v ...
# 3 - get neighbours topo = self.domain.getOrCreateTopology(self.domain.dimension,
# 4 - find what is to be send/recv, the size of the arrays and self.resolution[v])
# allocate buffers if required # ... and the corresponding discrete field
# 5 - set send/recv order self.discreteFields[v] = v.discretize(topo)
self.discreteOperator.setUp() self.discreteOperator = \
SynchronizeGhosts_d(self.discreteFields[v], topo,
transferMethod=self.method, **self.config)
@debug self.discreteOperator.setUp()
def apply(self, *args): self._isUpToDate = True
# Do the send/recv as defined in setup.
return self.discreteOperator.apply(*args)
if __name__ == "__main__": if (__name__ == "__main__"):
print __doc__ print __doc__
print "- Provided class : SynchronizeGhosts" print "- Provided class : SynchronizeGhosts"
print SynchronizeGhosts.__doc__ print SynchronizeGhosts.__doc__
This diff is collapsed.
"""
Testing parmepy.operator.synchronization
"""
import parmepy as pp
import numpy as np
from parmepy.operator.synchronizeGhosts import SynchronizeGhosts
from parmepy.fields.continuous import Field
from parmepy.mpi.topology import Cartesian
from parmepy.fields.analytical import AnalyticalField
from parmepy.mpi.main_var import main_comm, main_size, main_rank, MPI
from parmepy.operator.analytic import Analytic
def computeVel(x, y, z):
vx = x
vy = y
vz = z
return vx, vy, vz
def test_Synchro():
nb = 65
dim = 3
boxLength = [1., 1., 1.]
boxMin = [0., 0., 0.]
nbElem = [nb, nb, nb]
nbGhosts = 2.
dom = pp.Box(dim, length=boxLength, origin=boxMin)
## Fields
field = Field(domain=dom, name='velocity', isVector=True)
# a = Analytic(field, formula=computeVel,
# resolution={field: nbElem},
# )
# a.setUp()
# velo = AnalyticalField(domain=dom, formula=computeVel,
# name='Velocity', isVector=True)
Synchrotest = SynchronizeGhosts(field, resolution={field: nbElem, },
method='greaterSend')
# Synchrotest = SynchronizeGhosts(velo, resolution={velo: nbElem},
# method='greaterSend')
# DiscreteOperator.__init__(velo)
# Operator.setUp(self)
# topoId, topo = dom.addTopology(
# Cartesian(domain=dom, dim=3,
# globalMeshResolution=[nb, nb, nb], # {velo: nbElem},
# comm=main_comm, periods=np.asarray([True, True, True]),
# ghosts=[nbGhosts, nbGhosts, nbGhosts]))
# df, dfId = velo.discretize(topo)
# self.discreteFieldId[v] = dfId
# DiscreteOperator.__init__( velo)
# synchro = SynchronizeGhosts(velo, topo, 'greaterSend')
# synchro.discreteFieldId[velo] = dfId
# self.discreteOperator = Stretching_d(self, method=self.method,
# **self.config)
# self.discreteOperator.setUp()
print "Setup Synchro"
Synchrotest.setUp()
print "Apply Synchro"
Synchrotest.apply()
if __name__ == "__main__":
print "Rank", main_rank
test_Synchro()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment