Пример #1
0
    def __init__(self, name, geometry, order):
        import sympy as sm

        if geometry.dim < 2:
            raise ValueError(
                'serendipity elements need dimension 2 or 3! (%d)' %
                geometry.dim)
        if order not in self.supported_orders:
            raise ValueError(
                'serendipity elements support only orders %s! (%d)' %
                (self.supported_orders, order))
        PolySpace.__init__(self, name, geometry, order)

        self.nodes, self.nts, self.node_coors = self._define_nodes()
        self.n_nod = self.nodes.shape[0]

        bfs = self.all_bfs[geometry.dim][order]
        self.bfs = bfs[0]
        self.bfgs = bfs[1]

        x, y, z = sm.symbols('x y z')
        vs = [x, y, z][:geometry.dim]

        self._bfs = [sm.lambdify(vs, bf) for bf in self.bfs]
        self._bfgs = [[sm.lambdify(vs, bfg) for bfg in bfgs]
                      for bfgs in self.bfgs]
Пример #2
0
    def __init__(self, name, geometry, order):
        PolySpace.__init__(self, name, geometry, order)

        aux = self._define_nodes()
        self.nodes, self.nts, node_coors, self.face_axes, self.sfnodes = aux
        self.node_coors = nm.ascontiguousarray(node_coors)
        self.n_nod = self.nodes.shape[0]

        aux = nm.where(self.nodes > 0, self.nodes, 1)
        self.node_orders = nm.prod(aux, axis=1)
        self.edge_indx = nm.where(self.nts[:, 0] == 1)[0]
        self.face_indx = nm.where(self.nts[:, 0] == 2)[0]

        self.face_axes_nodes = self._get_face_axes_nodes(self.face_axes)
Пример #3
0
    def __init__(self, name, geometry, order, init_context=True):
        PolySpace.__init__(self, name, geometry, order)

        g1d = Struct(n_vertex = 2,
                     dim = 1,
                     coors = self.bbox[:,0:1].copy())
        self.ps1d = LagrangeSimplexPolySpace('P_aux', g1d, order,
                                             init_context=False)

        self.nodes, self.nts, node_coors = self._define_nodes()
        self.node_coors = nm.ascontiguousarray(node_coors)
        self.n_nod = self.nodes.shape[0]

        if init_context:
            tdim = int(nm.sqrt(geometry.n_vertex))
            self.eval_ctx = self.create_context(None, 0, 1e-15, 100, 1e-8,
                                                tdim=tdim)

        else:
            self.eval_ctx = None
Пример #4
0
    def __init__(self, name, geometry, order, init_context=True):
        PolySpace.__init__(self, name, geometry, order)

        n_v = geometry.n_vertex

        mtx = nm.ones((n_v, n_v), nm.float64)
        mtx[0:n_v-1,:] = nm.transpose(geometry.coors)
        self.mtx_i = nm.ascontiguousarray(nla.inv(mtx))
        self.rhs = nm.ones((n_v,), nm.float64)

        self.nodes, self.nts, node_coors = self._define_nodes()
        self.node_coors = nm.ascontiguousarray(node_coors)
        self.n_nod = self.nodes.shape[0]

        if init_context:
            self.eval_ctx = self.create_context(None, 0, 1e-15, 100, 1e-8,
                                                tdim=n_v - 1)

        else:
            self.eval_ctx = None
Пример #5
0
    def __init__(self, name, geometry, order, extended):
        """

        Parameters
        ----------
        name
        geometry
        order : int
            approximation order, 0 for constant functions, 1 for linear etc.
        extended : bool
            for extended tensor product space
        """
        PolySpace.__init__(self, name, geometry, order)
        self.extended = extended  # only tensor product polyspace is extended
        self.n_v = geometry.n_vertex,
        self.dim = geometry.dim
        self.n_nod = get_n_el_nod(self.order, self.dim, self.extended)

        self.coefM = None
        self.expoM = None
Пример #6
0
    def __init__(self, name, geometry, order):
        PolySpace.__init__(self, name, geometry, order)

        self.nodes, self.nts, self.node_coors = self._define_nodes()
        self.n_nod = self.nodes.shape[0]
        self.eval_ctx = None