Диссертация (Физико-технологические основы и пути совершенствования технологии получения кристаллов сапфира для электронной техники), страница 54
Описание файла
Файл "Диссертация" внутри архива находится в папке "Физико-технологические основы и пути совершенствования технологии получения кристаллов сапфира для электронной техники". PDF-файл из архива "Физико-технологические основы и пути совершенствования технологии получения кристаллов сапфира для электронной техники", который расположен в категории "". Всё это находится в предмете "технические науки" из Аспирантура и докторантура, которые можно найти в файловом архиве СПбПУ Петра Великого. Не смотря на прямую связь этого архива с СПбПУ Петра Великого, его также можно найти и в других разделах. , а ещё этот архив представляет собой докторскую диссертацию, поэтому ещё представлен в разделе всех диссертаций на соискание учёной степени доктора технических наук.
Просмотр PDF-файла онлайн
Текст 54 страницы из PDF
Geometry is retrieved from aSourceElements// Temperature values are in aValuesvoid CPosFileWriter::Write(const char* lpszPathToFile,const vector<STetrElement>& aSourceElements,const vector<double>& aValues){ofstream outFile(lpszPathToFile);outFile <<"View \"A 3D scalar field\" {"<<"\n";vector<STetrElement>::const_iterator it;vector<STetrElement>::const_iterator begin = aSourceElements.begin();vector<STetrElement>::const_iterator end = aSourceElements.end();for (it = begin; it != end; it++){outFile << "SS ( ";unsigned int nNode, nFacesCount = COUNTOF(it->m_aNodesCoords);for (nNode = 0; nNode < nFacesCount; ++nNode){const SNode& node = it->m_aNodesCoords[nNode];outFile << node.m_x << ", " << node.m_y << ", " << node.m_z;if (nNode == nFacesCount - 1)outFile << ")";elseoutFile << ", ";}int nIndexoutFile <<<<<<<<<<= it"{ "", "", "" ,""};"- begin;<< aValues[nIndex]<< aValues[nIndex]<< aValues[nIndex]<< aValues[nIndex]<< endl;}outFile << "};";}Класс для построения геометрии при моделировнии роста кристаллов сапфира401#include#include#include#include"StdAfx.h""GeometryBuilder.h""Vector.h"<algorithm>namespace{////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Constants//const unsigned int FACE_NODES_COUNT = 3;}//// struct SNeighbours//struct SNeighbours{SNeighbours(): m_nElemIndex(-1), m_nFaceIndex(-1){}int m_nElemIndex; // element index in arrayint m_nFaceIndex; // element's face index};using namespace std;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CGeometryBuilder class//CGeometryBuilder::CGeometryBuilder(){}CGeometryBuilder::~CGeometryBuilder(){}// Creates collection of STetrElement with filled propertiesvoid CGeometryBuilder::Build(const vector<SNode>& aNodes,const vector<STetrahedron>& aTetrahedrons,vector<STetrElement>* paResult){_ASSERTE(paResult != NULL);_InitGeometry(aNodes, aTetrahedrons);402_CalculateCenters();_CalculateFaces();_FindNeighbours();_UpdateNormals();*paResult = m_aElements;m_aElements.clear();}void CGeometryBuilder::_InitGeometry(const vector<SNode>& aNodes,const vector<STetrahedron>& aTetrahedrons){// aNodes contains nodes coordinates.// aTetrahedrons is an array of structures, each// structure contains IDs of 4 nodes.if (aTetrahedrons.size() > 0){m_aElements.resize(aTetrahedrons.size());unsigned int nVertexCount = COUNTOF(aTetrahedrons[0].m_nodes);int i, nSize = aTetrahedrons.size();for (i = 0; i < nSize; ++i){unsigned int nNode;for (nNode = 0; nNode < nVertexCount; ++nNode){// copy nodes coords from source geometries to inner arraym_aElements[i].m_aNodesCoords[nNode] =aNodes[aTetrahedrons[i].m_nodes[nNode]];}}}}// Calculates centers of each tetrahedronvoid CGeometryBuilder::_CalculateCenters(){vector<STetrElement>::iterator it, end = m_aElements.end();for (it = m_aElements.begin(); it != end; it++)_CalculateCenter(it->m_aNodesCoords, COUNTOF(it->m_aNodesCoords), &it>m_centerPoint);}// Calculates properties of each face: area, center, normalvoid CGeometryBuilder::_CalculateFaces(){vector<STetrElement>::iterator it, end = m_aElements.end();for (it = m_aElements.begin(); it != end; it++){unsigned int nFace, nNodesCount = COUNTOF(it->m_aFaceCenter);for (nFace = 0; nFace < nNodesCount; ++nFace){SNode aFace[FACE_NODES_COUNT];_GetFace(*it, nFace, aFace);_CalculateFaceArea(aFace, &it->m_aAreas[nFace]);_CalculateCenter(aFace, FACE_NODES_COUNT, &it->m_aFaceCenter[nFace]);403_CalculateNormal(aFace, &it->m_aNormals[nFace]);}}}// Searches neighbor elements;// For border elements sets border typevoid CGeometryBuilder::_FindNeighbours(){// Calcualate bound box_CalculateBoundBox();map<SNode, SNeighbours> mapNeighbours;vector<STetrElement>::iterator it, end = m_aElements.end();for (it = m_aElements.begin(); it != end; it++){unsigned int nIndex = it - m_aElements.begin();unsigned int nFace, nFacesCount = COUNTOF(it->m_aFaceCenter);for (nFace = 0; nFace < nFacesCount; ++nFace){SNeighbours& nb = mapNeighbours[it->m_aFaceCenter[nFace]];if (nb.m_nElemIndex == -1){// we've got this face first timenb.m_nElemIndex = nIndex;nb.m_nFaceIndex = nFace;}else{// we've got this face second time, so, this polygon is// shared between two elements;// set own properties each otherit->m_anNeighbours[nFace] = nb.m_nElemIndex;m_aElements[nb.m_nElemIndex].m_anNeighbours[nb.m_nFaceIndex] = nIndex;// remove face from collectionmapNeighbours.erase(it->m_aFaceCenter[nFace]);}}}// mapNeighbours contains now border elements only_SetBorderLocations(mapNeighbours);}// Turns faces normals if requiredvoid CGeometryBuilder::_UpdateNormals(){vector<STetrElement>::iterator it, end = m_aElements.end();for (it = m_aElements.begin(); it != end; it++){unsigned int i, nNbCount = COUNTOF(it->m_anNeighbours);for (i = 0; i < nNbCount; ++i){CVector v;// find current normal directionint nNbIndex = it->m_anNeighbours[i];if (nNbIndex != -1)404{// if the face is border - use its center pointSTetrElement& neighbour = m_aElements[nNbIndex];v.Set(it->m_centerPoint, neighbour.m_centerPoint);}else{// else use center of neighbor elementv.Set(it->m_centerPoint, it->m_aFaceCenter[i]);}double fVal = it->m_aNormals[i].GetX() * v.GetX() +it->m_aNormals[i].GetY() * v.GetY() +it->m_aNormals[i].GetZ() * v.GetZ();// turn face normal if requiredif (fVal <= 0.0)it->m_aNormals[i].Reverse();}}}// Retrieves face areavoid CGeometryBuilder::_CalculateFaceArea(const SNode aFace[], double* pArea){_ASSERTE(aFace != NULL);_ASSERTE(pArea != NULL);*pArea = 0.5 * fabs(aFace[0].m_xaFace[0].m_yaFace[0].m_zaFace[0].m_zaFace[0].m_yaFace[0].m_x******aFace[1].m_yaFace[1].m_zaFace[1].m_xaFace[1].m_yaFace[1].m_xaFace[1].m_z******aFace[2].m_z +aFace[2].m_x +aFace[2].m_y aFace[2].m_x aFace[2].m_z aFace[2].m_y);}// Retrieves average pointvoid CGeometryBuilder::_CalculateCenter(const SNode aNodes[], unsigned intnNodesCount,SNode* pCenterPoint){_ASSERTE(aNodes != NULL);_ASSERTE(pCenterPoint != NULL);// sort elements to avoid accumulation error.// you can replace std::sort by by any simple sort// to increase performance (imho, it is not critical)vector<SNode> aTmpNodes(aNodes, aNodes + nNodesCount);sort(aTmpNodes.begin(), aTmpNodes.end());SNode centerPoint;unsigned int nNode;for (nNode = 0; nNode < nNodesCount; ++nNode){centerPoint.m_x += aTmpNodes[nNode].m_x;centerPoint.m_y += aTmpNodes[nNode].m_y;centerPoint.m_z += aTmpNodes[nNode].m_z;}centerPoint.m_x /= nNodesCount;405centerPoint.m_y /= nNodesCount;centerPoint.m_z /= nNodesCount;*pCenterPoint = centerPoint;}void CGeometryBuilder::_CalculateBoundBox(){vector<STetrElement>::iterator it, end = m_aElements.end();for (it = m_aElements.begin(); it != end; it++){unsigned int nNode, nNodesCount = COUNTOF(it->m_aNodesCoords);for (nNode = 0; nNode < nNodesCount; ++nNode){_Merge(m_boundBox, it->m_aNodesCoords[nNode]);}}}// Set type of border(bottom, top, other) to each element from mapBordersvoid CGeometryBuilder::_SetBorderLocations(const map<SNode, SNeighbours>&mapBorders){map<SNode, SNeighbours>::const_iterator mit, end = mapBorders.end();for (mit = mapBorders.begin(); mit != end; mit++){STetrElement& elem = m_aElements[mit->second.m_nElemIndex];SNode aFace[FACE_NODES_COUNT];_GetFace(elem, mit->second.m_nFaceIndex, aFace);bool bBottom = true, bTop = true;// do not use face centers to avoid accumulation errorsunsigned int nNode;for (nNode = 0; (nNode < FACE_NODES_COUNT) && (bBottom || bTop); ++nNode){bBottom &= (aFace[nNode].m_y == m_boundBox.m_minY);bTop &= (aFace[nNode].m_y == m_boundBox.m_maxY);}_ASSERTE(!(bBottom && bTop));if (bBottom)elem.m_eLocation = esBottom;else if (bTop)elem.m_eLocation = esTop;elseelem.m_eLocation = esOtherBorder;}}// Merges bound box with pointvoid CGeometryBuilder::_Merge(SBoundBox& box, const SNode& point){box.m_minX = min(box.m_minX, point.m_x);box.m_minY = min(box.m_minY, point.m_y);box.m_minZ = min(box.m_minZ, point.m_z);box.m_maxX = max(box.m_maxX, point.m_x);box.m_maxY = max(box.m_maxY, point.m_y);box.m_maxZ = max(box.m_maxZ, point.m_z);406}// Returns normal vector for plane, specified by 3 pointsvoid CGeometryBuilder::_CalculateNormal(const SNode aFace[], CVector* pResult){_ASSERTE(pResult != NULL);CVector v1(aFace[0], aFace[1]);CVector v2(aFace[0], aFace[2]);CVector result;result.m_x = (v1.m_y * v2.m_z) - (v1.m_z * v2.m_y);result.m_y = (v1.m_x * v2.m_z) - (v1.m_z * v2.m_x);result.m_z = (v1.m_x * v2.m_y) - (v1.m_y * v2.m_x);result.Normalize();*pResult = result;}// Retrieves tetrahedron's face by indexvoid CGeometryBuilder::_GetFace(const STetrElement& elem, unsigned int nFaceIndex,SNode aFace[]){_ASSERTE(nFaceIndex < COUNTOF(elem.m_aFaceCenter));unsigned int nFaces = COUNTOF(elem.m_aFaceCenter);////////nFaceIndexnFaceIndexnFaceIndexnFaceIndex========0123->->->->0,1,2,3,1,2,3,0,2301unsigned int nNode;for (nNode = 0; nNode < FACE_NODES_COUNT; ++nNode)aFace[nNode] = elem.m_aNodesCoords[(nFaceIndex++) % nFaces];}407ПРИЛОЖЕНИЕ С Акты использования и внедрения результатов диссертационной работы408409410411412413414415416417418419420421.