Package cc.redberry.core.context

Examples of cc.redberry.core.context.NameDescriptorForTensorField


    }

    @Override
    Tensor newTo_(Tensor currentNode, SubstitutionIterator iterator) {
        TensorField currentField = (TensorField) currentNode;
        NameDescriptorForTensorField currentDescriptor = currentField.getNameDescriptor();

        //different tensors
        if (currentDescriptor.getParent().getId() != fromDescriptor.getParent().getId())
            return currentNode;

        //check whether derivative orders in from less or equal to orders of current node
        for (int i = currentNode.size() - 1; i >= 0; --i)
            if (currentDescriptor.getDerivativeOrder(i) < fromDescriptor.getDerivativeOrder(i))
                return currentNode;

        IntArray orders = new IntArray(currentDescriptor.getDerivativeOrders());
        DFromTo derivative = derivatives.get(orders);
        if (derivative == null) {
            int order, j;
            SimpleTensor var;
            int[] indices;
View Full Code Here


     *
     * @return partition of derivative indices
     */
    public SimpleIndices[][] calcIndicesPartition() {

        NameDescriptorForTensorField fieldDescriptor = getNameDescriptor();
        if (!fieldDescriptor.isDerivative()) {
            SimpleIndices[][] ret = new SimpleIndices[args.length + 1][];
            Arrays.fill(ret, 1, ret.length, new SimpleIndices[0]);
            ret[0] = new SimpleIndices[]{indices};
            return ret;
        }

        int[] orders = fieldDescriptor.getDerivativeOrders();

        int[][] _mapping = fieldDescriptor.getIndicesPartitionMapping();

        SimpleIndices[][] iPartition = new SimpleIndices[args.length + 1][];

        SimpleIndicesBuilder ib;
        int totalOrder = 0;
View Full Code Here

        if (!derivativeIndices.getStructureOfIndices().equals(parent.argIndices[argPosition].getInverted().getStructureOfIndices().pow(order)))
            throw new IllegalArgumentException("Illegal derivative indices.");

        int[] orders = new int[parent.size()];
        orders[argPosition] = order;
        NameDescriptorForTensorField fieldDescriptor = parent.getNameDescriptor();
        NameDescriptor derivativeDescriptor = fieldDescriptor.getDerivative(orders);

        SimpleIndices totalIndices;

        if (!fieldDescriptor.isDerivative() || derivativeIndices.size() == 0 || parent.indices.size() == 0) {
            totalIndices = new SimpleIndicesBuilder().append(parent.getIndices()).append(derivativeIndices).getIndices();
        } else {
            orders = fieldDescriptor.getDerivativeOrders();

            SimpleIndicesBuilder ib = new SimpleIndicesBuilder();
            StructureOfIndices[] structures = fieldDescriptor.getStructuresOfIndices();
            int i, from;
            SimpleIndices singleType;
            IndexType eType;
            for (byte type = IndexType.TYPES_COUNT - 1; type >= 0; --type) {
                eType = IndexType.values()[type];
                singleType = parent.getIndices().getOfType(eType);
                from = fieldDescriptor.getParent().getStructureOfIndices().getTypeData(type).length;
                for (i = 0; i <= argPosition; ++i)
                    from += structures[i + 1].getTypeData(type).length * orders[i];
                for (i = 0; i < from; ++i)
                    ib.append(singleType.get(i));
                ib.append(derivativeIndices.getOfType(eType));
View Full Code Here

                    structureOfIndices = structureOfIndices.subtract(structures[i + 1]);
            }

            structures[0] = structureOfIndices;

            NameDescriptorForTensorField fieldDescriptor =
                    (NameDescriptorForTensorField) CC.getNameManager().mapNameDescriptor(name, structures);

            NameDescriptor derivativeDescriptor = fieldDescriptor.getDerivative(orders);

            return new TensorField(derivativeDescriptor.getId(),
                    UnsafeIndicesFactory.createOfTensor(derivativeDescriptor.getSymmetries(), indices),
                    arguments, argIndices);
        } catch (RuntimeException re) {
View Full Code Here

    }

    @Override
    Tensor newTo_(Tensor currentNode, SubstitutionIterator iterator) {
        TensorField currentField = (TensorField) currentNode;
        NameDescriptorForTensorField currentDescriptor = currentField.getNameDescriptor();

        //different tensors
        if (currentDescriptor.getParent().getId() != fromDescriptor.getParent().getId())
            return currentNode;

        //check whether derivative orders in from less or equal to orders of current node
        for (int i = currentNode.size() - 1; i >= 0; --i)
            if (currentDescriptor.getDerivativeOrder(i) < fromDescriptor.getDerivativeOrder(i))
                return currentNode;

        IntArray orders = new IntArray(currentDescriptor.getDerivativeOrders());
        DFromTo derivative = derivatives.get(orders);
        if (derivative == null) {
            int order, j;
            SimpleTensor var;
            int[] indices;
View Full Code Here

        if (!derivativeIndices.getStructureOfIndices().equals(parent.argIndices[argPosition].getInverted().getStructureOfIndices().pow(order)))
            throw new IllegalArgumentException("Illegal derivative indices.");

        int[] orders = new int[parent.size()];
        orders[argPosition] = order;
        NameDescriptorForTensorField fieldDescriptor = parent.getNameDescriptor();
        NameDescriptor derivativeDescriptor = fieldDescriptor.getDerivative(orders);

        SimpleIndices totalIndices;

        if (!fieldDescriptor.isDerivative() || derivativeIndices.size() == 0 || parent.indices.size() == 0) {
            totalIndices = new SimpleIndicesBuilder().append(parent.getIndices()).append(derivativeIndices).getIndices();
        } else {
            orders = fieldDescriptor.getDerivativeOrders();

            SimpleIndicesBuilder ib = new SimpleIndicesBuilder();
            StructureOfIndices[] structures = fieldDescriptor.getStructuresOfIndices();
            int i, from;
            SimpleIndices singleType;
            IndexType eType;
            for (byte type = IndexType.TYPES_COUNT - 1; type >= 0; --type) {
                eType = IndexType.values()[type];
                singleType = parent.getIndices().getOfType(eType);
                from = fieldDescriptor.getParent().getStructureOfIndices().getTypeData(type).length;
                for (i = 0; i <= argPosition; ++i)
                    from += structures[i + 1].getTypeData(type).length * orders[i];
                for (i = 0; i < from; ++i)
                    ib.append(singleType.get(i));
                ib.append(derivativeIndices.getOfType(eType));
View Full Code Here

                    structureOfIndices = structureOfIndices.subtract(structures[i + 1]);
            }

            structures[0] = structureOfIndices;

            NameDescriptorForTensorField fieldDescriptor =
                    (NameDescriptorForTensorField) CC.getNameManager().mapNameDescriptor(name, structures);

            NameDescriptor derivativeDescriptor = fieldDescriptor.getDerivative(orders);

            return new TensorField(derivativeDescriptor.getId(),
                    UnsafeIndicesFactory.createOfTensor(derivativeDescriptor.getSymmetries(), indices),
                    arguments, argIndices);
        } catch (RuntimeException re) {
View Full Code Here

     *
     * @return partition of derivative indices
     */
    public SimpleIndices[][] getPartitionOfIndices() {

        NameDescriptorForTensorField fieldDescriptor = getNameDescriptor();
        if (!fieldDescriptor.isDerivative()) {
            SimpleIndices[][] ret = new SimpleIndices[args.length + 1][];
            Arrays.fill(ret, 1, ret.length, new SimpleIndices[0]);
            ret[0] = new SimpleIndices[]{indices};
            return ret;
        }

        int[] orders = fieldDescriptor.getDerivativeOrders();

        int[][] _mapping = fieldDescriptor.getIndicesPartitionMapping();

        SimpleIndices[][] iPartition = new SimpleIndices[args.length + 1][];

        SimpleIndicesBuilder ib;
        int totalOrder = 0;
View Full Code Here

        if (!derivativeIndices.getStructureOfIndices().equals(parent.argIndices[argPosition].getInverted().getStructureOfIndices().pow(order)))
            throw new IllegalArgumentException("Illegal derivative indices.");

        int[] orders = new int[parent.size()];
        orders[argPosition] = order;
        NameDescriptorForTensorField fieldDescriptor = parent.getNameDescriptor();
        NameDescriptor derivativeDescriptor = fieldDescriptor.getDerivative(orders);

        SimpleIndices totalIndices;

        if (!fieldDescriptor.isDerivative() || derivativeIndices.size() == 0 || parent.indices.size() == 0) {
            totalIndices = new SimpleIndicesBuilder().append(parent.getIndices()).append(derivativeIndices).getIndices();
        } else {
            orders = fieldDescriptor.getDerivativeOrders();

            SimpleIndicesBuilder ib = new SimpleIndicesBuilder();
            StructureOfIndices[] structures = fieldDescriptor.getStructuresOfIndices();
            int i, from;
            SimpleIndices singleType;
            IndexType eType;
            for (byte type = IndexType.TYPES_COUNT - 1; type >= 0; --type) {
                eType = IndexType.values()[type];
                singleType = parent.getIndices().getOfType(eType);
                from = fieldDescriptor.getParent().getStructureOfIndices().getTypeData(type).length;
                for (i = 0; i <= argPosition; ++i)
                    from += structures[i + 1].getTypeData(type).length * orders[i];
                for (i = 0; i < from; ++i)
                    ib.append(singleType.get(i));
                ib.append(derivativeIndices.getOfType(eType));
View Full Code Here

                    structureOfIndices = structureOfIndices.subtract(structures[i + 1]);
            }

            structures[0] = structureOfIndices;

            NameDescriptorForTensorField fieldDescriptor =
                    (NameDescriptorForTensorField) CC.getNameManager().mapNameDescriptor(name, structures);

            NameDescriptor derivativeDescriptor = fieldDescriptor.getDerivative(orders);

            return new TensorField(derivativeDescriptor.getId(),
                    UnsafeIndicesFactory.createOfTensor(derivativeDescriptor.getSymmetries(), indices),
                    arguments, argIndices);
        } catch (RuntimeException re) {
View Full Code Here

TOP

Related Classes of cc.redberry.core.context.NameDescriptorForTensorField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.