/[escript]/trunk/downunder/py_src/domainbuilder.py
ViewVC logotype

Diff of /trunk/downunder/py_src/domainbuilder.py

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

revision 4462 by caltinay, Mon Jun 17 04:12:06 2013 UTC revision 4613 by caltinay, Mon Jan 13 01:09:01 2014 UTC
# Line 415  class DomainBuilder(object): Line 415  class DomainBuilder(object):
415          if len(self.__sources)==0:          if len(self.__sources)==0:
416              raise ValueError("No data")              raise ValueError("No data")
417          X0, NE, DX = self.__sources[0].getDataExtents()          X0, NE, DX = self.__sources[0].getDataExtents()
418          XN=[X0[i]+NE[i]*DX[i] for i in range(len(NE))]          # do not mess with the values if only one source used
419            if len(self.__sources)>1:
420          for src in self.__sources[1:]:              XN=[X0[i]+NE[i]*DX[i] for i in range(len(NE))]
421              d_x0, d_ne, d_dx = src.getDataExtents()  
422              for i in range(len(d_x0)):              for src in self.__sources[1:]:
423                  X0[i]=min(X0[i], d_x0[i])                  d_x0, d_ne, d_dx = src.getDataExtents()
424              for i in range(len(d_dx)):                  for i in range(len(d_x0)):
425                  DX[i]=min(DX[i], d_dx[i])                      X0[i]=min(X0[i], d_x0[i])
426              for i in range(len(d_ne)):                  for i in range(len(d_dx)):
427                  XN[i]=max(XN[i], d_x0[i]+d_ne[i]*d_dx[i])                      DX[i]=min(DX[i], d_dx[i])
428          NE=[int((XN[i]-X0[i])/DX[i]) for i in range(len(XN))]                  for i in range(len(d_ne)):
429                        XN[i]=max(XN[i], d_x0[i]+d_ne[i]*d_dx[i])
430                # FIXME: should this be rounded up instead?
431                NE=[int((XN[i]-X0[i])/DX[i]) for i in range(len(XN))]
432          return X0, NE, DX          return X0, NE, DX
433    
434      def __createDomain(self):      def __createDomain(self):
# Line 458  class DomainBuilder(object): Line 461  class DomainBuilder(object):
461          self._spacing = spacing          self._spacing = spacing
462    
463          lo=[(self._dom_origin[i], self._dom_origin[i]+NE[i]*self._spacing[i]) for i in range(self.__dim)]          lo=[(self._dom_origin[i], self._dom_origin[i]+NE[i]*self._spacing[i]) for i in range(self.__dim)]
464            
465          if self.__dim==3:          if self.__dim==3:
466              dom=Brick(*NE, l0=lo[0], l1=lo[1], l2=lo[2])              dom=Brick(*NE, l0=lo[0], l1=lo[1], l2=lo[2])
467          else:          else:

Legend:
Removed from v.4462  
changed lines
  Added in v.4613

  ViewVC Help
Powered by ViewVC 1.1.26