Esempio n. 1
0
        public static CartesianModel LoadCartesianModel(string modelFile, Mpi mpi = null)
        {
            try
            {
                if (ModelSettingsSerializer.IsModelCommemi(modelFile))
                {
                    var settings = ModelSettingsSerializer.LoadCommemiFromXml(modelFile);
                    return(CreateCommemiModel(settings, mpi));
                }

                if (ModelSettingsSerializer.IsModelCommemi3D3(modelFile))
                {
                    var settings = ModelSettingsSerializer.LoadCommemi3D3FromXml(modelFile);
                    return(CreateCommemi3D3Model(settings, mpi));
                }

                if (ModelSettingsSerializer.IsModelOneBlock(modelFile))
                {
                    var settings = ModelSettingsSerializer.LoadOneBlockFromXml(modelFile);
                    return(CreateOneBlockModel(settings, mpi));
                }

                if (ModelSettingsSerializer.IsModelNaser(modelFile))
                {
                    var settings = ModelSettingsSerializer.LoadNaserFromXml(modelFile);
                    return(CreateNaserModel(settings, mpi));
                }


                return(SerializationManager.DistributedLoadModel(mpi, modelFile));
            }

            catch (Exception e)
            {
                throw new InvalidOperationException($"Can't load model {modelFile}", e);
            }
        }
Esempio n. 2
0
        public static CartesianModel LoadCartesianModelWithoutAnomalyData(string modelFile)
        {
            try
            {
                if (ModelSettingsSerializer.IsModelCommemi(modelFile))
                {
                    var settings = ModelSettingsSerializer.LoadCommemiFromXml(modelFile);
                    return(CreateModelWithoutAnomalyData(settings));
                }

                if (ModelSettingsSerializer.IsModelCommemi3D3(modelFile))
                {
                    var settings = ModelSettingsSerializer.LoadCommemi3D3FromXml(modelFile);
                    return(CreateModelWithoutAnomalyData(settings));
                }

                if (ModelSettingsSerializer.IsModelOneBlock(modelFile))
                {
                    var settings = ModelSettingsSerializer.LoadOneBlockFromXml(modelFile);
                    return(CreateModelWithoutAnomalyData(settings));
                }

                if (ModelSettingsSerializer.IsModelNaser(modelFile))
                {
                    var settings = ModelSettingsSerializer.LoadNaserFromXml(modelFile);
                    return(CreateModelWithoutAnomalyData(settings));
                }


                return(ModelReader.LoadWithoutAnomalyData(modelFile));
            }

            catch (Exception e)
            {
                throw new InvalidOperationException($"Can't load model {modelFile}", e);
            }
        }