public CGenex(CModel TopoModel) { // Allocate memory m_arrFemNodes = new CFemNode[TopoModel.m_arrNodes.Length]; m_arrFemMembers = new CE_1D[TopoModel.m_arrMembers.Length]; // Temporary - to fill genex data // Same as topological data GenerateMesh1D(TopoModel); }
CModel TopoModelFile; // Create topological model file #endregion Fields #region Constructors ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Constructor - new public CFEM_CALC(CModel model, bool bDebugging) { // Load Topological model TopoModelFile = new CModel(); TopoModelFile = model; // Generate FEM model data from Topological model // Prepare solver data // Fill local and global matrices of FEM elements FEMModel = new CGenex(TopoModelFile); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Temp - display matrices if (bDebugging) { for (int i = 0; i < FEMModel.m_arrFemMembers.Length; i++) { // Member ID Console.WriteLine("Member ID: " + FEMModel.m_arrFemMembers[i].ID + "\n"); // kij_0 - local stiffeness matrix 6 x 6 Console.WriteLine("Local stiffeness matrix k" + FEMModel.m_arrFemMembers[i].NodeStart.ID + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "0 - Dimensions: 6 x 6 \n"); FEMModel.m_arrFemMembers[i].m_fkLocMatr.Print2DMatrixFormated(); // A Tranformation Rotation Matrixes 6 x 6 Console.WriteLine("Tranformation rotation matrix A - Dimensions: 6 x 6 \n"); FEMModel.m_arrFemMembers[i].m_fATRMatr3D.Print2DMatrixFormated(); // B Transfer Matrixes 6 x 6 Console.WriteLine("Transfer matrix B - Dimensions: 6 x 6 \n"); FEMModel.m_arrFemMembers[i].m_fBTTMatr3D.Print2DMatrixFormated(); // Kij - global matrix of member 12 x 12 Console.WriteLine("Global stiffeness matrix K" + FEMModel.m_arrFemMembers[i].NodeStart.ID + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "0 - Dimensions: 12 x 12 \n"); FEMModel.m_arrFemMembers[i].m_fKGlobM.Print2DMatrixFormated_ABxCD(FEMModel.m_arrFemMembers[i].m_fKGlobM.m_fArrMembersABxCD); // Element Load Vectors 2 x 6 Console.WriteLine("Member load vector - primary end forces in LCS at start node ID: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + " - Dimensions: 6 x 1 \n"); FEMModel.m_arrFemMembers[i].m_VElemPEF_LCS_StNode.Print1DVector(); Console.WriteLine("Member load vector - primary end forces in LCS at end node ID: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + " - Dimensions: 6 x 1 \n"); FEMModel.m_arrFemMembers[i].m_VElemPEF_LCS_EnNode.Print1DVector(); Console.WriteLine("Member load vector - primary end forces in GCS at start node ID: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + " - Dimensions: 6 x 1 \n"); FEMModel.m_arrFemMembers[i].m_VElemPEF_GCS_StNode.Print1DVector(); Console.WriteLine("Member load vector - primary end forces in GCS at end node ID: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + " - Dimensions: 6 x 1 \n"); FEMModel.m_arrFemMembers[i].m_VElemPEF_GCS_EnNode.Print1DVector(); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set Global Code Number of Nodes / Nastavit globalne kodove cisla uzlov // Save indexes of nodes and DOF which are free and represent vector of uknown variables in solution SetNodesGlobCodeNo(); // Nastavi DOF v uzloch a ich globalne kodove cisla, konecne CodeNo urci velkost matice konstrukcie // Fill members of structure global vector of displacement // Now we know number of not restrained DOF, so we can allocate array size m_fDisp_Vector_CN = new int[m_iCodeNo, 3]; // 1st - global DOF code number, 2nd - Node index, 3rd - local code number of DOF in NODE //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Save it as array of arrays n x 2 (1st value is index - node index (0 - n-1) , 2nd value is DOF index (0-5) // n - total number of nodes in model ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FillGlobalDisplCodeNo(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Right side of Equation System ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Stiffeness Matrix of Structure - Allocate Memory (Matrix Size) m_M_K_Structure = new CMatrix(m_iCodeNo); // Fill Global Stiffeness Matrix FillGlobalMatrix(); // Global Stiffeness Matrix m_iCodeNo x m_iCodeNo if (bDebugging) { Console.WriteLine("Global stiffeness matrix - Dimensions: " + m_iCodeNo + " x " + m_iCodeNo + "\n"); m_M_K_Structure.Print2DMatrixFormated(); } // Auxiliary temporary transformation from 2D to 1D array / from float do double // Pomocne prevody medzi jednorozmernym, dvojrozmernym polom a triedou Matrix, // bude nutne zladit a urcit jeden format v akom budeme pracovat s datami a potom zmazat CArray objArray = new CArray(); // Convert Size float[] m_M_K_fTemp1D = objArray.ArrTranf2Dto1D(m_M_K_Structure.m_fArrMembers); // Convert Type double[] m_M_K_dTemp1D = objArray.ArrConverFloatToDouble1D(m_M_K_fTemp1D); MatrixF64 objMatrix = new MatrixF64(m_iCodeNo, m_iCodeNo, m_M_K_dTemp1D); // Print Created Matrix of MatrixF64 Class if (bDebugging) { Console.WriteLine("Global stiffeness matrix in F64 Class - Dimensions: " + m_iCodeNo + " x " + m_iCodeNo + "\n"); objMatrix.WriteLine(); } // Get Inverse Global Stiffeness Matrix MatrixF64 objMatrixInv = objMatrix.Inverse(); // Print Inverse Matrix if (bDebugging) { Console.WriteLine("Inverse global stiffeness matrix - Dimensions: " + m_iCodeNo + " x " + m_iCodeNo + "\n"); objMatrixInv.WriteLine(); } // Convert Type float[] m_M_K_Inv_fTemp1D = objArray.ArrConverMatrixF64ToFloat1D(objMatrixInv); // Inverse Global Stiffeness Matrix of Structure - Allocate Memory (Matrix Size) CMatrix m_M_K_Structure_Inv = new CMatrix(m_iCodeNo); m_M_K_Structure_Inv.m_fArrMembers = objArray.ArrTranf1Dto2D(m_M_K_Inv_fTemp1D); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Left side of Equation System ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Load Vector - Allocate Memory (Vector Size) m_V_Load = new CVector(m_iCodeNo); // Fill Global Load Vector FillGlobalLoadVector(); // Display Global Load Vector if (bDebugging) { Console.WriteLine("Global load vector - Dimensions: " + m_iCodeNo + " x 1 \n"); m_V_Load.Print1DVector(); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Solution - calculation of unknown displacement of nodes in GCS - system of linear equations // Start Solver ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global Displacement Vector - Allocate Memory (Vector Size) m_V_Displ = new CVector(m_iCodeNo); // Fill Global Displacement Vector m_V_Displ = VectorF.fMultiplyMatrVectr(m_M_K_Structure_Inv, m_V_Load); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // End Solver ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Display Global Displacement Vector - solution result if (bDebugging) { Console.WriteLine("Global displacement vector - Dimensions: " + m_iCodeNo + " x 1 \n"); m_V_Displ.Print1DVector(); } // Set displacements and rotations of DOF in GCS to appropriate node DOF acc. to global code numbers for (int i = 0; i < m_iCodeNo; i++) { // Check if DOF is default (free - ) or has some initial value (settlement; soil consolidation etc.) // See default values - float.PositiveInfinity if (FEMModel.m_arrFemNodes[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] == float.PositiveInfinity) FEMModel.m_arrFemNodes[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] = m_V_Displ.FVectorItems[i]; // set calculated else // some real initial value exists FEMModel.m_arrFemNodes[m_fDisp_Vector_CN[i, 1]].m_VDisp.FVectorItems[m_fDisp_Vector_CN[i, 2]] += m_V_Displ.FVectorItems[i]; // add calculated (to sum) } // Set default zero displacements or rotations in GCS to fixed DOF for (int i = 0; i < FEMModel.m_arrFemNodes.Length; i++) { for (int j = 0; j < FEMModel.m_arrFemNodes[i].m_VDisp.FVectorItems.Length; j++) // Check each DOF of all nodes { if (FEMModel.m_arrFemNodes[i].m_VDisp.FVectorItems[j] == float.PositiveInfinity) // Check that default infinity value wasn't changed FEMModel.m_arrFemNodes[i].m_VDisp.FVectorItems[j] = 0; // Set zero } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get final end forces at element in global coordinate system GCS ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (bDebugging) { for (int i = 0; i < FEMModel.m_arrFemMembers.Length; i++) { FEMModel.m_arrFemMembers[i].GetArrElemEF_GCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + "; " + "Start Node End Forces in GCS"); FEMModel.m_arrFemMembers[i].m_VElemEF_GCS_StNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemEF_GCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "; " + "End Node End Forces in GCS"); FEMModel.m_arrFemMembers[i].m_VElemEF_GCS_EnNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemEF_LCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + "; " + "Start Node End Forces in LCS"); FEMModel.m_arrFemMembers[i].m_VElemEF_LCS_StNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemEF_LCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "; " + "End Node End Forces in LCS"); FEMModel.m_arrFemMembers[i].m_VElemEF_LCS_EnNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemIF_LCS_StNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeStart.ID + "; " + "Start Node Internal Forces in LCS"); FEMModel.m_arrFemMembers[i].m_VElemIF_LCS_StNode.Print1DVector(); FEMModel.m_arrFemMembers[i].GetArrElemIF_LCS_EnNode(); Console.WriteLine("Element Index No.: " + i + "; " + "Node No.: " + FEMModel.m_arrFemMembers[i].NodeEnd.ID + "; " + "End Node Internal Forces in LCS"); FEMModel.m_arrFemMembers[i].m_VElemIF_LCS_EnNode.Print1DVector(); } } // Calculate IF in x-places int inum_cut = 11; int inum_segm = 10; }
//---------------------------------------------------------------------------- //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- public CMLoadPart(CModel TopoModel, CE_1D[] arrFemMembers, int iMLoadIndex, int kMemberIndex, out float fTemp_A_UXRX, out float fTemp_Ma_UXRX, out float fTemp_A_UYRZ, out float fTemp_Ma_UYRZ, out float fTemp_A_UZRY, out float fTemp_Ma_UZRY, out float fTemp_B_UXRX, out float fTemp_Mb_UXRX, out float fTemp_B_UYRZ, out float fTemp_Mb_UYRZ, out float fTemp_B_UZRY, out float fTemp_Mb_UZRY ) { // Default fTemp_A_UXRX = 0.0f; fTemp_B_UXRX = 0.0f; fTemp_A_UYRZ = 0.0f; fTemp_B_UYRZ = 0.0f; fTemp_A_UZRY = 0.0f; fTemp_B_UZRY = 0.0f; fTemp_Ma_UXRX = 0.0f; fTemp_Mb_UXRX = 0.0f; fTemp_Ma_UYRZ = 0.0f; fTemp_Mb_UYRZ = 0.0f; fTemp_Ma_UZRY = 0.0f; fTemp_Mb_UZRY = 0.0f; if (TopoModel.m_arrMLoads[iMLoadIndex].IMemberCollection.Contains(TopoModel.m_arrMembers[kMemberIndex].ID)) // If member ID is same as collection item { // Fill external forces temp values switch (TopoModel.m_arrMLoads[iMLoadIndex].EDirPPC) // Load direction in principal coordinate system XX / YU / ZV { // 0 - Displacement in x-axis and rotation about x-axis in PCS // 1 - Displacement in y-axis and rotation about z-axis in PCS // 2 - Displacement in z-axis and rotation about y-axis in PCS case EMLoadDirPCC1.eMLD_PCC_FXX_MXX: // Axial force or torsional moment { // DOF RX can be released at one end only - one side is always supported switch (arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX]) { // Type of supports is already defined but I check it once more in body of function !!! // XX - direction both sides supported displacement case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00_00: case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00_0_: case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_0__00: case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_0__0_: { // Type ObjLoadType = typeof(TopoModel.m_arrMLoads[i]); switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Axial Force { FEM_CALC_BASE.CMLoadPart_AXIAL_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_AXIAL_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX], out fTemp_A_UXRX, out fTemp_B_UXRX); break; } case BaseClasses.EMLoadType.eMLT_M: // Torsional Moment { FEM_CALC_BASE.CMLoadPart_TORS objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TORS(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX], out fTemp_Ma_UXRX, out fTemp_Mb_UXRX); break; } default: { break; } } break; } // XX - direction start supported, end free displacement //case FEM_CALC_BASE.Enums.EElemSuppType.eEl_00__0: case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00___: //case FEM_CALC_BASE.Enums.EElemSuppType.eEl_0____: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Axial Force { FEM_CALC_BASE.CMLoadPart_AXIAL_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_AXIAL_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX], out fTemp_A_UXRX, out fTemp_B_UXRX); break; } case BaseClasses.EMLoadType.eMLT_M: // Torsional Moment { FEM_CALC_BASE.CMLoadPart_TORS objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TORS(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX], out fTemp_Ma_UXRX, out fTemp_Mb_UXRX); break; } default: { break; } } break; } // XX - direction start free displacement, end supported //case FEM_CALC_BASE.Enums.EElemSuppType.eEl__0_00: case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl____00: //case FEM_CALC_BASE.Enums.EElemSuppType.eEl____0_: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Axial Force { FEM_CALC_BASE.CMLoadPart_AXIAL_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_AXIAL_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX], out fTemp_A_UXRX, out fTemp_B_UXRX); break; } case BaseClasses.EMLoadType.eMLT_M: // Torsional Moment { FEM_CALC_BASE.CMLoadPart_TORS objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TORS(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX], out fTemp_Ma_UXRX, out fTemp_Mb_UXRX); break; } default: { break; } } break; } // XX - direction start free displacement, end free displacement //case FEM_CALC_BASE.Enums.EElemSuppType.eEl__0__0: case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl______: default: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Axial Force { FEM_CALC_BASE.CMLoadPart_AXIAL_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_AXIAL_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX], out fTemp_A_UXRX, out fTemp_B_UXRX); break; } case BaseClasses.EMLoadType.eMLT_M: // Torsional Moment { FEM_CALC_BASE.CMLoadPart_TORS objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TORS(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUXRX], out fTemp_Ma_UXRX, out fTemp_Mb_UXRX); break; } default: { break; } } break; } } break; } case EMLoadDirPCC1.eMLD_PCC_FYU_MZV: // Transversal load { switch (arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ]) { // Type of supports is already defined but I check it once more in body of function !!! // UZRY - direction both sides supported displacement case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00_00: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } default: { break; } } break; } case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00_0_: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } default: { break; } } break; } case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_0__00: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } default: { break; } } break; } case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_0__0_: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } default: { break; } } break; } // UZRY - direction start supported, end free displacement case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00___: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } default: { break; } } break; } // UZRY - direction start free displacement, end supported case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl____00: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } default: { break; } } break; } // UZRY - direction start free displacement, end free displacement case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl______: default: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUYRZ], out fTemp_A_UYRZ, out fTemp_B_UYRZ, out fTemp_Ma_UYRZ, out fTemp_Mb_UYRZ); break; } default: { break; } } break; } } break; } case EMLoadDirPCC1.eMLD_PCC_FZV_MYU: // Transversal load { switch (arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY]) { // Type of supports is already defined but I check it once more in body of function !!! // UZRY - direction both sides supported displacement case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00_00: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } default: { break; } } break; } case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00_0_: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } default: { break; } } break; } case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_0__00: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } default: { break; } } break; } case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_0__0_: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } default: { break; } } break; } // UZRY - direction start supported, end free displacement case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl_00___: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } default: { break; } } break; } // UZRY - direction start free displacement, end supported case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl____00: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } default: { break; } } break; } // UZRY - direction start free displacement, end free displacement case FEM_CALC_BASE.Enums.EElemSuppType2D.eEl______: default: { switch (TopoModel.m_arrMLoads[iMLoadIndex].MLoadType) { case BaseClasses.EMLoadType.eMLT_F: // Transverse Force { FEM_CALC_BASE.CMLoadPart_TRANS_F objMLoadPart = new FEM_CALC_BASE.CMLoadPart_TRANS_F(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } case BaseClasses.EMLoadType.eMLT_M: // Bending Moment { FEM_CALC_BASE.CMLoadPart_BEND objMLoadPart = new FEM_CALC_BASE.CMLoadPart_BEND(TopoModel.m_arrMLoads[iMLoadIndex], (CE_1D_BASE)arrFemMembers[kMemberIndex], arrFemMembers[kMemberIndex].m_eSuppType2D[(int)EM_PCS_DIR1.eUZRY], out fTemp_A_UZRY, out fTemp_B_UZRY, out fTemp_Ma_UZRY, out fTemp_Mb_UZRY); break; } default: { break; } } break; } } break; } default: // Exception { fTemp_A_UXRX = float.MaxValue; fTemp_B_UXRX = float.MaxValue; fTemp_A_UYRZ = float.MaxValue; fTemp_B_UYRZ = float.MaxValue; fTemp_A_UZRY = float.MaxValue; fTemp_B_UZRY = float.MaxValue; fTemp_Ma_UXRX = float.MaxValue; fTemp_Mb_UXRX = float.MaxValue; fTemp_Ma_UYRZ = float.MaxValue; fTemp_Mb_UYRZ = float.MaxValue; fTemp_Ma_UZRY = float.MaxValue; fTemp_Mb_UZRY = float.MaxValue; break; } } } }
public void GenerateMesh1D(CModel TopoModel) { // Generate FEM nodes // Nodes for (int i = 0; i < TopoModel.m_arrNodes.Length; i++) { // Create FEM node CFemNode TempNode = new CFemNode(TopoModel.m_arrNodes[i]); m_arrFemNodes[i] = TempNode; // Set FEM node DOF // Get nodal support // Search if node is in list of supported nodes for each nodal support for (int i2 = 0; i2 < TopoModel.m_arrNSupports.Length; i2++) // Check all nodal supports { for (int j = 0; j < TopoModel.m_arrNSupports[i2].m_iNodeCollection.Length; j++) // Check list of nodes (Nodes IDs collection) { if (m_arrFemNodes[i].ID == TopoModel.m_arrNSupports[i2].m_iNodeCollection[j]) { // DOF of nodes are free - zero rigidity of restraints false as default m_arrFemNodes[i].m_ArrNodeDOF[(int)e3D_DOF.eUX] = TopoModel.m_arrNSupports[i2].m_bRestrain[(int)e3D_DOF.eUX]; // !!! 3D Environment enum m_arrFemNodes[i].m_ArrNodeDOF[(int)e3D_DOF.eUY] = TopoModel.m_arrNSupports[i2].m_bRestrain[(int)e3D_DOF.eUY]; // !!! 3D Environment enum m_arrFemNodes[i].m_ArrNodeDOF[(int)e3D_DOF.eUZ] = TopoModel.m_arrNSupports[i2].m_bRestrain[(int)e3D_DOF.eUZ]; // !!! 3D Environment enum m_arrFemNodes[i].m_ArrNodeDOF[(int)e3D_DOF.eRX] = TopoModel.m_arrNSupports[i2].m_bRestrain[(int)e3D_DOF.eRX]; // !!! 3D Environment enum m_arrFemNodes[i].m_ArrNodeDOF[(int)e3D_DOF.eRY] = TopoModel.m_arrNSupports[i2].m_bRestrain[(int)e3D_DOF.eRY]; // !!! 3D Environment enum m_arrFemNodes[i].m_ArrNodeDOF[(int)e3D_DOF.eRZ] = TopoModel.m_arrNSupports[i2].m_bRestrain[(int)e3D_DOF.eRZ]; // !!! 3D Environment enum } } } } // Generate FEM members // Members for (int i = 0; i < TopoModel.m_arrMembers.Length; i++) { CE_1D TempMember = new CE_1D(TopoModel.m_arrMembers[i], m_arrFemNodes); m_arrFemMembers[i] = TempMember; // Set FEM Member DOF if (TopoModel.m_arrNReleases != null) // Some releases exist { for (int j = 0; j < TopoModel.m_arrNReleases.Length; j++) // Check each release { for (int k = 0; k < TopoModel.m_arrNReleases[j].m_iMembCollection.Length; k++) // Check each member in collection { if (TopoModel.m_arrNReleases[j].m_iMembCollection[k] == m_arrFemMembers[i].ID) // if release exists on member { if (TopoModel.m_arrMembers[i].CnRelease1 != null) m_arrFemMembers[i].CnRelease1 = TopoModel.m_arrMembers[i].CnRelease1; if (TopoModel.m_arrMembers[i].CnRelease2 != null) m_arrFemMembers[i].CnRelease2 = TopoModel.m_arrMembers[i].CnRelease2; } } } } } //////////////////////////////////////////////////////////////////////////////////////////////// // Additional data of nodes depending on generated members for (int i = 0; i < m_arrFemNodes.Length; i++) { m_arrFemNodes[i].m_iMemberCollection = new System.Collections.ArrayList(); // Allocate collection memory for (int j = 0; j < m_arrFemMembers.Length; j++) { if (m_arrFemNodes[i].ID == m_arrFemMembers[j].NodeStart.ID || m_arrFemNodes[i].ID == m_arrFemMembers[j].NodeEnd.ID) // Is node ID same as member start or end node ID { m_arrFemNodes[i].m_iMemberCollection.Add(m_arrFemMembers[j].ID); // Add FEMmember ID to the FEM node list } } } // Releases !!!! - copied from 2D solution, check implementation in 3D !!! // If only two members are connected in one node and if release exists at that node, copy this release from one member to the another for (int i = 0; i < m_arrFemNodes.Length; i++) { if (m_arrFemNodes[i].m_iMemberCollection != null && m_arrFemNodes[i].m_iMemberCollection.Count == 2) // Node is connected to two members { // We know member ID, so we can get index of members in list int iMember1_index = -1; int iMember2_index = -1; for (int j = 0; j < m_arrFemMembers.Length; j++) { // 1st member index if (iMember1_index < 0 && m_arrFemNodes[i].m_iMemberCollection.Contains(m_arrFemMembers[j].ID)) // if Member ID is in the list { iMember1_index = j; // Set 1st } if (iMember1_index > -1) // Index was defined, we can break cycle break; } // 2nd member index for (int k = iMember1_index + 1; k < m_arrFemMembers.Length; k++) // Search for second only in interval between first founded member and last member { if (iMember2_index < 0 && m_arrFemNodes[i].m_iMemberCollection.Contains(m_arrFemMembers[k].ID)) // if Member ID is in the list interval { iMember2_index = k; } if (iMember2_index > -1) // Index was defined, we can break cycle break; } // If relases exist, they are neccesary to define DOF of both members, therefore copy release of one member to the another one if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember1_index].NodeStart.ID && m_arrFemMembers[iMember1_index].CnRelease1 != null) { if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember2_index].NodeStart.ID && m_arrFemMembers[iMember2_index].CnRelease1 == null) m_arrFemMembers[iMember2_index].CnRelease1.m_bRestrain = m_arrFemMembers[iMember1_index].CnRelease1.m_bRestrain; else if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember2_index].NodeEnd.ID && m_arrFemMembers[iMember2_index].CnRelease2 == null) m_arrFemMembers[iMember2_index].CnRelease2.m_bRestrain = m_arrFemMembers[iMember1_index].CnRelease1.m_bRestrain; } else if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember1_index].NodeEnd.ID && m_arrFemMembers[iMember1_index].CnRelease2 != null) { if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember2_index].NodeStart.ID && m_arrFemMembers[iMember2_index].CnRelease1 == null) m_arrFemMembers[iMember2_index].CnRelease1.m_bRestrain = m_arrFemMembers[iMember1_index].CnRelease2.m_bRestrain; else if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember2_index].NodeEnd.ID && m_arrFemMembers[iMember2_index].CnRelease2 == null) m_arrFemMembers[iMember2_index].CnRelease2.m_bRestrain = m_arrFemMembers[iMember1_index].CnRelease2.m_bRestrain; } else if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember2_index].NodeStart.ID && m_arrFemMembers[iMember2_index].CnRelease1 != null) { if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember1_index].NodeStart.ID && m_arrFemMembers[iMember1_index].CnRelease1 == null) m_arrFemMembers[iMember1_index].CnRelease1.m_bRestrain = m_arrFemMembers[iMember2_index].CnRelease1.m_bRestrain; else if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember1_index].NodeEnd.ID && m_arrFemMembers[iMember1_index].CnRelease2 == null) m_arrFemMembers[iMember1_index].CnRelease2.m_bRestrain = m_arrFemMembers[iMember2_index].CnRelease1.m_bRestrain; } else if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember2_index].NodeEnd.ID && m_arrFemMembers[iMember2_index].CnRelease2 != null) { if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember1_index].NodeStart.ID && m_arrFemMembers[iMember1_index].CnRelease1 == null) m_arrFemMembers[iMember1_index].CnRelease1.m_bRestrain = m_arrFemMembers[iMember2_index].CnRelease2.m_bRestrain; else if (m_arrFemNodes[i].ID == m_arrFemMembers[iMember1_index].NodeEnd.ID && m_arrFemMembers[iMember1_index].CnRelease2 == null) m_arrFemMembers[iMember1_index].CnRelease2.m_bRestrain = m_arrFemMembers[iMember2_index].CnRelease2.m_bRestrain; } } } // Additional data of members // Fill Members stifeness matrices for (int i = 0; i < m_arrFemMembers.Length; i++) { m_arrFemMembers[i].FillBasic3_StiffMatrices(); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // External Loads // Fill vectors // Nodal loads // Fill vector of external load for each node in list // Node could be included in all lists only once, more than one nodal load in one node is not allowed if (!object.ReferenceEquals(null, TopoModel.m_arrNLoads)) { for (int i = 0; i < TopoModel.m_arrNLoads.Length; i++) // Each load { if (TopoModel.m_arrNLoads[i].INodeCollection != null) // Check if some nodes are in list { for (int j = 0; j < TopoModel.m_arrNLoads[i].INodeCollection.Length; j++) // Each node in collection { // Set load vector values for (int k = 0; k < m_arrFemNodes.Length; k++) // Neefektivne prechadzat zbytocne vsetky uzly kedze pozname konkretne ID zatazenych { if (TopoModel.m_arrNLoads[i].INodeCollection.Contains(TopoModel.m_arrNodes[k].ID)) // If node ID is same as collection item { // Check object class if (TopoModel.m_arrNLoads[i] is BaseClasses.CNLoadAll) { CNLoadAll oTemp = new CNLoadAll(); // Create new object of necessary type oTemp = (CNLoadAll)(TopoModel.m_arrNLoads[i]); // Change object type m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFX] = oTemp.Value_FX; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFY] = oTemp.Value_FY; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFZ] = oTemp.Value_FZ; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMX] = oTemp.Value_MX; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMY] = oTemp.Value_MY; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMZ] = oTemp.Value_MZ; /* m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFX] = TopoModel.m_arrNLoads[i].Value_FX; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFY] = TopoModel.m_arrNLoads[i].Value_FY; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFZ] = TopoModel.m_arrNLoads[i].Value_FZ; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMX] = TopoModel.m_arrNLoads[i].Value_MX; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMY] = TopoModel.m_arrNLoads[i].Value_MY; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMZ] = TopoModel.m_arrNLoads[i].Value_MZ; */ } else { CNLoadSingle oTemp = new CNLoadSingle(); // Create new object of necessary type oTemp = (CNLoadSingle)(TopoModel.m_arrNLoads[i]); // Change object type m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFX] = oTemp.NLoadType == ENLoadType.eNLT_Fx ? oTemp.Value : 0.0f; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFY] = oTemp.NLoadType == ENLoadType.eNLT_Fy ? oTemp.Value : 0.0f; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eFZ] = oTemp.NLoadType == ENLoadType.eNLT_Fz ? oTemp.Value : 0.0f; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMX] = oTemp.NLoadType == ENLoadType.eNLT_Mx ? oTemp.Value : 0.0f; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMY] = oTemp.NLoadType == ENLoadType.eNLT_My ? oTemp.Value : 0.0f; m_arrFemNodes[k].m_VDirNodeLoad.FVectorItems[(int)e3D_E_F.eMZ] = oTemp.NLoadType == ENLoadType.eNLT_Mz ? oTemp.Value : 0.0f; } } } } } } } // Member loads // Set primary end forces only due to member loads in local coordinate system LCS // Summation of loads applied on one member // There can by more loads on one member, member could be in various loads lists (but only once in one list) if (!object.ReferenceEquals(null, TopoModel.m_arrMLoads)) { for (int i = 0; i < TopoModel.m_arrMLoads.Length; i++) // Each load { if (TopoModel.m_arrMLoads[i].IMemberCollection != null) // Check if some members are in list { for (int j = 0; j < TopoModel.m_arrMLoads[i].IMemberCollection.Length; j++) // Each node in collection { // Set end forces due to member load for (int k = 0; k < m_arrFemMembers.Length; k++) // Neefektivne prechadzat zbytocne vsetky pruty kedze pozname konkretne ID zatazenych { // Temporary value of end forces due to particular external force float fTemp_A_UXRX = 0f, fTemp_B_UXRX = 0f, fTemp_Ma_UXRX = 0f, fTemp_Mb_UXRX = 0f; float fTemp_A_UYRZ = 0f, fTemp_B_UYRZ = 0f, fTemp_Ma_UYRZ = 0f, fTemp_Mb_UYRZ = 0f; float fTemp_A_UZRY = 0f, fTemp_B_UZRY = 0f, fTemp_Ma_UZRY = 0f, fTemp_Mb_UZRY = 0f; // Fill end forces due to external forces vectors for member particular load index i and member index k // Depends on load dirrection and member support type // Use member PRINCIPAL coordinate system CMLoadPart objAux = new CMLoadPart(TopoModel, m_arrFemMembers, i, k, out fTemp_A_UXRX, out fTemp_Ma_UXRX, out fTemp_A_UYRZ, out fTemp_Ma_UYRZ, out fTemp_A_UZRY, out fTemp_Ma_UZRY, out fTemp_B_UXRX, out fTemp_Mb_UXRX, out fTemp_B_UYRZ, out fTemp_Mb_UYRZ, out fTemp_B_UZRY, out fTemp_Mb_UZRY ); // Add values of temporary end forces due to particular load to the end forces items of vector // Primary end forces due member loading in local coordinate system LCS // Start Node m_arrFemMembers[k].m_VElemPEF_LCS_StNode.FVectorItems[(int)e3D_E_F.eFX] += fTemp_A_UXRX; m_arrFemMembers[k].m_VElemPEF_LCS_StNode.FVectorItems[(int)e3D_E_F.eMX] += fTemp_Ma_UXRX; m_arrFemMembers[k].m_VElemPEF_LCS_StNode.FVectorItems[(int)e3D_E_F.eFY] += fTemp_A_UYRZ; // !!! Signs - nutne skontrolovat znamienka podla smeru lokalnych osi a orientacie zatazenia m_arrFemMembers[k].m_VElemPEF_LCS_StNode.FVectorItems[(int)e3D_E_F.eMZ] += fTemp_Ma_UYRZ; m_arrFemMembers[k].m_VElemPEF_LCS_StNode.FVectorItems[(int)e3D_E_F.eFZ] += fTemp_A_UZRY; // !!! Signs - nutne skontrolovat znamienka podla smeru lokalnych osi a orientacie zatazenia m_arrFemMembers[k].m_VElemPEF_LCS_StNode.FVectorItems[(int)e3D_E_F.eMY] += fTemp_Ma_UZRY; // End Node m_arrFemMembers[k].m_VElemPEF_LCS_EnNode.FVectorItems[(int)e3D_E_F.eFX] += fTemp_B_UXRX; m_arrFemMembers[k].m_VElemPEF_LCS_EnNode.FVectorItems[(int)e3D_E_F.eMX] += fTemp_Mb_UXRX; m_arrFemMembers[k].m_VElemPEF_LCS_EnNode.FVectorItems[(int)e3D_E_F.eFY] += fTemp_B_UYRZ; //-fTemp_B_UYRZ; // Zmena znamienka pre silu Vb na konci pruta, znamienko je opacne nez u reakcie, toto su vsak reakcie m_arrFemMembers[k].m_VElemPEF_LCS_EnNode.FVectorItems[(int)e3D_E_F.eMZ] += fTemp_Mb_UYRZ; m_arrFemMembers[k].m_VElemPEF_LCS_EnNode.FVectorItems[(int)e3D_E_F.eFZ] += fTemp_B_UZRY; //-fTemp_B_UZRY; // Zmena znamienka pre silu Vb na konci pruta, znamienko je opacne nez u reakcie, toto su vsak reakcie m_arrFemMembers[k].m_VElemPEF_LCS_EnNode.FVectorItems[(int)e3D_E_F.eMY] += fTemp_Mb_UZRY; } } } } } // Set primary end forces only due to member loads in global coordinate system GCS foreach (CE_1D Elem in m_arrFemMembers) { Elem.SetGetPEF_GCS(); } }
private void CalculateModelLimits(CModel cmodel, out float fTempMax_X, out float fTempMin_X, out float fTempMax_Y, out float fTempMin_Y, out float fTempMax_Z, out float fTempMin_Z ) { fTempMax_X = float.MinValue; fTempMin_X = float.MaxValue; fTempMax_Y = float.MinValue; fTempMin_Y = float.MaxValue; fTempMax_Z = float.MinValue; fTempMin_Z = float.MaxValue; if (cmodel.m_arrNodes != null) // Some nodes exist { for (int i = 0; i < cmodel.m_arrNodes.Length; i++) { // Maximum X - coordinate if (cmodel.m_arrNodes[i].X > fTempMax_X) fTempMax_X = cmodel.m_arrNodes[i].X; // Minimum X - coordinate if (cmodel.m_arrNodes[i].X < fTempMin_X) fTempMin_X = cmodel.m_arrNodes[i].X; // Maximum Y - coordinate if (cmodel.m_arrNodes[i].Y > fTempMax_Y) fTempMax_Y = cmodel.m_arrNodes[i].Y; // Minimum Y - coordinate if (cmodel.m_arrNodes[i].Y < fTempMin_Y) fTempMin_Y = cmodel.m_arrNodes[i].Y; // Maximum Z - coordinate if (cmodel.m_arrNodes[i].Z > fTempMax_Z) fTempMax_Z = cmodel.m_arrNodes[i].Z; // Minimum Z - coordinate if (cmodel.m_arrNodes[i].Z < fTempMin_Z) fTempMin_Z = cmodel.m_arrNodes[i].Z; } } else if (cmodel.m_arrGOPoints != null) // Some points exist { for (int i = 0; i < cmodel.m_arrGOPoints.Length; i++) { // Maximum X - coordinate if (cmodel.m_arrGOPoints[i].X > fTempMax_X) fTempMax_X = (float)cmodel.m_arrGOPoints[i].X; // Minimum X - coordinate if (cmodel.m_arrGOPoints[i].X < fTempMin_X) fTempMin_X = (float)cmodel.m_arrGOPoints[i].X; // Maximum Y - coordinate if (cmodel.m_arrGOPoints[i].Y > fTempMax_Y) fTempMax_Y = (float)cmodel.m_arrGOPoints[i].Y; // Minimum Y - coordinate if (cmodel.m_arrGOPoints[i].Y < fTempMin_Y) fTempMin_Y = (float)cmodel.m_arrGOPoints[i].Y; // Maximum Z - coordinate if (cmodel.m_arrGOPoints[i].Z > fTempMax_Z) fTempMax_Z = (float)cmodel.m_arrGOPoints[i].Z; // Minimum Z - coordinate if (cmodel.m_arrGOPoints[i].Z < fTempMin_Z) fTempMin_Z = (float)cmodel.m_arrGOPoints[i].Z; } } else { // Exception - no definition nodes or points } }
public Window2(CModel cmodel, bool bDebugging) { InitializeComponent(); if (cmodel != null) { Model3DGroup gr = new Model3DGroup(); //gr.Children.Add(new AmbientLight()); // Default color SolidColorBrush brushDefault = new SolidColorBrush(Color.FromRgb(255, 0, 0)); EGCS eGCS = EGCS.eGCSLeftHanded; //EGCS eGCS = EGCS.eGCSRightHanded; // Global coordinate system - axis ScreenSpaceLines3D sAxisX_3D = new ScreenSpaceLines3D(); ScreenSpaceLines3D sAxisY_3D = new ScreenSpaceLines3D(); ScreenSpaceLines3D sAxisZ_3D = new ScreenSpaceLines3D(); Point3D pGCS_centre = new Point3D(0,0,0); Point3D pAxisX = new Point3D(1, 0, 0); Point3D pAxisY = new Point3D(0, 1, 0); Point3D pAxisZ = new Point3D(0, 0, 1); sAxisX_3D.Points.Add(pGCS_centre); sAxisX_3D.Points.Add(pAxisX); sAxisX_3D.Color = Colors.Red; sAxisX_3D.Thickness = 2; sAxisY_3D.Points.Add(pGCS_centre); sAxisY_3D.Points.Add(pAxisY); sAxisY_3D.Color = Colors.Green; sAxisY_3D.Thickness = 2; sAxisZ_3D.Points.Add(pGCS_centre); sAxisZ_3D.Points.Add(pAxisZ); sAxisZ_3D.Color = Colors.Blue; sAxisZ_3D.Thickness = 2; //I made ViewPort public property to Access ViewPort object inside TrackPort3D //to ViewPort add 3 children (3 axis) _trackport.ViewPort.Children.Add(sAxisX_3D); _trackport.ViewPort.Children.Add(sAxisY_3D); _trackport.ViewPort.Children.Add(sAxisZ_3D); // Check that real model exists and create model geometry if (cmodel != null) { if (cmodel.m_arrMembers != null) // Some members exist { // Auxialiary for generation of colors numbers float j = 0; // Model Group of Members // Prepare member model for (int i = 0; i < cmodel.m_arrMembers.Length; i++) // !!! BUG pocet prvkov sa nacitava z xls aj z prazdnych riadkov pokial su nejako formatovane / nie default { if (cmodel.m_arrMembers[i] != null && cmodel.m_arrMembers[i].NodeStart != null && cmodel.m_arrMembers[i].NodeEnd != null && cmodel.m_arrMembers[i].CrScStart != null) // Member object is valid (not empty) { if (bDebugging) { System.Console.Write("\n" + "Member ID:" + (i + 1).ToString() + "\n"); // Write Member ID in console window System.Console.Write("Start Node ID:" + cmodel.m_arrMembers[i].NodeStart.ID.ToString() + "\n"); // Write Start Node ID and coordinates in console window System.Console.Write(cmodel.m_arrMembers[i].NodeStart.X.ToString() + "\t" + cmodel.m_arrMembers[i].NodeStart.Y.ToString() + "\t" + cmodel.m_arrMembers[i].NodeStart.Z.ToString() + "\n"); System.Console.Write("End Node ID:" + cmodel.m_arrMembers[i].NodeEnd.ID.ToString() + "\n"); // Write End Node ID and coordinates in console window System.Console.Write(cmodel.m_arrMembers[i].NodeEnd.X.ToString() + "\t" + cmodel.m_arrMembers[i].NodeEnd.Y.ToString() + "\t" + cmodel.m_arrMembers[i].NodeEnd.Z.ToString() + "\n\n"); cmodel.m_arrMembers[i].BIsDebugging = bDebugging; } if (cmodel.m_arrMembers[i].CrScStart.CrScPointsOut != null) // CCrSc is abstract without geometrical properties (dimensions), only centroid line could be displayed { // Member material color byte R = (byte)(250); byte G = (byte)(240); byte B = (byte)(230); SolidColorBrush br = new SolidColorBrush(Color.FromRgb(R, G, B)); // Material color br.Opacity = 0.8; // Set different color for each member bool bDiffMemberColors = false; if (bDiffMemberColors) { if (j < 20) // 20*10 = 200, 200 + 55 - 255 (maxium number of color) { br.Color = Color.FromRgb((byte)(55 + j * 10), (byte)(55 + j * 7), (byte)(55 + j * 5)); j++; } else { j = 0; } } bool bFastRendering = false; if (bFastRendering || (cmodel.m_arrMembers[i].CrScStart.TriangleIndicesFrontSide == null || cmodel.m_arrMembers[i].CrScStart.TriangleIndicesShell == null || cmodel.m_arrMembers[i].CrScStart.TriangleIndicesBackSide == null) ) // Check if are particular surfaces defined { // Create Member model - one geometry model // GeometryModel3D memberModel3D; // Add current member model to the model group gr.Children.Add((Model3D)cmodel.m_arrMembers[i].getG_M_3D_Member(eGCS, br)); } else { // Create Member model - consist of 3 geometry models (member is one model group) // Model3DGroup memberModel3D; // Add current member model to the model group SolidColorBrush br1 = new SolidColorBrush(Color.FromRgb(255, 64, 64)); // Material color - Front Side (red) SolidColorBrush br2 = new SolidColorBrush(Color.FromRgb(141, 238, 238)); // Material color - Shell (red) SolidColorBrush br3 = new SolidColorBrush(Color.FromRgb(238, 154, 73)); // Material color - Back Side (orange) br1.Opacity = br3.Opacity = 0.8; br2.Opacity = 0.4; gr.Children.Add(cmodel.m_arrMembers[i].getM_3D_G_Member(eGCS, br1, br2, br3)); } } else { // Display axis line, member is not valid to display in 3D } } } } if (cmodel.m_arrGOAreas != null) // Some areas exist { // Model Groups of Areas } if (cmodel.m_arrGOVolumes != null) // Some volumes exist { // Model Groups of Volumes for (int i = 0; i < cmodel.m_arrGOVolumes.Length; i++) { if (cmodel.m_arrGOVolumes[i] != null && cmodel.m_arrGOVolumes[i].m_pControlPoint != null && cmodel.m_arrGOVolumes[i].BIsDisplayed == true) // Volume object is valid (not empty) and should be displayed { // Get shape - prism , sphere, ... gr.Children.Add(cmodel.m_arrGOVolumes[i].CreateM_3D_G_Volume_8Edges()); // Add solid to model group } } } if (cmodel.m_arrGOStrWindows != null) // Some windows exist { // Model Groups of Windows for (int i = 0; i < cmodel.m_arrGOStrWindows.Length; i++) { if (cmodel.m_arrGOStrWindows[i] != null && cmodel.m_arrGOStrWindows[i].m_pControlPoint != null && cmodel.m_arrGOStrWindows[i].BIsDisplayed == true) // Volume object is valid (not empty) and should be displayed { if (cmodel.m_arrGOStrWindows[i].EShapeType == EWindowShapeType.eClassic) gr.Children.Add(cmodel.m_arrGOStrWindows[i].CreateM_3D_G_Window()); // Add solid to model group else { //Exception - not implemented } } } } if (cmodel.m_arrNSupports != null) // Some nodal supports exist { // Model Groups of Nodal Suports for (int i = 0; i < cmodel.m_arrNSupports.Length; i++) { if (cmodel.m_arrNSupports[i] != null && cmodel.m_arrNSupports[i].BIsDisplayed == true) // Support object is valid (not empty) and should be displayed { gr.Children.Add(cmodel.m_arrNSupports[i].CreateM_3D_G_NSupport()); // Add solid to model group // Set support for all assigned nodes } } } if (cmodel.m_arrNReleases != null) // Some member release exist { // Model Groups of Member Releases for (int i = 0; i < cmodel.m_arrNReleases.Length; i++) { if (cmodel.m_arrNReleases[i] != null && cmodel.m_arrNReleases[i].BIsDisplayed == true) // Support object is valid (not empty) and should be displayed { /* for (int j = 0; j < cmodel.m_arrNReleases[i].m_iMembCollection.Length; j++) // Set release for all assigned members (member nodes) { Model3DGroup model_gr = new Model3DGroup(); model_gr = cmodel.m_arrNReleases[i].CreateM_3D_G_MNRelease(); // Transform modelgroup from LCS to GCS model_gr = cmodel.m_arrNReleases[i].Transform3D_OnMemberEntity_fromLCStoGCS(model_gr, cmodel.m_arrMembers[cmodel.m_arrNReleases[i].m_iMembCollection[j]]); gr.Children.Add(model_gr); // Add Release to model group }*/ Model3DGroup model_gr = new Model3DGroup(); model_gr = cmodel.m_arrNReleases[i].CreateM_3D_G_MNRelease(); // Transform modelgroup from LCS to GCS model_gr = cmodel.m_arrNReleases[i].Transform3D_OnMemberEntity_fromLCStoGCS(model_gr, cmodel.m_arrNReleases[i].Member); gr.Children.Add(model_gr); // Add Release to model group } } } if (cmodel.m_arrNLoads != null) // Some nodal loads exist { // Model Groups of Nodal Loads for (int i = 0; i < cmodel.m_arrNLoads.Length; i++) { if (cmodel.m_arrNLoads[i] != null && cmodel.m_arrNLoads[i].BIsDisplayed == true) // Load object is valid (not empty) and should be displayed { gr.Children.Add(cmodel.m_arrNLoads[i].CreateM_3D_G_Load()); // Add to model group // Set load for all assigned nodes } } } if (cmodel.m_arrMLoads != null) // Some member loads exist { // Model Groups of Member Loads for (int i = 0; i < cmodel.m_arrMLoads.Length; i++) { if (cmodel.m_arrMLoads[i] != null && cmodel.m_arrMLoads[i].BIsDisplayed == true) // Load object is valid (not empty) and should be displayed { Model3DGroup model_gr = new Model3DGroup(); model_gr = cmodel.m_arrMLoads[i].CreateM_3D_G_Load(); // Transform modelgroup from LCS to GCS model_gr = cmodel.m_arrMLoads[i].Transform3D_OnMemberEntity_fromLCStoGCS(model_gr, cmodel.m_arrMLoads[i].Member); gr.Children.Add(model_gr); // Add Release to model group // Set load for all assigned member } } } /* The following lights derive from the base class Light: AmbientLight : Provides ambient lighting that illuminates all objects uniformly regardless of their location or orientation. DirectionalLight : Illuminates like a distant light source. Directional lights have a Direction specified as a Vector3D, but no specified location. PointLight : Illuminates like a nearby light source. PointLights have a position and cast light from that position. Objects in the scene are illuminated depending on their position and distance with respect to the light. PointLightBase exposes a Range property, which determines a distance beyond which models will not be illuminated by the light. PointLight also exposes attenuation properties which determine how the light's intensity diminishes over distance. You can specify constant, linear, or quadratic interpolations for the light's attenuation. SpotLight : Inherits from PointLight. Spotlights illuminate like PointLight and have both position and direction. They project light in a cone-shaped area set by InnerConeAngle and OuterConeAngle properties, specified in degrees. */ // Directional Light DirectionalLight Dir_Light = new DirectionalLight(); Dir_Light.Color = Colors.White; Dir_Light.Direction = new Vector3D(0, 0, -1); gr.Children.Add(Dir_Light); // Point light values PointLight Point_Light = new PointLight(); Point_Light.Position = new Point3D(0, 0, 30); Point_Light.Color = System.Windows.Media.Brushes.White.Color; Point_Light.Range = 30.0; Point_Light.ConstantAttenuation=0; Point_Light.LinearAttenuation=0; Point_Light.QuadraticAttenuation = 0.2f; Point_Light.ConstantAttenuation = 5.0; gr.Children.Add(Point_Light); SpotLight Spot_Light = new SpotLight(); Spot_Light.InnerConeAngle = 30; Spot_Light.OuterConeAngle = 30; Spot_Light.Color = System.Windows.Media.Brushes.White.Color; Spot_Light.Direction = new Vector3D(0, 0, -1); Spot_Light.Position = new Point3D(8.5, 8.5, 20); Spot_Light.Range = 30; gr.Children.Add(Spot_Light); //Set Ambient Light AmbientLight Ambient_Light = new AmbientLight(); Ambient_Light.Color = Color.FromRgb(250, 250, 230); gr.Children.Add(new AmbientLight()); if (cmodel.m_arrGOLines != null) // Some lines exist { Point3D solidCenter = new Point3D(-5, 0, 0); float fa = 0.5f; Point3D p0 = new Point3D(-fa, -fa, -fa); Point3D p1 = new Point3D(fa, -fa, -fa); Point3D p2 = new Point3D(fa, fa, -fa); Point3D p3 = new Point3D(-fa, fa, -fa); Point3D p4 = new Point3D(-fa, -fa, fa); Point3D p5 = new Point3D(fa, -fa, fa); Point3D p6 = new Point3D(fa, fa, fa); Point3D p7 = new Point3D(-fa, fa, fa); // Lines ScreenSpaceLines3D line1 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line2 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line3 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line4 = new ScreenSpaceLines3D(); Color lineColor = Color.FromRgb(250, 30, 30); line1.Color = lineColor; line1.Points.Add(p0); line1.Points.Add(p1); line2.Color = lineColor; line2.Points.Add(p1); line2.Points.Add(p2); line3.Color = lineColor; line3.Points.Add(p2); line3.Points.Add(p3); line4.Color = lineColor; line4.Points.Add(p3); line4.Points.Add(p0); _trackport.ViewPort.Children.Add(line1); _trackport.ViewPort.Children.Add(line2); _trackport.ViewPort.Children.Add(line3); _trackport.ViewPort.Children.Add(line4); ScreenSpaceLines3D line5 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line6 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line7 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line8 = new ScreenSpaceLines3D(); line5.Color = lineColor; line5.Points.Add(p4); line5.Points.Add(p5); line6.Color = lineColor; line6.Points.Add(p5); line6.Points.Add(p6); line7.Color = lineColor; line7.Points.Add(p6); line7.Points.Add(p7); line8.Color = lineColor; line8.Points.Add(p7); line8.Points.Add(p4); _trackport.ViewPort.Children.Add(line5); _trackport.ViewPort.Children.Add(line6); _trackport.ViewPort.Children.Add(line7); _trackport.ViewPort.Children.Add(line8); ScreenSpaceLines3D line09 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line10 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line11 = new ScreenSpaceLines3D(); ScreenSpaceLines3D line12 = new ScreenSpaceLines3D(); line09.Color = lineColor; line09.Points.Add(p0); line09.Points.Add(p4); line10.Color = lineColor; line10.Points.Add(p1); line10.Points.Add(p5); line11.Color = lineColor; line11.Points.Add(p2); line11.Points.Add(p6); line12.Color = lineColor; line12.Points.Add(p3); line12.Points.Add(p7); _trackport.ViewPort.Children.Add(line09); _trackport.ViewPort.Children.Add(line10); _trackport.ViewPort.Children.Add(line11); _trackport.ViewPort.Children.Add(line12); } } // Get model centre float fTempMax_X; float fTempMin_X; float fTempMax_Y; float fTempMin_Y; float fTempMax_Z; float fTempMin_Z; CalculateModelLimits(cmodel, out fTempMax_X, out fTempMin_X, out fTempMax_Y, out fTempMin_Y, out fTempMax_Z, out fTempMin_Z); float fModel_Length_X = fTempMax_X - fTempMin_X; float fModel_Length_Y = fTempMax_Y - fTempMin_Y; float fModel_Length_Z = fTempMax_Z - fTempMin_Z; Point3D pModelGeomCentre = new Point3D(fModel_Length_X / 2.0f, fModel_Length_Y / 2.0f, fModel_Length_Z / 2.0f); Point3D cameraPosition = new Point3D(pModelGeomCentre.X, pModelGeomCentre.Y + 300, pModelGeomCentre.Z + 100); //SolidColorBrush brush = new SolidColorBrush(Color.FromRgb(255, 255, 0)); //GeometryModel3D model = getGeometryModel3D(brush, obj_CrSc, new Point3D(10, 10, 10), new Point3D(500, 300, 200)); //gr.Children.Add(model); ////Point3D cameraPosition = ((MeshGeometry3D)model.Geometry).Positions[0]; ////cameraPosition.Z -= 1000; //brush = new SolidColorBrush(Color.FromRgb(0, 255, 0)); //model = getGeometryModel3D(brush, obj_CrSc, new Point3D(110, 110, 10), new Point3D(600, 400, 200)); //gr.Children.Add(model); //IMPORTANT: this is the best way to do it, but we can't use it because of trackball //because camera is set by trackball Transform this.Camera.Transform = _trackball.Transform; //and headlite too: this.Headlight.Transform = _trackball.Transform; _trackport.PerspectiveCamera.Position = cameraPosition; //_trackport.PerspectiveCamera.LookDirection = new Vector3D(cameraPosition.X, cameraPosition.Y, cameraPosition.Z - 100); _trackport.PerspectiveCamera.LookDirection = new Vector3D(0, -1, -0.2); _trackport.Model = (Model3D)gr; _trackport.SetupScene(); } }
public CFEM_CALC(CModel model, bool bDebugging) { }
private void menuItemOpen_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.DefaultExt = ".cnx"; ofd.Filter = "Cenex binary documents (.cnx)|*.cnx"; if (ofd.ShowDialog() == true) { try { // Open file from which to read the data FileStream fs = new FileStream(ofd.FileName, FileMode.Open); // Create a BinaryFormatter object to perform the deserialization BinaryFormatter bf = new BinaryFormatter(); // Create the object to store the deserialized data model = (CModel)bf.Deserialize(fs); // Close the file fs.Close(); } catch (Exception ex) { if (!EventLog.SourceExists("sw_en")) { EventLog.CreateEventSource("sw_en", "Application"); } EventLog.WriteEntry("sw_en", ex.Message + Environment.NewLine + ex.StackTrace, EventLogEntryType.Error); } } }
private void menuItemExample3D_90_Click(object sender, RoutedEventArgs e) { model = new sw_en_GUI.EXAMPLES._3D.CExample_3D_90(); Window2 win = new Window2(model, m_bDebugging); list_trackports.Add(win._trackport); Container.Children.Add(new MdiChild { Content = (UIElement)win.Content, Title = "Example 3D 90" + " - Window " + (Container.Children.Count + 1) }); win.Close(); }
private void menuItemExample3D_50_Click(object sender, RoutedEventArgs e) { model = new sw_en_GUI.EXAMPLES._3D.CExample_3D_50(); Window2 win = new Window2(model, m_bDebugging); list_trackports.Add(win._trackport); Container.Children.Add(new MdiChild { Content = (UIElement)win.Content, Title = "Example 3D 50" + " - Window " + (Container.Children.Count + 1) }); FEM_CALC_1Din3D.CFEM_CALC obj_Calc = new FEM_CALC_1Din3D.CFEM_CALC(model, m_bDebugging); // Nove vypoctove jadro win.Close(); }
private void initModelObject(string fileName) { model = new CModel(fileName); model.m_arrNodes = getNodes(((DataSet)dataGridNodes.DataContext).Tables[0]); //model.m_arrMat materials are in CENEX project Class should be moved to BaseClassess project. model.m_arrCrSc = getCrossSections(((DataSet)dataGridNodes.DataContext).Tables[2]); //model.m_arrNReleases //member Eccentricities model.m_arrMembers = getMembers(((DataSet)dataGridNodes.DataContext).Tables[5]); // Set properties to the Member (nodes, crsc) for (int i = 0; i < model.m_arrMembers.Length; i++) { // Nodes model.m_arrMembers[i].NodeStart = model.m_arrNodes[model.m_arrMembers[i].NodeStart.ID - 1]; model.m_arrMembers[i].NodeEnd = model.m_arrNodes[model.m_arrMembers[i].NodeEnd.ID - 1]; // Set Cross-section model.m_arrMembers[i].CrScStart = model.m_arrCrSc[model.m_arrMembers[i].CrScStart.ICrSc_ID - 1]; // Temp - nacitava sa z tabulky alebo z databazy, dopracovat // Parametre pre IPN 300 //model.m_arrMembers[i].CrSc = new CCrSc_3_00(0, 8, 0.300f, 0.125f, 0.0162f, 0.0108f, 0.0108f, 0.0065f, 0.2416f); // Example - FEM calculation 3D model.m_arrMembers[i].CrScStart = new CCrSc_0_05(0.1f, 0.05f); // Temp model.m_arrMembers[i].CrScStart.FI_t = 5.69e-07f; model.m_arrMembers[i].CrScStart.FI_y = 9.79e-05f; model.m_arrMembers[i].CrScStart.FI_z = 4.49e-06f; model.m_arrMembers[i].CrScStart.FA_g = 6.90e-03f; model.m_arrMembers[i].CrScStart.FA_vy = 4.01e-03f; model.m_arrMembers[i].CrScStart.FA_vz = 2.89e-03f; } model.m_arrNSupports = getNSupports(((DataSet)dataGridNodes.DataContext).Tables[6]); }