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']:
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,n]
62 mesh_generator.lengths = [1.,1.,1.]
63 mesh_generator.offsets = [0.,0.,0.]
64 mesh_generator.execute()
68 triangulator = domain.create_component(
'triangulator',
'cf3.vtk.Tetrahedralize')
69 triangulator.mesh = mesh
70 triangulator.execute()
72 print 'Tetrahedralizer not found, running using Hexas'
75 poisson_solver.regions = [mesh.topology.uri()]
77 poisson_solver.options.disabled_actions = [
'SolveLSS']
80 bc = poisson_solver.BoundaryConditions.add_function_bc(region_name =
'left', variable_name =
'u')
81 bc.value = ['1 + x^2 + 2*y^2']
82 bc.regions = [mesh.topology.left.uri(), mesh.topology.right.uri(), mesh.topology.top.uri(), mesh.topology.bottom.uri()]
85 ic_f = solver.InitialConditions.create_initial_condition(builder_name =
'cf3.UFEM.InitialConditionConstant', field_tag =
'source_term')
87 ic_f.regions = [mesh.topology.uri()]
92 profiler.start(
'Poisson' + modelname +
'-' + lss_name +
'.pprof')
94 poisson_solver.Assembly.execute()
99 assembly_time = poisson_solver.Assembly.properties()[
"timer_mean"]
100 measurement = ET.Element(
'DartMeasurement', name = modelname +
' ' + lss_name +
' timing', type =
'numeric/double')
101 measurement.text = str(assembly_time)
102 print ET.tostring(measurement)
105 model.delete_component()
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)
def start(self, filename)