Beispiel #1
0
        public static void PopulateAnomaly(string path, CartesianAnomaly anomaly)
        {
            anomaly.CreateSigma();
            var sigma = anomaly.Sigma;

            for (int k = 0; k < anomaly.Layers.Count; k++)
            {
                var layer  = anomaly.Layers[k];
                var xlayer = layer.UnderlyingXml;

                var depth     = xlayer.AttributeAsDecimal(AnomalyLayerDepthAttr);
                var thickness = xlayer.AttributeAsDecimal(AnomalyLayerThicknessAttr);

                if (layer.Depth != depth)
                {
                    throw new InvalidOperationException();
                }
                if (layer.Thickness != thickness)
                {
                    throw new InvalidOperationException();
                }

                var xfromFile = xlayer.Element(AnomalyFromFile);
                if (xfromFile != null)
                {
                    LoadAnomalyValuesFromFile(xfromFile, sigma, k, path);
                }

                var xapplique = xlayer.Element(AnomalyApplique);
                if (xapplique != null)
                {
                    LoadAnomalyValuesFromApplique(xapplique, sigma, k);
                }
            }
        }
Beispiel #2
0
        public static OmegaAnomaly CreateFromCartesianAnomaly(double omega, CartesianAnomaly ca, double[,,] sigma)
        {
            var zeta   = OmegaModelUtils.ConvertSigmaToZeta(omega, sigma);
            var layers = ca.Layers.Select(l => (IAnomalyLayer)l).ToList();

            return(new OmegaAnomaly(zeta, ca.LocalSize, layers));
        }
Beispiel #3
0
        private static void UpdateAnomalyLocalSize(Mpi mpi, CartesianAnomaly anomaly)
        {
            var localSize = new Size2D(mpi.CalcLocalHalfNxLength(anomaly.LocalSize.Nx), anomaly.LocalSize.Ny);

            anomaly.ChangeLocalSize(localSize);
            anomaly.CreateSigma();
        }
Beispiel #4
0
        public CartesianModel(LateralDimensions lateral, CartesianSection1D section1D, CartesianAnomaly anomaly)
        {
            if (section1D.NumberOfLayers == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(section1D));
            }

            LateralDimensions = lateral;
            Section1D         = section1D;
            Anomaly           = anomaly;
        }
Beispiel #5
0
        private static string[] SaveAnomalyLayersToPlainText(string path, CartesianAnomaly cartesianAnomaly)
        {
            var fileNames = new string[cartesianAnomaly.Layers.Count];

            for (int k = 0; k < fileNames.Length; k++)
            {
                fileNames[k] = $"anomaly_layer_{k:0000}.dat";
                AnomalyLoaderUtils.WriteAnomalyDataToPlainText(cartesianAnomaly.Sigma, k, Path.Combine(path, fileNames[k]));
            }

            return(fileNames);
        }
Beispiel #6
0
        private static void SaveAnomalies(XElement xmodel, CartesianAnomaly cartesianAnomaly, string[] fileNames)
        {
            var layers = cartesianAnomaly.Layers;

            var xlayers = new List <XElement>();

            if (fileNames != null)
            {
                for (int i = 0; i < layers.Count; i++)
                {
                    xlayers.Add(ToXElement(layers[i], fileNames[i]));
                }
            }
            else
            {
                xlayers.AddRange(layers.Select(l => ToXElement(l, null)));
            }

            xmodel.Add(new XElement(AnomalySection, xlayers));
        }