public void AreEqualIfPropertiesAreEqual()
        {
            NodeFactory factory = new NodeFactory(ModelType.Truss1D);
            FiniteElementNode node1 = factory.Create(0);
            NodalDegreeOfFreedom SUT = new NodalDegreeOfFreedom(node1, DegreeOfFreedom.X);
            NodalDegreeOfFreedom equalNodalDegreeOfFreedom = new NodalDegreeOfFreedom(node1, DegreeOfFreedom.X);

            Assert.IsTrue(SUT.Equals(equalNodalDegreeOfFreedom));
            Assert.IsTrue(SUT == equalNodalDegreeOfFreedom);
            Assert.IsFalse(SUT != equalNodalDegreeOfFreedom);
            Assert.AreEqual(SUT.GetHashCode(), equalNodalDegreeOfFreedom.GetHashCode());

            NodalDegreeOfFreedom notEqualDegreeOfFreedom = new NodalDegreeOfFreedom(node1, DegreeOfFreedom.Y);

            Assert.IsFalse(SUT.Equals(notEqualDegreeOfFreedom));
            Assert.IsFalse(SUT == notEqualDegreeOfFreedom);
            Assert.IsTrue(SUT != notEqualDegreeOfFreedom);
            Assert.AreNotEqual(SUT.GetHashCode(), notEqualDegreeOfFreedom.GetHashCode());

            FiniteElementNode node2 = factory.Create(1);
            NodalDegreeOfFreedom notEqualNode = new NodalDegreeOfFreedom(node2, DegreeOfFreedom.X);

            Assert.IsFalse(SUT.Equals(notEqualNode));
            Assert.IsFalse(SUT == notEqualNode);
            Assert.IsTrue(SUT != notEqualNode);
            Assert.AreNotEqual(SUT.GetHashCode(), notEqualNode.GetHashCode());
        }
Example #2
0
        public void NodesAreEqualIfTheirCoordinatesAreEqual()
        {
            factory = new NodeFactory(ModelType.Truss3D);
            FiniteElementNode SUT = factory.Create(0, 0, 0);

            FiniteElementNode equalToSUT = factory.Create(0, 0, 0);
            Assert.IsTrue(SUT.Equals(equalToSUT));
            Assert.IsTrue(SUT == equalToSUT);
            Assert.IsFalse(SUT != equalToSUT);

            FiniteElementNode notEqualToSUTByX = factory.Create(1, 0, 0);
            Assert.IsFalse(SUT.Equals(notEqualToSUTByX));
            Assert.IsFalse(SUT == notEqualToSUTByX);
            Assert.IsTrue(SUT != notEqualToSUTByX);

            FiniteElementNode notEqualToSUTByY = factory.Create(0, 1, 0);
            Assert.IsFalse(SUT.Equals(notEqualToSUTByY));
            Assert.IsFalse(SUT == notEqualToSUTByY);
            Assert.IsTrue(SUT != notEqualToSUTByY);

            FiniteElementNode notEqualToSUTByZ = factory.Create(0, 0, 1);
            Assert.IsFalse(SUT.Equals(notEqualToSUTByZ));
            Assert.IsFalse(SUT == notEqualToSUTByZ);
            Assert.IsTrue(SUT != notEqualToSUTByZ);
        }
 public void SetUp()
 {
     nodeFactory = new NodeFactory(ModelType.Truss1D);
     start = nodeFactory.Create(0);
     end = nodeFactory.Create(1);
     elementFactory = new ElementFactory(ModelType.Truss1D);
     SUT = elementFactory.CreateLinearConstantSpring(start, end, 2);
 }
 public void SetUp()
 {
     nodeFactory = new NodeFactory(ModelType.Truss1D);
     start = nodeFactory.Create(0);
     end = nodeFactory.Create(1);
     elementFactory = new ElementFactory(ModelType.Truss1D);
     material = new GenericElasticMaterial(0, 0.1, 0, 0);
     section = new SolidRectangle(0.1, 1);
     SUT = elementFactory.CreateLinearTruss(start, end, material, section);
 }
