def __call__(self, time, output, domain, sampling, destination): areasum, integralsum, squaresum = _getMoments(sampling, domain, output, (0, 1, 2)) area = areasum.value_list()[0] mean = integralsum / area avgsquared = mean.clone() avgsquared.component_square() squaredavg = squaresum / area deviation = squaredavg - avgsquared deviation.component_sqrt() self.printResults( time, utils.flatten(zip(mean.value_list(), deviation.value_list())), destination)
def __call__(self, time, output, domain, sampling, destination): areasum, integralsum, squaresum = _getMoments(sampling, domain, output, (0,1,2)) area = areasum.value_list()[0] mean = integralsum/area avgsquared = mean.clone() avgsquared.component_square() squaredavg = squaresum/area deviation = squaredavg - avgsquared deviation.component_sqrt() self.printResults( time, utils.flatten(zip(mean.value_list(), deviation.value_list())), destination)
def __call__(self, time, output, domain, sampling, destination): # areasum, integralsum, squaresum = _getMoments(sampling, domain, output, # (0,1,2)) integrals = sampling.integrateWithExponents(domain, output, (0, 1, 2)) area = integrals[0].value_list()[0] # a float mean = integrals[1] / area # an OutputVal avgsquared = mean.clone() avgsquared.component_square() squaredavg = integrals[2] / area deviation = squaredavg - avgsquared deviation.component_abs() deviation.component_sqrt() self.printResults( time, utils.flatten(zip(mean.value_list(), deviation.value_list())), destination)
def polygons(self, gfxwindow, meshctxt): themesh = meshctxt.getObject() meshctxt.restoreCachedData(self.getTime(meshctxt, gfxwindow)) try: # PARALLEL_RCL: Make changes here to display parallel mesh # There is an issue with clicking on the skeleton or mesh # graphics: only the nodes or elements for the front-end # process get the cursor or mark if parallel_enable.enabled(): # This snippet taken from SkeletonDisplayMethod nodes = themesh.all_meshskeletons["nodes"] elements = themesh.all_meshskeletons["elements"] polys = [] for i in range(mpitools.Size()): for el in elements[i]: polys.append( [primitives.Point(*nodes[i][ni]) for ni in el]) return polys else: if gfxwindow.settings.hideEmptyElements: edges = [ element.perimeter() for element in themesh.element_iterator() if element.material() is not None ] else: edges = [ element.perimeter() for element in themesh.element_iterator() ] flatedges = utils.flatten(edges) # corners tells where on each edge to evaluate self.where corners = [[0.0]] * len(flatedges) # evaluate position output for all edges at once polys = self.where.evaluate(themesh, flatedges, corners) # give the corner list the same structure as the edge list: a # list of lists, where each sublist is the list of corners of # an element. polys = utils.unflatten(edges, polys) if len(polys) == 0: mainthread.runBlock(reporter.warn, ( "No mesh elements drawn! Are there no materials assigned?", )) return polys finally: meshctxt.releaseCachedData()
def polygons(self, gfxwindow, meshctxt): themesh = meshctxt.getObject() meshctxt.restoreCachedData(self.getTime(meshctxt, gfxwindow)) try: # PARALLEL_RCL: Make changes here to display parallel mesh # There is an issue with clicking on the skeleton or mesh # graphics: only the nodes or elements for the front-end # process get the cursor or mark if parallel_enable.enabled(): # This snippet taken from SkeletonDisplayMethod nodes = themesh.all_meshskeletons["nodes"] elements = themesh.all_meshskeletons["elements"] polys = [] for i in range(mpitools.Size()): for el in elements[i]: polys.append([primitives.Point(*nodes[i][ni]) for ni in el]) return polys else: if gfxwindow.settings.hideEmptyElements: edges = [element.perimeter() for element in themesh.element_iterator() if element.material() is not None] else: edges = [element.perimeter() for element in themesh.element_iterator()] flatedges = utils.flatten(edges) # corners tells where on each edge to evaluate self.where corners = [[0.0]]*len(flatedges) # evaluate position output for all edges at once polys = self.where.evaluate(themesh, flatedges, corners) # give the corner list the same structure as the edge list: a # list of lists, where each sublist is the list of corners of # an element. polys = utils.unflatten(edges, polys) if len(polys) == 0: mainthread.runBlock( reporter.warn, ("No mesh elements drawn! Are there no materials assigned?",)) return polys finally: meshctxt.releaseCachedData()
def colNames(self, output): return utils.flatten( ["average of " + name, "standard deviation of " + name] for name in output.columnNames())
def colNames(self, output): return utils.flatten( ["average of "+name, "standard deviation of " +name] for name in output.columnNames())