예제 #1
0
const XC::Matrix &XC::MFreedom_Joint2D::getConstraint(void) const
  {
    if(constraintMatrix.isEmpty())
      {
        std::cerr << getClassName() << "::" << __FUNCTION__
                  << "; no matrix was set\n";
        exit(-1);
      }    

    // Length correction
    // to correct the trial displacement
    if(LargeDisplacement == 2 )
      {
        // get the coordinates of the two nodes - check dimensions are the same FOR THE MOMENT
        const Vector &crdR = RetainedNode->getCrds();
        const Vector &crdC = ConstrainedNode->getCrds();

        // get committed displacements of nodes to get updated coordinates
        const Vector &dispR = RetainedNode->getTrialDisp();
        const Vector &dispC = ConstrainedNode->getTrialDisp();

        double deltaX = dispC(0) + crdC(0) - dispR(0) - crdR(0);
        double deltaY = dispC(1) + crdC(1) - dispR(1) - crdR(1);


        Vector Direction(2);
        Direction(0) = deltaX;
        Direction(1) = deltaY;
        double NewLength = Direction.Norm();
        if(NewLength < 1e-12)
          std::cerr << "XC::MFreedom_Joint2D::applyConstraint : length of rigid link is too small or zero"; 
        Direction = Direction * (Length0/NewLength);  // correct the length
                // find new displacements of the constrainted node
        
        Vector NewLocation(3);
        NewLocation(0) = Direction(0) + dispR(0) + crdR(0) - crdC(0);
        NewLocation(1) = Direction(1) + dispR(1) + crdR(1) - crdC(1);
        NewLocation(2) = dispC(2);
        ConstrainedNode->setTrialDisp(NewLocation);
      } // end of length correction procedure
    // return the constraint matrix Ccr
    return constraintMatrix;
  }
예제 #2
0
const Matrix &MP_Joint2D::getConstraint(void)
{
    if (constraint == 0) {
	opserr << "MP_Joint2D::getConstraint - no Matrix was set\n";
	exit(-1);
    }    

	// Length correction
	// to correct the trial displacement
    if ( LargeDisplacement == 2 )
	{
		// get the coordinates of the two nodes - check dimensions are the same FOR THE MOMENT
		const Vector &crdR = RetainedNode->getCrds();
		const Vector &crdC = ConstrainedNode->getCrds();

		// get commited displacements of nodes to get updated coordinates
		const Vector &dispR = RetainedNode->getTrialDisp();
		const Vector &dispC = ConstrainedNode->getTrialDisp();

		double deltaX = dispC(0) + crdC(0) - dispR(0) - crdR(0);
		double deltaY = dispC(1) + crdC(1) - dispR(1) - crdR(1);


		Vector Direction(2);
		Direction(0) = deltaX;
		Direction(1) = deltaY;
		double NewLength = Direction.Norm();
		if ( NewLength < 1e-12 ) opserr << "MP_Joint2D::applyConstraint : length of rigid link is too small or zero"; 
		Direction = Direction * (Length0/NewLength);		// correct the length
		// find new displacements of the constrainted node
	
		Vector NewLocation(3);
		NewLocation(0) = Direction(0) + dispR(0) + crdR(0) - crdC(0);
		NewLocation(1) = Direction(1) + dispR(1) + crdR(1) - crdC(1);
		NewLocation(2) = dispC(2);
		int dummy = ConstrainedNode->setTrialDisp( NewLocation );
	}
	// end of length correction procedure

    // return the constraint matrix Ccr
    return (*constraint);
}
예제 #3
0
TEST(BookmarkTest,BookmarkUpdates)
{
	std::wstring Name(L"Test name");
	std::wstring Location(L"Test location");
	std::wstring Description(L"Test description");
	CBookmark Bookmark(Name,Location,Description);

	std::wstring NewName(L"New test name");
	Bookmark.SetName(NewName);
	EXPECT_EQ(NewName,Bookmark.GetName());

	std::wstring NewLocation(L"New test location");
	Bookmark.SetLocation(NewLocation);
	EXPECT_EQ(NewLocation,Bookmark.GetLocation());

	std::wstring NewDescription(L"New test description");
	Bookmark.SetDescription(NewDescription);
	EXPECT_EQ(NewDescription,Bookmark.GetDescription());
}