from __future__ import absolute_import
import os.path as op

import numpy as nm

from sfepy import data_dir

from sfepy.base.testing import TestCommon
import six

def init_vec(variables):
    return nm.random.rand(variables.di.ptr[-1])

def check_vec(self, vec, ii, ok, conds, variables):
    from sfepy.discrete.common.dof_info import expand_nodes_to_equations

    for var_name, var_conds in six.iteritems(conds.group_by_variables()):
        var = variables[var_name]
        for cond in var_conds:
            cond.canonize_dof_names(var.dofs)
            self.report('%d: %s %s: %s %s'
                        % (ii, var.name,
                           cond.name, cond.region.name, cond.dofs[0]))
            nods = var.field.get_dofs_in_region(cond.region)
            eq = 
expand_nodes_to_equations(nods, cond.dofs[0], var.dofs)