public LatticeBhatnagarGrossKrookSimulator(ModelParameters modelParameters, NodeSpace nodeSpace, IEnumerable <Shape> shapes, int iterations, int outputDelay) { ModelParameters = modelParameters; NodeSpace = nodeSpace; MaxIterations = iterations; OutputDelay = outputDelay; Shapes = shapes ?? Enumerable.Empty <Shape>(); _l2Error = 1.0; Initialise(); }
/// <summary> /// Initialize all objects and indexes (re-open, storage is on) /// </summary> private void initialize_storage() { // Initialize Catalog node_space = Storage.GetSpace(DEFX.XML_SPACE_NAME); content_space = Storage.GetSpace(DEFX.XML_CONTENT_SPACE_NAME); if (content_space == null) { content_space = node_space; } // Check for space ownership, set if undefined if (NodeSpace.Owner != DEFX.SYSTEM_OWNER_VSXML) { if (NodeSpace.Owner == DEFS.SYSTEM_OWNER_UNDEFINED) { if (NodeSpace.GetRootID(DEFX.NODE_TYPE_CATALOG) > 0) { Storage.Close(); throw new VXmlException(VXmlException.E0023_NOT_EMPTY_UNDEFINED_SPACE_CODE, ": '" + NodeSpace.Name + "'"); } else { NodeSpace.Owner = DEFX.SYSTEM_OWNER_VSXML; } } else { Storage.Close(); throw new VXmlException(VXmlException.E0022_NOT_VSXML_NODE_SPACE_CODE, ": '" + NodeSpace.Owner + "'"); } } if (content_space.Name != DEFX.SYSTEM_OWNER_VSXML) { if (content_space.Owner != DEFX.SYSTEM_OWNER_VSXML) { if (content_space.Owner == DEFS.SYSTEM_OWNER_UNDEFINED) { if (content_space.GetRootID(DEFX.NODE_TYPE_CONTENT) > 0) { Storage.Close(); throw new VXmlException(VXmlException.E0023_NOT_EMPTY_UNDEFINED_SPACE_CODE, ": '" + content_space.Name + "'"); } else { content_space.Owner = DEFX.SYSTEM_OWNER_VSXML; } } else { Storage.Close(); throw new VXmlException(VXmlException.E0022_NOT_VSXML_NODE_SPACE_CODE, ": '" + content_space.Owner + "'"); } } } // 1.Lookup root catalog node this.OBJ = NodeSpace.GetRootObject(DEFX.NODE_TYPE_CATALOG); if (this.OBJ == null) { // Create root catalog object long sz = DEFX.ROOT_CATALOG_NODE_NAME.Length + 64 + NODE_FIXED_LENGTH; this.OBJ = NodeSpace.Allocate(sz, DEFX.NODE_TYPE_CATALOG, 0, NODE_FIXED_LENGTH); // Create default chunk this.type = DEFX.NODE_TYPE_CATALOG; this.OWNER_ID = this.OBJ.Id; this.FGEN = 0; OBJ.Set(DEFX.F_NAME, DEFX.ROOT_CATALOG_NODE_NAME); } this.type = DEFX.NODE_TYPE_CATALOG; this.root_catalog = this; // INDEXES // Create/Open Checkout index if (node_space.IndexExists(DEFX.INDEX_NAME_CHARGEOUT)) { index_check_out = node_space.GetIndex(DEFX.INDEX_NAME_CHARGEOUT); } else { index_check_out = node_space.CreateIndex(DEFX.INDEX_NAME_CHARGEOUT, true); } // Create/Open Reference index if (node_space.IndexExists(DEFX.INDEX_NAME_REFERENCE)) { index_reference = node_space.GetIndex(DEFX.INDEX_NAME_REFERENCE); } else { index_reference = node_space.CreateIndex(DEFX.INDEX_NAME_REFERENCE, false); } // Create/Open CATALOG index if (node_space.IndexExists(DEFX.INDEX_NAME_CATALOG)) { index_catalog = node_space.GetIndex(DEFX.INDEX_NAME_CATALOG); } else { index_catalog = node_space.CreateIndex(DEFX.INDEX_NAME_CATALOG, false); } // Create/Open DOCUMENT index if (node_space.IndexExists(DEFX.INDEX_NAME_DOCUMENT)) { index_document = node_space.GetIndex(DEFX.INDEX_NAME_DOCUMENT); } else { index_document = node_space.CreateIndex(DEFX.INDEX_NAME_DOCUMENT, false); } state = DEFS.STATE_OPENED; }