def _setup(self): # add coord swarm variable now (if available) if self._cself.owningCellVariable: self._owningCell = svar.SwarmVariable( self, "int", 1, _cself=self._cself.owningCellVariable) if self._cself.globalIdVariable: self._globalId = svar.SwarmVariable( self, "int", 1, _cself=self._cself.globalIdVariable) # set this flag self._cself.isAdvecting = False
def _setup(self): if self._cself.localCoordVariable: self._particleCoordinates = svar.SwarmVariable( self, "double", self.mesh.dim, _cself=self._cself.localCoordVariable) if self._cself.weightVariable: self._weightsVariable = svar.SwarmVariable( self, "double", 1, _cself=self._cself.weightVariable)
def add_variable(self, dataType, count): """ Add a variable to each particle in this swarm. Variables can be added at any point. Removal of variables is however not currently supported. See help(SwarmVariable) for further information. Parameters ---------- dataType: str The data type for the variable. Available types are "char", "short", "int", "float" or "double". count: unsigned The number of values to be stored for each particle. Returns ------- variable: SwarmVariable The newly created swarm variable. >>> # first we need a mesh >>> mesh = uw.mesh.FeMesh_Cartesian( elementType='Q1/dQ0', elementRes=(16,16), minCoord=(0.,0.), maxCoord=(1.,1.) ) >>> # create swarm >>> swarm = uw.swarm.Swarm(mesh) >>> # add a variable >>> svar = swarm.add_variable("char",1) >>> # add another >>> svar = swarm.add_variable("double",3) >>> # add some particles >>> swarm.populate_using_layout(uw.swarm.layouts.PerCellGaussLayout(swarm,2)) >>> # add another variable >>> svar = swarm.add_variable("double",5) """ return svar.SwarmVariable(self, dataType, count)
def _setup(self): # add coord swarm variable now (if available) if self._cself.owningCellVariable: self._owningCell = svar.SwarmVariable( self, "int", 1, _cself=self._cself.owningCellVariable, writeable=False) if self._cself.globalIdVariable: self._globalId = svar.SwarmVariable( self, "int", 1, _cself=self._cself.globalIdVariable, writeable=False)
def _setup(self): if self._cself.particleCoordVariable: self._particleCoordinates = svar.SwarmVariable( self, "double", self.mesh.dim, _cself=self._cself.particleCoordVariable) self._cself.isAdvecting = True
def _setup(self): if self._cself.particleCoordVariable: self._particleCoordinates = svar.SwarmVariable( self, "double", self.mesh.dim, _cself=self._cself.particleCoordVariable, writeable=False)