The topology module defines the topology objects, notably the StructuredTopology and UnstructuredTopology. Maintaining strict separation of topological and geometrical information, the topology represents a set of elements and their interconnectivity, boundaries, refinements, subtopologies etc, but not their positioning in physical space. The dimension of the topology represents the dimension of its elements, not that of the the space they are embedded in.

The primary role of topologies is to form a domain for nutils.function objects, like the geometry function and function bases for analysis, as well as provide tools for their construction. It also offers methods for integration and sampling, thus providing a high level interface to operations otherwise written out in element loops. For lower level operations topologies can be used as nutils.element iterators.

class nutils.topology.Topology(ndims)[source]

topology base class


create refined space by refining dofs in existing one

elem_eval(funcs, ischeme, separate=False, title='evaluating')[source]

element-wise evaluation

elem_mean(funcs, geometry, ischeme, title='computing mean values')[source]

element-wise integration

grid_eval(funcs, geometry, C, title='grid-evaluating')[source]

evaluate grid points


get matrix sparsity

integrate(funcs, ischeme, geometry=None, iweights=None, force_dense=False, title='integrating')[source]
integrate_symm(funcs, ischeme, geometry=None, iweights=None, force_dense=False, title='integrating')[source]

integrate a symmetric integrand on a product domain

projection(fun, onto, geometry, **kwargs)[source]

project and return as function

project(fun, onto, geometry, tol=0, ischeme=None, title='projecting', droptol=1e-08, exact_boundaries=False, constrain=None, verify=None, maxiter=0, ptype='lsqr')[source]

L2 projection of function onto function space

refinedfunc(dofaxis, refine, degree, title='refining')[source]

create refined space by refining dofs in existing one


refine entire topology n times

get_simplices(maxrefine, title='getting simplices')[source]

Getting simplices

get_trimmededges(maxrefine, title='getting trimmededges')[source]

Getting trimmed edges

class nutils.topology.StructuredTopology(structure, periodic=())[source]

structured topology


add periodicity




rectilinear func


refine entire topology

trim(levelset, maxrefine, lscheme='bezier3', finestscheme='uniform2', evalrefine=0, title='trimming', log=<module 'nutils.log' from '/var/build/user_builds/nutils/checkouts/v1.0/nutils/'>)[source]

trim element along levelset

neighbor(elem0, elem1)[source]

Neighbor detection, returns codimension of interface, -1 for non-neighboring elements.

class nutils.topology.IndexedTopology(topo, elements)[source]

trimmed topology


create spline function space

class nutils.topology.UnstructuredTopology(elements, ndims, namedfuncs={})[source]

externally defined topology


spline func


linear func


linear func + bubble

class nutils.topology.HierarchicalTopology(basetopo, elements)[source]

collection of nested topology elments

class nutils.topology.ElemMap(mapping, ndims)[source]

dictionary-like element mapping

nutils.topology.glue(master, slave, geometry, tol=1e-10, verbose=False)[source]

Glue topologies along boundary group __glue__.