Example #5
0
 public void SetUp()
 {
     ModelType modelType = ModelType.Beam1D;
     nodeFactory = new NodeFactory(modelType);
     start = nodeFactory.Create(0);
     end = nodeFactory.Create(1);
     elementFactory = new ElementFactory(modelType);
     material = new GenericElasticMaterial(0, 0.1, 0, 0);
     section = new SolidRectangle(0.1, 1);
     SUT = elementFactory.CreateLinear3DBeam(start, end, material, section);
 }
Example #6
0
 public void Setup()
 {
     SUT = new NodeRepository(ModelType.Truss1D);
     nodeFactory = new NodeFactory(ModelType.Truss1D, SUT);
     node1 = nodeFactory.Create(0);
     node2 = nodeFactory.Create(1);
     node3 = nodeFactory.Create(2);
 }
Example #7
0
        public void NodesCanHaveAConstraint()
        {
            SUT = new NodeRepository(ModelType.Full3D);
            nodeFactory = new NodeFactory(ModelType.Full3D, SUT);
            node1 = nodeFactory.Create(0, 0, 0);

            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.X));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.Y));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.Z));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.XX));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.YY));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.ZZ));

            SUT.ConstrainNode(node1, DegreeOfFreedom.X);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.X));
            Assert.IsFalse(SUT.IsConstrained(node1, DegreeOfFreedom.Y));

            SUT.ConstrainNode(node1, DegreeOfFreedom.Y);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.X));
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.Y));

            SUT.ConstrainNode(node1, DegreeOfFreedom.Z);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.Z));

            SUT.ConstrainNode(node1, DegreeOfFreedom.XX);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.XX));

            SUT.ConstrainNode(node1, DegreeOfFreedom.YY);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.YY));

            SUT.ConstrainNode(node1, DegreeOfFreedom.ZZ);
            Assert.IsTrue(SUT.IsConstrained(node1, DegreeOfFreedom.ZZ));
        }
Example #8
0
 public void Setup()
 {
     factory = new NodeFactory(ModelType.Truss1D);
 }
 public void Setup()
 {
     nodeFactory = new NodeFactory(ModelType.Truss2D);
     node1 = nodeFactory.CreateFor2DTruss(0, 0);
     node2 = nodeFactory.CreateFor2DTruss(0, 1);
     node3 = nodeFactory.CreateFor2DTruss(0, 2);
     SUT = new ElementRepository();
     elementFactory = new ElementFactory(ModelType.Truss2D, SUT);
     spring1 = elementFactory.CreateLinearConstantSpring(node1, node2, 1);
     spring2 = elementFactory.CreateLinearConstantSpring(node2, node3, 2);
 }
Example #10
0
 public void Setup()
 {
     SUT = new ForceRepository();
     forceFactory = new ForceFactory(ModelType.Truss1D, SUT);
     exampleForce1 = forceFactory.Create(1);
     exampleForce2 = forceFactory.Create(2);
     nodeFactory = new NodeFactory(ModelType.Truss1D);
     node = nodeFactory.Create(0);
 }
        protected void CreateAndStore3DSpringFromOriginTo(double x, double y, double z)
        {
            nodeFactory = new NodeFactory(ModelType.Truss3D);
            start = nodeFactory.Create(0, 0, 0);
            end = nodeFactory.Create(x, y, z);

            elementFactory = new ElementFactory(ModelType.Truss3D);
            this.SUT = elementFactory.CreateLinearConstantSpring(start, end, 1);
        }
        protected void CreateAndStore2DSpringFromOriginTo(double x, double z)
        {
            this.nodeFactory = new NodeFactory(ModelType.Truss2D);
            this.start = nodeFactory.CreateFor2DTruss(0, 0);
            this.end = nodeFactory.CreateFor2DTruss(x, z);

            this.elementFactory = new ElementFactory(ModelType.Truss2D);
            this.SUT = elementFactory.CreateLinearConstantSpring(this.start, this.end, 1);
        }