/// <summary> /// Initializes a new instance of the <see cref="NodalDegreeOfFreedom" /> struct. /// </summary> /// <param name="node">The node to which the degree of freedom relates</param> /// <param name="degreeOfFreedom">The degree of freedom of the node</param> /// <exception cref="ArgumentNullException">node parameter cannot be null</exception> public NodalDegreeOfFreedom(IFiniteElementNode node, DegreeOfFreedom degreeOfFreedom) { Guard.AgainstNullArgument(node, "node"); this.targetNode = node; this.dof = degreeOfFreedom; }
/// <summary> /// Constrains a node in a given degree of freedom. /// </summary> /// <param name="node">The node to constrain</param> /// <param name="degreeOfFreedomToConstrain">the degree of freedom in which to constrain the node.</param> public void ConstrainNode(IFiniteElementNode node, DegreeOfFreedom degreeOfFreedomToConstrain) { if (!this.ModelType.IsAllowedDegreeOfFreedomForBoundaryConditions(degreeOfFreedomToConstrain)) { throw new ArgumentException("Cannot constrain this degree of freedom in this model type"); } this.nodes.ConstrainNode(node, degreeOfFreedomToConstrain); }
/// <summary> /// Gets the exact stiffness value for a given node and degree of freedom combinations. /// </summary> /// <param name="rowNode">The node defining the row (force equations)</param> /// <param name="rowDegreeOfFreedom">The degree of freedom defining the row (force equations)</param> /// <param name="columnNode">The node defining the column (displacement equations)</param> /// <param name="columnDegreeOfFreedom">the degree of freedom defining the column (displacement equations)</param> /// <returns>A value representing the stiffness at the given locations</returns> /// <exception cref="ArgumentException">Thrown if either of the nodes is not part of this element, or either of the degrees of freedom are not supported by this element.</exception> public double GetStiffnessInGlobalCoordinatesAt(IFiniteElementNode rowNode, DegreeOfFreedom rowDegreeOfFreedom, IFiniteElementNode columnNode, DegreeOfFreedom columnDegreeOfFreedom) { Guard.AgainstNullArgument(rowNode, "rowNode"); Guard.AgainstNullArgument(columnNode, "columnNode"); try { return(this.StiffnessMatrixInGlobalCoordinates.At(rowNode, rowDegreeOfFreedom, columnNode, columnDegreeOfFreedom)); } catch (System.Collections.Generic.KeyNotFoundException) { return(0.0); } }
/// <summary> /// Builds the rotational matrix from local coordinates to global coordinates. /// </summary> /// <returns></returns> protected KeyedSquareMatrix <NodalDegreeOfFreedom> BuildStiffnessRotationMatrixFromLocalToGlobalCoordinates() { KeyedSquareMatrix <DegreeOfFreedom> rotationMatrix = this.Element.CalculateElementRotationMatrix(); KeyedSquareMatrix <NodalDegreeOfFreedom> elementRotationMatrixFromLocalToGlobalCoordinates = new KeyedSquareMatrix <NodalDegreeOfFreedom>(this.Element.SupportedGlobalNodalDegreeOfFreedoms); foreach (IFiniteElementNode node in this.Element.Nodes) { foreach (DegreeOfFreedom dofi in this.Element.SupportedGlobalBoundaryConditionDegreeOfFreedom) { foreach (DegreeOfFreedom dofj in this.Element.SupportedGlobalBoundaryConditionDegreeOfFreedom) { if (!((dofi.IsLinear() && dofj.IsLinear()) || (dofi.IsRotational() && dofj.IsRotational()))) { continue; } //HACK it is used to copy the keyed matrix [x] into a larger keyed matrix of: //[x 0, // 0 x] DegreeOfFreedom i = dofi; DegreeOfFreedom j = dofj; if (dofi.IsRotational() && dofj.IsRotational()) { // shift from rotational to linear i = (DegreeOfFreedom)((int)dofi - 3); j = (DegreeOfFreedom)((int)dofj - 3); } double valueToBeCopied = rotationMatrix.At(i, j); elementRotationMatrixFromLocalToGlobalCoordinates.At(new NodalDegreeOfFreedom(node, dofi), new NodalDegreeOfFreedom(node, dofj), valueToBeCopied); } } } return(elementRotationMatrixFromLocalToGlobalCoordinates); }
/// <summary> /// Indicates whether a degree of freedom is allowed for the creation of boundary conditions by this model type. /// </summary> /// <param name="modelType">The <see cref="ModelType" /> which dictates the allowable degrees of freedom.</param> /// <param name="candidate">The degree of freedom to check as to whether it is allowed.</param> /// <returns>true if the degree of freedom is allowed for the creation of boundary conditions for this model type.</returns> public static bool IsAllowedDegreeOfFreedomForBoundaryConditions(this ModelType modelType, DegreeOfFreedom candidate) { IList <DegreeOfFreedom> allowedDOF = modelType.GetAllowedDegreesOfFreedomForBoundaryConditions(); return(allowedDOF.Contains(candidate)); }
/// <summary> /// Sets the value of the element at the given location /// </summary> /// <param name="nodeComponentOfRowKey">the node which in part defines the row of the element</param> /// <param name="degreeOfFreedomComponentOfRowKey">the degree of freedom which in part defines the row of the element</param> /// <param name="nodeComponentOfColumnKey">the node which in part defines the column of the element</param> /// <param name="degreeOfFreedomComponentOfColumnKey">the degree of freedom which in part defines the column of the element</param> /// <param name="value">The value with which to set the value of the element</param> public void At(IFiniteElementNode nodeComponentOfRowKey, DegreeOfFreedom degreeOfFreedomComponentOfRowKey, IFiniteElementNode nodeComponentOfColumnKey, DegreeOfFreedom degreeOfFreedomComponentOfColumnKey, double value) { this.At(new NodalDegreeOfFreedom(nodeComponentOfRowKey, degreeOfFreedomComponentOfRowKey), new NodalDegreeOfFreedom(nodeComponentOfColumnKey, degreeOfFreedomComponentOfColumnKey), value); }
/// <summary> /// Retrieves the requested element from the matrix /// </summary> /// <param name="nodeComponentOfRowKey">the node which in part defines the row of the element</param> /// <param name="degreeOfFreedomComponentOfRowKey">the degree of freedom which in part defines the row of the element</param> /// <param name="nodeComponentOfColumnKey">the node which in part defines the column of the element</param> /// <param name="degreeOfFreedomComponentOfColumnKey">the degree of freedom which in part defines the column of the element</param> /// <returns>The requested element</returns> public double At(IFiniteElementNode nodeComponentOfRowKey, DegreeOfFreedom degreeOfFreedomComponentOfRowKey, IFiniteElementNode nodeComponentOfColumnKey, DegreeOfFreedom degreeOfFreedomComponentOfColumnKey) { return(this.At(new NodalDegreeOfFreedom(nodeComponentOfRowKey, degreeOfFreedomComponentOfRowKey), new NodalDegreeOfFreedom(nodeComponentOfColumnKey, degreeOfFreedomComponentOfColumnKey))); }
/// <summary> /// Indicates whether a degree of freedom is allowed for the creation of geometry by this model type. /// </summary> /// <param name="modelType">The <see cref="ModelType" /> which dictates the allowable degrees of freedom.</param> /// <param name="candidate">The degree of freedom to check as to whether it is allowed.</param> /// <returns>true if the degree of freedom is allowed for the creation of geometry for this model type.</returns> public static bool IsAllowedDegreeOfFreedomForGeometry(this ModelType modelType, DegreeOfFreedom candidate) { IList<DegreeOfFreedom> allowedDOF = modelType.GetAllowedDegreesOfFreedomForGeometry(); return allowedDOF.Contains(candidate); }
/// <summary> /// Frees a node in a given degree of freedom. /// </summary> /// <param name="node">The node to free</param> /// <param name="degreeOfFreedomToFree">the degree of freedom in which to free the node</param> public void UnconstrainNode(IFiniteElementNode node, DegreeOfFreedom degreeOfFreedomToFree) { NodalDegreeOfFreedom nodalDegreeOfFreedomToFree = new NodalDegreeOfFreedom(node, degreeOfFreedomToFree); this.UnconstrainNode(nodalDegreeOfFreedomToFree); }
/// <summary> /// Constrains a node in a given degree of freedom. /// </summary> /// <param name="node">The node to constrain</param> /// <param name="degreeOfFreedomToConstrain">the degree of freedom in which to constrain the node.</param> public void ConstrainNode(IFiniteElementNode node, DegreeOfFreedom degreeOfFreedomToConstrain) { NodalDegreeOfFreedom nodalDegreeOfFreedomToConstrain = new NodalDegreeOfFreedom(node, degreeOfFreedomToConstrain); this.ConstrainNode(nodalDegreeOfFreedomToConstrain); }
public static bool IsLinear(this DegreeOfFreedom dof) { return((int)dof < 3); }
/// <summary> /// Determines whether a node is constrained in the given degree of freedom /// </summary> /// <param name="nodeToCheck">the node to check whether it is constrain in a particular degree of freedom</param> /// <param name="degreeOfFreedomToCheck">The particular degree of freedom of the node to check for constraint</param> /// <returns>True if this particular node and degree of freedom are constrained; otherwise, false.</returns> public bool IsConstrained(IFiniteElementNode nodeToCheck, DegreeOfFreedom degreeOfFreedomToCheck) { return(this.nodes.IsConstrained(nodeToCheck, degreeOfFreedomToCheck)); }
public void UnconstrainNode(IFiniteElementNode node, DegreeOfFreedom degreeOfFreedomToFree) { this.nodes.UnconstrainNode(node, degreeOfFreedomToFree); }
/// <summary> /// Determines whether a degree of freedom is supported by this element /// </summary> /// <param name="degreeOfFreedom"></param> /// <returns></returns> public bool IsASupportedBoundaryConditionDegreeOfFreedom(DegreeOfFreedom degreeOfFreedom) { return(this.SupportedLocalBoundaryConditionDegreeOfFreedom.Contains(degreeOfFreedom)); }
public DegreeOfFreedom GetStrategyBAndBridgeTo(DegreeOfFreedom next = null) { _strategyB.Next = next; return(_strategyB); }
public DegreeOfFreedom GetStrategyAAndBridgeTo(DegreeOfFreedom next) { _strategyA.Next = next; return(_strategyA); }
/// <summary> /// Determines whether a node is constrained in the given degree of freedom /// </summary> /// <param name="nodeToCheck">the node to check whether it is constrain in a particular degree of freedom</param> /// <param name="degreeOfFreedomToCheck">The particular degree of freedom of the node to check for constraint</param> /// <returns>True if this particular node and degree of freedom are constrained; otherwise, false.</returns> public bool IsConstrained(IFiniteElementNode nodeToCheck, DegreeOfFreedom degreeOfFreedomToCheck) { NodalDegreeOfFreedom nodeDof = new NodalDegreeOfFreedom(nodeToCheck, degreeOfFreedomToCheck); return(this.IsConstrained(nodeDof)); }
public static bool IsRotational(this DegreeOfFreedom dof) { return(!dof.IsLinear()); }