pymor.bindings.ngsolve

Module Contents

Classes

NGSolveVectorCommon

NGSolveVector

Wraps a NGSolve BaseVector to make it usable with ListVectorArray.

ComplexifiedNGSolveVector

Interface for vectors used in conjunction with ListVectorArray.

NGSolveVectorSpace

VectorSpace of ListVectorArrays.

NGSolveMatrixOperator

Wraps a NGSolve matrix as an Operator.

NGSolveVisualizer

Visualize an NGSolve grid function.

class pymor.bindings.ngsolve.NGSolveVectorCommon[source]
amax(self)[source]
dofs(self, dof_indices)[source]
class pymor.bindings.ngsolve.NGSolveVector(impl)[source]

Bases: NGSolveVectorCommon, pymor.vectorarrays.list.CopyOnWriteVector

Wraps a NGSolve BaseVector to make it usable with ListVectorArray.

classmethod from_instance(cls, instance)[source]
_copy_data(self)[source]
to_numpy(self, ensure_copy=False)[source]
_scal(self, alpha)[source]
_axpy(self, alpha, x)[source]
inner(self, other)[source]
norm(self)[source]
norm2(self)[source]
class pymor.bindings.ngsolve.ComplexifiedNGSolveVector(real_part, imag_part)[source]

Bases: NGSolveVectorCommon, pymor.vectorarrays.list.ComplexifiedVector

Interface for vectors used in conjunction with ListVectorArray.

This interface must be satisfied by the individual entries of the vector list managed by ListVectorArray. All interface methods have a direct counterpart in the VectorArray interface.

class pymor.bindings.ngsolve.NGSolveVectorSpace(V, id='STATE')[source]

Bases: pymor.vectorarrays.list.ComplexifiedListVectorSpace

VectorSpace of ListVectorArrays.

real_vector_type[source]
vector_type[source]
__eq__(self, other)[source]

Return self==value.

__hash__(self)[source]

Return hash(self).

property value_dim(self)[source]
property dim(self)[source]
classmethod space_from_vector_obj(cls, vec, id)[source]
real_zero_vector(self)[source]
real_make_vector(self, obj)[source]
real_vector_from_numpy(self, data, ensure_copy=False)[source]
class pymor.bindings.ngsolve.NGSolveMatrixOperator(matrix, range, source, solver_options=None, name=None)[source]

Bases: pymor.operators.list.LinearComplexifiedListVectorArrayOperatorBase

Wraps a NGSolve matrix as an Operator.

_prepare_apply(self, U, mu, kind, least_squares=False, default_solver='')[source]
_real_apply_one_vector(self, u, mu=None, prepare_data=None)[source]
_real_apply_adjoint_one_vector(self, v, mu=None, prepare_data=None)[source]
_real_apply_inverse_one_vector(self, v, mu=None, initial_guess=None, least_squares=False, prepare_data=None)[source]
_assemble_lincomb(self, operators, coefficients, identity_shift=0.0, solver_options=None, name=None)[source]

Try to assemble a linear combination of the given operators.

Returns a new Operator which represents the sum

c_1*O_1 + ... + c_N*O_N + s*I

where O_i are Operators, c_i, s scalar coefficients and I the identity.

This method is called in the assemble method of LincombOperator on the first of its operators. If an assembly of the given linear combination is possible, e.g. the linear combination of the system matrices of the operators can be formed, then the assembled operator is returned. Otherwise, the method returns None to indicate that assembly is not possible.

Parameters

operators

List of Operators O_i whose linear combination is formed.

coefficients

List of the corresponding linear coefficients c_i.

identity_shift

The coefficient s.

solver_options

solver_options for the assembled operator.

name

Name of the assembled operator.

Returns

The assembled Operator if assembly is possible, otherwise None.

as_vector(self, copy=True)[source]

Return a vector representation of a linear functional or vector operator.

Depending on the operator’s source and range, this method is equivalent to calling as_range_array or as_source_array respectively. The resulting VectorArray is required to have length 1.

Parameters

mu

The parameter values for which to return the vector representation.

Returns

V

VectorArray of length 1 containing the vector representation.

class pymor.bindings.ngsolve.NGSolveVisualizer(mesh, fespace)[source]

Bases: pymor.core.base.ImmutableObject

Visualize an NGSolve grid function.

visualize(self, U, legend=None, separate_colorbars=True, filename=None, block=True)[source]

Visualize the provided data.