SharpFE.LinearTruss.IsASupportedModelType C# (CSharp) Метод

IsASupportedModelType() публичный статический Метод

public static IsASupportedModelType ( ModelType modelType ) : bool
modelType ModelType
Результат bool
        public static bool IsASupportedModelType(ModelType modelType)
        {
            switch(modelType)
            {
                case ModelType.Truss1D:
                case ModelType.Beam1D:
                case ModelType.Truss2D:
                case ModelType.Frame2D:
                case ModelType.Slab2D:
                case ModelType.Membrane2D:
                case ModelType.Truss3D:
                case ModelType.Membrane3D:
                case ModelType.MultiStorey2DSlab:
                case ModelType.Full3D:
                    return true;
                default:
                    throw new NotImplementedException(string.Format(
                        System.Globalization.CultureInfo.InvariantCulture,
                        "LinearTruss.IsSupportedModelType(ModelType) has not been defined for a model type of {0}",
                        modelType));
            }
        }

Usage Example

Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node1"></param>
        /// <param name="node2"></param>
        /// <param name="material"></param>
        /// <param name="crossSection"></param>
        /// <returns></returns>
        public LinearTruss CreateLinearTruss(IFiniteElementNode node1, IFiniteElementNode node2, IMaterial material, ICrossSection crossSection)
        {
            Guard.AgainstInvalidState(() => { return(!LinearTruss.IsASupportedModelType(this.ModelType)); },
                                      "LinearTruss are not available in a model of type {0}",
                                      this.ModelType);

            LinearTruss newTruss = new LinearTruss(node1, node2, material, crossSection);

            if (this.repository != null)
            {
                this.repository.Add(newTruss);
            }

            return(newTruss);
        }