/[escript]/trunk/escript/py_src/datamanager.py
ViewVC logotype

Diff of /trunk/escript/py_src/datamanager.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3343 by caltinay, Wed Oct 13 02:12:06 2010 UTC revision 3344 by caltinay, Thu Nov 11 23:26:52 2010 UTC
# Line 263  class DataManager(object): Line 263  class DataManager(object):
263          self.__clearData()          self.__clearData()
264    
265      def __createDataset(self):      def __createDataset(self):
         idata = self.__interpolateData()  
   
266          from esys.weipa.weipacpp import EscriptDataset          from esys.weipa.weipacpp import EscriptDataset
267          ds=EscriptDataset()          from esys.weipa import createDataset
268          ds.setDomain(self._domain)  
269            ds = createDataset(self._domain, self._data)
270          ds.setCycleAndTime(self._N, self._time)          ds.setCycleAndTime(self._N, self._time)
271          ds.setMetadataSchemaString(self._md_schema, self._metadata)          ds.setMetadataSchemaString(self._md_schema, self._metadata)
272          ds.setMeshLabels(self._meshlabels[0], self._meshlabels[1], self._meshlabels[2])          ds.setMeshLabels(self._meshlabels[0], self._meshlabels[1], self._meshlabels[2])
273          ds.setMeshUnits(self._meshunits[0], self._meshunits[1], self._meshunits[2])          ds.setMeshUnits(self._meshunits[0], self._meshunits[1], self._meshunits[2])
         for n,d in idata.items():  
             ds.addData(d, n, "") #TODO: data units are not supported here yet  
274          return ds          return ds
275            
276      def __clearData(self):      def __clearData(self):
# Line 300  class DataManager(object): Line 297  class DataManager(object):
297          from esys.weipa.weipacpp import visitInitialize          from esys.weipa.weipacpp import visitInitialize
298          return visitInitialize(simFile, comment)          return visitInitialize(simFile, comment)
299    
     def __interpolateData(self):  
         # (Reduced)Solution is not directly supported so interpolate to a  
         # different function space  
         from esys.escript import Solution, ReducedSolution  
         from esys.escript import ContinuousFunction, ReducedContinuousFunction  
         from esys.escript.util import interpolate  
         new_data={}  
         for n,d in self._data.items():  
             if not d.isEmpty():  
                 fs=d.getFunctionSpace()  
                 domain=fs.getDomain()  
                 if fs == Solution(domain):  
                     new_data[n]=interpolate(d, ContinuousFunction(domain))  
                 elif fs == ReducedSolution(domain):  
                     new_data[n]=interpolate(d, ReducedContinuousFunction(domain))  
                 else:  
                     new_data[n]=d  
         return new_data  
   
300      def __loadState(self):      def __loadState(self):
301          stamp_file=self.__getStampFilename(self._restartdir)          stamp_file=self.__getStampFilename(self._restartdir)
302          try:          try:

Legend:
Removed from v.3343  
changed lines
  Added in v.3344

  ViewVC Help
Powered by ViewVC 1.1.26