예제 #1
0
파일: DP_PS.cpp 프로젝트: lcpt/xc
XC::BJtensor XC::DPPotentialSurface::d2Qods2(const XC::EPState *EPS) const {
    BJtensor d2Qods2(4, def_dim_4, 0.0);
    
	BJtensor KroneckerI("I", 2, def_dim_2);
	BJtensor T1 = KroneckerI("ij")*KroneckerI("mn");
	T1.null_indices();
	BJtensor T2 = (T1.transpose0110()+T1.transpose0111())*0.5;
	BJtensor T3 = T2 - T1*(1.0/3.0);
	
    //double temp1 =  EPS->getScalarVar(1);    
    //double temp1 = getalfa2();
    
    BJtensor T4;
    XC::stresstensor alpha;
    XC::stresstensor s_bar;
    BJtensor temp9(4, def_dim_4, 0.0);
    XC::stresstensor sigma = EPS->getStress();
    double p = sigma.p_hydrostatic();
    XC::stresstensor sdev = sigma.deviator();
    double halfRt2 = 0.5 * sqrt(2.0);
    int nod = EPS->getNTensorVar();
    if ( nod >=1 )  { //May not have kinematic hardening
      alpha = EPS->getTensorVar(1);
      temp9 = KroneckerI("ij") * alpha("mn");
      temp9.null_indices();
      T4 = T2 + temp9*(1.0/3.0);
      s_bar = sdev - (alpha*p);
    }
    else {
	  s_bar = sdev;
	  T4 = T2;
    }
    T4 = T2 - temp9;
    BJtensor temp3 = s_bar("ij") * s_bar("ij");
    temp3.null_indices();  
    double temp4 = temp3.trace();
    temp4 = sqrt(temp4);
    BJtensor temp5 = s_bar("ij")*s_bar("mn");
    double eps = pow( d_macheps(), 0.5 );
    if ( fabs(temp4) > eps )  {
      d2Qods2 = T3 * (halfRt2/temp4) - temp5*(halfRt2/(temp4*temp4*temp4));
      d2Qods2 = T4("ijkl") * d2Qods2("klmn");
      d2Qods2.null_indices();
    }   
    
    return d2Qods2;
}
예제 #2
0
void Board::Initialise()
{
	float zbase = 400;							//  Variable to store how deep in the z axis the object is based.
	
	
	Vector4 temp1(-600, 800, 1200 + zbase, 1);
	Vector4 temp2(600, 800, 1200 + zbase, 1);
	Vector4 temp3(600, 800, 0 + zbase, 1);
	Vector4 temp4(-600,800,0 + zbase,1);
	top.Initialise(temp1, temp2, temp3, temp4);		//  Set individual vertex locations for the top face of the board
	
	Vector4 col1(70,50,4,1);
	Vector4 col2(92,67,5,1);
	Vector4 col3(102,75,6,1);
	Vector4 col4(119,77,0,1);
	Vector4 col5(69, 25, 18, 1);
	top.SetColours(col1, col2, col2, col3);			//  Set individual colour values of each of those vertices
	
	
	
	Vector4 temp5(-600, 800, 0 + zbase, 1);
	Vector4 temp6(600, 800, 0 + zbase, 1);
	Vector4 temp7(600, 1000, 0 + zbase, 1);
	Vector4 temp8(-600,1000, 0 + zbase,1);			//  Individual vertices for the front face
	
	Vector4 temp9(-800, 1000, 1200 + zbase + 300, 1);
	Vector4 temp10(800, 1000, 1200 + zbase + 300, 1);
	Vector4 temp11(800, 1000, 100, 1);
	Vector4 temp12(-800, 1000, 100,1);				//  Individual vertices for the base face
	table.Initialise(temp9, temp10, temp11, temp12);
	table.SetColours(col5, col5, col5, col5);		//  Set to one mat colour, no shading.
	
	Vector4 temp13(-600, 800, 1200 + zbase, 1);
	Vector4 temp14(-600, 800, 0 + zbase, 1);
	Vector4 temp15(-600, 1000, 0 + zbase, 1);
	Vector4 temp16(-600, 1000, 1200 + zbase, 1);	//  Set individual vertices for the left face
	
	Vector4 temp17(600, 800, 0 + zbase, 1);
	Vector4 temp18(600, 800, 1200 + zbase, 1);
	Vector4 temp19(600, 1000, 1200 + zbase, 1);
	Vector4 temp20(600, 1000, 0 + zbase, 1);		//  Set individual vertices for the right face

	sides[0].Initialise(temp5, temp6, temp7, temp8);
	sides[1].Initialise(temp13, temp14, temp15, temp16);
	sides[2].Initialise(temp17, temp18, temp19, temp20);
	sides[3].Initialise(temp2, temp1, temp16, temp19);		//  Use known vertices to initialise the side faces
	
	sides[0].SetColours(col3, col4, col4, col2);
	sides[1].SetColours(col1, col2, col2, col1);
	sides[2].SetColours(col2, col1, col1, col2);
	sides[3].SetColours(col4, col4, col4, col4);			//  Then set the colours
	
	
	float positionLocations[24][2] =   {{-450, 1050 + zbase},		//1					An array holding the centre locations
										{-300,  900 + zbase},		//2					of each of the positions where pieces
										{-150,  750 + zbase},		//3					can be placed.
										{  0 ,  750 + zbase},		//4
										{ 150,  750 + zbase},		//5
										{ 300,  900 + zbase},		//6
										{ 450, 1050 + zbase},		//7
										{  0 ,  900 + zbase},		//8
										{  0 , 1050 + zbase},		//9
										{-450,  600 + zbase},		//10
										{-300,  600 + zbase},		//11
										{-150,  600 + zbase},		//12
										{-450,  150 + zbase},		//13
										{-300,  300 + zbase},		//14
										{-150,  450 + zbase},		//15
										{  0 ,  150 + zbase},		//16
										{  0 ,  300 + zbase},		//17
										{  0 ,  450 + zbase},		//18
										{ 450,  150 + zbase},		//19
										{ 300,  300 + zbase},		//20
										{ 150,  450 + zbase},		//21
										{ 450,  600 + zbase},		//22
										{ 300,  600 + zbase},		//23
										{ 150,  600 + zbase}};		//24
	for (int i = 0; i < 24; i++) {									
		boardpositions[i].Initialise(positionLocations[i][0], positionLocations[i][1]);			//  Create the individual graphical representations
	}																							//  (class Position) and put in array for easy drawing.
	InitialiseLines();				//  Ugly function to draw each and every line on the
									//  board with individual hand-placed vertices.
									
	SetupMills();					//  Set up the mills (groups of three) with pointers to the positions
									//  as alternate referencing option
	
}
예제 #3
0
//write relation
TEST(ParserAttList, ParAttList)
{
	
	//CREATE TABLE species (kind VARCHAR(10)) PRIMARY KEY (kind);
	Token temp(Token::KEYWORD);
	temp.content = "CREATE";
	tokens.push_back(temp);

	Token temp1(Token::KEYWORD);
	temp.content = "TABLE";
	tokens.push_back(temp1);

	Token temp2(Token::VARIABLE);
	temp.content = "species";
	tokens.push_back(temp2);

	Token temp3(Token::OPENPAREN);
	temp.content = "(";
	tokens.push_back(temp3);

	Token temp4(Token::VARIABLE);
	temp.content = "kind";
	tokens.push_back(temp4);

	Token temp5(Token::KEYWORD);
	temp.content = "VARCHAR";
	tokens.push_back(temp5);

	Token temp6(Token::OPENPAREN);
	temp.content = "(";
	tokens.push_back(temp6);

	Token temp7(Token::LITERAL);
	temp.content = "10";
	tokens.push_back(temp7);

	Token temp8(Token::CLOSEPAREN);
	temp.content = ")";
	tokens.push_back(temp8);

	Token temp9(Token::CLOSEPAREN);
	temp.content = ")";
	tokens.push_back(temp9);

	Token temp10(Token::KEYWORD);
	temp.content = "PRIMARY";
	tokens.push_back(temp10);

	Token temp11(Token::KEYWORD);
	temp.content = "KEY";
	tokens.push_back(temp11);

	Token temp12(Token::OPENPAREN);
	temp.content = "(";
	tokens.push_back(temp12);

	Token temp13(Token::VARIABLE);
	temp.content = "kind";
	tokens.push_back(temp13);

	Token temp14(Token::CLOSEPAREN);
	temp.content = ")";
	tokens.push_back(temp14);

	pars.command(tokens);

}