# sfepy.discrete.common.dof_info module

Classes holding information on global DOFs and mapping of all DOFs - equations (active DOFs).

Helper functions for the equation mapping.

class sfepy.discrete.common.dof_info.DofInfo(name)

  Global DOF information, i.e. ordering of DOFs of the state (unknown) variables in the global state vector.

  append_raw(name, n_dof)

    Append raw DOFs.

    Parameters:
      name str

        The name of variable the DOFs correspond to.

      n_dof int

        The number of DOFs.

  append_variable(var, active=False, shared=None)

    Append DOFs of the given variable.

    Parameters:
      var Variable instance

        The variable to append.

      active bool, optional

        When True, only active (non-constrained) DOFs are considered.

  get_info(var_name)

    Return information on DOFs of the given variable.

    Parameters:
      var_name str

        The name of the variable.

  get_n_dof_total()

    Return the total number of DOFs of all state variables.

  get_subset_info(var_names)

    Return global DOF information for selected variables only. Silently ignores non-existing variable names.

    Parameters:
      var_names list

        The names of the selected variables.

class sfepy.discrete.common.dof_info.EquationMap(name, dof_names, var_di)

  Map all DOFs to equations for active DOFs.

  get_operator()

    Get the matrix operator R corresponding to the equation mapping, such that the restricted matrix A_r can be obtained from the full matrix A by A_r = R^T A R. All the matrices are w.r.t. a single variables that uses this mapping.

    Returns:
      mtx coo_matrix

        The matrix R.

  map_equations(bcs, field, ts, functions, problem=None, warn=False)

    Create the mapping of active DOFs from/to all DOFs.

    Parameters:
      bcs Conditions instance

        The Dirichlet or periodic boundary conditions (single condition instances). The dof names in the conditions must already be canonized.

      field Field instance

        The field of the variable holding the DOFs.

      ts TimeStepper instance

        The time stepper.

      functions Functions instance

        The registered functions.

      problem Problem instance, optional

        The problem that can be passed to user functions as a context.

      warn bool, optional

        If True, warn about BC on non-existent nodes.

    Returns:
      active_bcs set

        The set of boundary conditions active in the current time.

    Notes

    - Periodic bc: master and slave DOFs must belong to the same field (variables can differ, though).

sfepy.discrete.common.dof_info.expand_nodes_to_dofs(nods, n_dof_per_node)

  Expand DOF node indices into DOFs given a constant number of DOFs per node.

sfepy.discrete.common.dof_info.expand_nodes_to_equations(nods, dof_names, all_dof_names)

  Expand vector of node indices to equations (DOF indices) based on the DOF-per-node count.

  DOF names must be already canonized.

  Returns:
    eq array

      The equations/DOF indices in the node-by-node order.

sfepy.discrete.common.dof_info.group_chains(chain_list)

  Group EPBC chains.

sfepy.discrete.common.dof_info.is_active_bc(bc, ts=None, functions=None)

  Check whether the given boundary condition is active in the current time.

  Returns:
    active bool

      True if the condition bc is active.

sfepy.discrete.common.dof_info.resolve_chains(master_slave, chains)

  Resolve EPBC chains - e.g. in corner nodes.