SharpFE.Linear1DBeam.IsASupportedModelType C# (CSharp) Method

IsASupportedModelType() public static method

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

Usage Example

示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="material"></param>
        /// <param name="crossSection"></param>
        /// <returns></returns>
        public Linear1DBeam CreateLinear1DBeam(IFiniteElementNode start, IFiniteElementNode end, IMaterial material, ICrossSection crossSection)
        {
            Guard.AgainstInvalidState(() => { return(!Linear1DBeam.IsASupportedModelType(this.ModelType)); },
                                      "Linear1DBeams are not available in a model of type {0}",
                                      this.ModelType);

            Linear1DBeam newBeam = new Linear1DBeam(start, end, material, crossSection);

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

            return(newBeam);
        }