Sequence seq = (Sequence) seqdd.refersTo; int[] shape = new int[]{ndatasets, count}; // seems unlikely this can handle recursion ama = ArrayStructureMA.factoryMA(seq, shape); setIterators(ama);
Sequence seq = (Sequence) seqdd.refersTo; int[] shape = new int[]{ndatasets, count}; // seems unlikely this can handle recursion ama = ArrayStructureMA.factoryMA(seq, shape); setIterators(ama);
/** * Read all datasets from a single message * @param s outer variables * @param proto prototype message, has been processed * @param m read this message * @param raf from this file * @param f output bit count debugging info (may be null) * @return ArrayStructure with all the data from the message in it. * @throws IOException on read error */ public ArrayStructure readEntireMessage(Structure s, Message proto, Message m, RandomAccessFile raf, Formatter f) throws IOException { // transfer info (refersTo, name) from the proto message DataDescriptor.transferInfo(proto.getRootDataDescriptor().getSubKeys(), m.getRootDataDescriptor().getSubKeys()); // allocate ArrayStructureMA for outer structure int n = m.getNumberDatasets(); ArrayStructureMA ama = ArrayStructureMA.factoryMA(s, new int[] {n}); setIterators(ama); // map dkey to Member recursively HashMap<DataDescriptor, StructureMembers.Member> map = new HashMap<>(100); associateMessage2Members(ama.getStructureMembers(), m.getRootDataDescriptor(), map); readData(m, raf, f, new Request(ama, map, null)); return ama; }
/** * Read all datasets from a single message * @param s outer variables * @param proto prototype message, has been processed * @param m read this message * @param raf from this file * @param f output bit count debugging info (may be null) * @return ArrayStructure with all the data from the message in it. * @throws IOException on read error */ public ArrayStructure readEntireMessage(Structure s, Message proto, Message m, RandomAccessFile raf, Formatter f) throws IOException { // transfer info (refersTo, name) from the proto message DataDescriptor.transferInfo(proto.getRootDataDescriptor().getSubKeys(), m.getRootDataDescriptor().getSubKeys()); // allocate ArrayStructureMA for outer structure int n = m.getNumberDatasets(); ArrayStructureMA ama = ArrayStructureMA.factoryMA(s, new int[] {n}); setIterators(ama); // map dkey to Member recursively HashMap<DataDescriptor, StructureMembers.Member> map = new HashMap<DataDescriptor, StructureMembers.Member>(100); associateMessage2Members(ama.getStructureMembers(), m.getRootDataDescriptor(), map); readData(m, raf, f, new Request(ama, map, null)); return ama; }
/** * Create an ArrayStructure for a Structure. Allow nested Structures. * Create the data arrays, and an iterator. * * @param from copy from here. If from is a ArrayStructureMA, return it. * @param shape the shape of the ArrayStructure * @return equivilent ArrayStructureMA * @throws java.io.IOException on error reading a sequence */ static public ArrayStructureMA factoryMA(Structure from, int[] shape) throws IOException { StructureMembers sm = from.makeStructureMembers(); for (Variable v : from.getVariables()) { Array data; if (v instanceof Sequence) { data = new ArrayObject(ArraySequence.class, shape); // an array sequence - one for each parent element //Structure s = (Structure) v; //StructureMembers smn = s.makeStructureMembers(); // data = new ArraySequenceNested(smn, (int) Index.computeSize(v.getShapeAll())); // ?? } else if (v instanceof Structure) data = ArrayStructureMA.factoryMA((Structure) v, combine(shape, v.getShape())); else data = Array.factory(v.getDataType(), combine(shape, v.getShape())); StructureMembers.Member m = sm.findMember(v.getShortName()); m.setDataArray(data); } return new ArrayStructureMA(sm, shape); }
/** * Create an ArrayStructure for a Structure. Allow nested Structures. * Create the data arrays, and an iterator. * * @param from copy from here. If from is a ArrayStructureMA, return it. * @param shape the shape of the ArrayStructure * @return equivilent ArrayStructureMA * @throws java.io.IOException on error reading a sequence */ static public ArrayStructureMA factoryMA(Structure from, int[] shape) throws IOException { StructureMembers sm = from.makeStructureMembers(); for (Variable v : from.getVariables()) { Array data; if (v instanceof Sequence) { data = new ArrayObject(ArraySequence.class, shape); // an array sequence - one for each parent element //Structure s = (Structure) v; //StructureMembers smn = s.makeStructureMembers(); // data = new ArraySequenceNested(smn, (int) Index.computeSize(v.getShapeAll())); // ?? } else if (v instanceof Structure) data = ArrayStructureMA.factoryMA((Structure) v, combine(shape, v.getShape())); else data = Array.factory(v.getDataType(), combine(shape, v.getShape())); StructureMembers.Member m = sm.findMember(v.getShortName()); m.setDataArray(data); } return new ArrayStructureMA(sm, shape); }
/** * Create an ArrayStructure for a Structure. Allow nested Structures. * Create the data arrays, and an iterator. * * @param from copy from here. If from is a ArrayStructureMA, return it. * @param shape the shape of the ArrayStructure * @return equivilent ArrayStructureMA * @throws java.io.IOException on error reading a sequence */ static public ArrayStructureMA factoryMA(Structure from, int[] shape) throws IOException { StructureMembers sm = from.makeStructureMembers(); for (Variable v : from.getVariables()) { Array data; if (v instanceof Sequence) { data = Array.factory(DataType.SEQUENCE, shape); // an array sequence - one for each parent element //Structure s = (Structure) v; //StructureMembers smn = s.makeStructureMembers(); // data = new ArraySequenceNested(smn, (int) Index.computeSize(v.getShapeAll())); // ?? } else if (v instanceof Structure) data = ArrayStructureMA.factoryMA((Structure) v, combine(shape, v.getShape())); else data = Array.factory(v.getDataType(), combine(shape, v.getShape())); StructureMembers.Member m = sm.findMember(v.getShortName()); m.setDataArray(data); } return new ArrayStructureMA(sm, shape); }
ArrayStructure newAS = ArrayStructureMA.factoryMA(orgAS); for (StructureMembers.Member m : newAS.getMembers()) { VariableEnhanced v2 = (VariableEnhanced) findVariable(m.getName());
ArrayStructure newAS = ArrayStructureMA.factoryMA(orgAS); for (StructureMembers.Member m : newAS.getMembers()) { VariableEnhanced v2 = (VariableEnhanced) findVariable(m.getName());
ArrayStructure newAS = ArrayStructureMA.factoryMA(orgAS); for (StructureMembers.Member m : newAS.getMembers()) { VariableEnhanced v2 = (VariableEnhanced) findVariable(m.getName());