2 import xml.etree.ElementTree
as ET
10 print 'Profiling is on'
12 print 'GooglePerfTools not found, not profiling'
17 self.profiler.file_path = cf.URI(filename)
18 self.profiler.start_profiling()
23 self.profiler.stop_profiling()
27 cf.env.assertion_throws =
False
28 cf.env.assertion_backtrace =
False
29 cf.env.exception_backtrace =
False
30 cf.env.exception_outputs =
False
31 cf.env.regist_signal_handlers =
False
36 measurement = ET.Element(
'DartMeasurement', name =
'Problem size', type =
'numeric/integer')
37 measurement.text = str(n)
38 print ET.tostring(measurement)
43 for lss_name
in [
'EmptyLSS',
'TrilinosCrs']:
44 for modelname
in [
'Proto',
'Specialized',
'Manual',
'Virtual']:
48 domain = model.create_domain()
50 physics = model.create_physics(
'cf3.physics.DynamicModel')
52 solver = model.create_solver(
'cf3.UFEM.Solver')
54 poisson_solver = solver.add_direct_solver(
'cf3.UFEM.demo.Poisson'+modelname)
55 poisson_solver.matrix_builder =
'cf3.math.LSS.{name}Matrix'.format(name=lss_name)
58 mesh = domain.create_component(
'Mesh',
'cf3.mesh.Mesh')
59 mesh_generator = domain.create_component(
"MeshGenerator",
"cf3.mesh.SimpleMeshGenerator")
60 mesh_generator.mesh = mesh.uri()
61 mesh_generator.nb_cells = [n,n]
62 mesh_generator.lengths = [1.,1.]
63 mesh_generator.offsets = [0.,0.]
64 mesh_generator.execute()
67 triangulator = domain.create_component(
'triangulator',
'cf3.mesh.MeshTriangulator')
68 triangulator.mesh = mesh
69 triangulator.execute()
72 poisson_solver.regions = [mesh.topology.uri()]
74 poisson_solver.options.disabled_actions = [
'SolveLSS']
77 bc = poisson_solver.BoundaryConditions.add_function_bc(region_name =
'left', variable_name =
'u')
78 bc.value = ['1 + x^2 + 2*y^2']
79 bc.regions = [mesh.topology.left.uri(), mesh.topology.right.uri(), mesh.topology.top.uri(), mesh.topology.bottom.uri()]
82 ic_f = solver.InitialConditions.create_initial_condition(builder_name =
'cf3.UFEM.InitialConditionConstant', field_tag =
'source_term')
84 ic_f.regions = [mesh.topology.uri()]
89 profiler.start(
'Poisson' + modelname +
'-' + lss_name +
'.pprof')
91 poisson_solver.Assembly.execute()
96 assembly_time = poisson_solver.Assembly.properties()[
"timer_minimum"]
97 measurement = ET.Element(
'DartMeasurement', name = modelname +
' ' + lss_name +
' timing', type =
'numeric/double')
98 measurement.text = str(assembly_time)
99 print ET.tostring(measurement)
102 model.delete_component()
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)
def start(self, filename)