// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void QuadGeom::findDerivatives(DoubleArrayType::Pointer field, DoubleArrayType::Pointer derivatives) { int64_t numQuads = getNumberOfQuads(); int cDims = field->getNumberOfComponents(); double* fieldPtr = field->getPointer(0); double* derivsPtr = derivatives->getPointer(0); double values[4]; double derivs[3]; int64_t verts[4]; for (int64_t i = 0; i < numQuads; i++) { getVertsAtQuad(i, verts); for (int j = 0; j < cDims; j++) { for (size_t k = 0; k < 4; k++) { values[k] = fieldPtr[cDims * verts[k] + j]; } DerivativeHelpers::QuadDeriv()(this, i, values, derivs); derivsPtr[i * 3 * cDims + j * 3] = derivs[0]; derivsPtr[i * 3 * cDims + j * 3 + 1] = derivs[1]; derivsPtr[i * 3 * cDims + j * 3 + 2] = derivs[2]; } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void VertexGeom::findDerivatives(DoubleArrayType::Pointer field, DoubleArrayType::Pointer derivatives) { int64_t numVerts = getNumberOfVertices(); int cDims = field->getNumberOfComponents(); double* derivsPtr = derivatives->getPointer(0); for (int64_t i = 0; i < numVerts; i++) { for (int j = 0; j < cDims; j++) { derivsPtr[i * 3 * cDims + j * 3] = 0.0; derivsPtr[i * 3 * cDims + j * 3 + 1] = 0.0; derivsPtr[i * 3 * cDims + j * 3 + 2] = 0.0; } } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void FindGBCD::execute() { setErrorCondition(0); dataCheckVoxel(); if(getErrorCondition() < 0) { return; } // order here matters...because we are going to use the size of the crystal structures out of the dataCheckVoxel to size the faceAttrMat in dataCheckSurfaceMesh dataCheckSurfaceMesh(); if(getErrorCondition() < 0) { return; } #ifdef SIMPLib_USE_PARALLEL_ALGORITHMS tbb::task_scheduler_init init; bool doParallel = true; #endif size_t totalPhases = m_CrystalStructuresPtr.lock()->getNumberOfTuples(); size_t totalFaces = m_SurfaceMeshFaceLabelsPtr.lock()->getNumberOfTuples(); size_t faceChunkSize = 50000; size_t numMisoReps = 576 * 4; if (totalFaces < faceChunkSize) { faceChunkSize = totalFaces; } // call the sizeGBCD function with proper chunkSize and numMisoReps to get Bins array set up properly sizeGBCD(faceChunkSize, numMisoReps); int32_t totalGBCDBins = m_GbcdSizes[0] * m_GbcdSizes[1] * m_GbcdSizes[2] * m_GbcdSizes[3] * m_GbcdSizes[4] * 2; uint64_t millis = QDateTime::currentMSecsSinceEpoch(); uint64_t currentMillis = millis; uint64_t startMillis = millis; uint64_t estimatedTime = 0; float timeDiff = 0.0f; startMillis = QDateTime::currentMSecsSinceEpoch(); int32_t hemisphere = 0; //create an array to hold the total face area for each phase and initialize the array to 0.0 DoubleArrayType::Pointer totalFaceAreaPtr = DoubleArrayType::CreateArray(totalPhases, "totalFaceArea"); totalFaceAreaPtr->initializeWithValue(0.0); double* totalFaceArea = totalFaceAreaPtr->getPointer(0); QString ss = QObject::tr("Calculating GBCD || 0/%1 Completed").arg(totalFaces); for (size_t i = 0; i < totalFaces; i = i + faceChunkSize) { if(getCancel() == true) { return; } if (i + faceChunkSize >= totalFaces) { faceChunkSize = totalFaces - i; } m_GbcdBinsArray->initializeWithValue(-1); #ifdef SIMPLib_USE_PARALLEL_ALGORITHMS if (doParallel == true) { tbb::parallel_for(tbb::blocked_range<size_t>(i, i + faceChunkSize), CalculateGBCDImpl(i, numMisoReps, m_SurfaceMeshFaceLabelsPtr.lock(), m_SurfaceMeshFaceNormalsPtr.lock(), m_FeatureEulerAnglesPtr.lock(), m_FeaturePhasesPtr.lock(), m_CrystalStructuresPtr.lock(), m_GbcdBinsArray, m_GbcdHemiCheckArray, m_GbcdDeltasArray, m_GbcdSizesArray, m_GbcdLimitsArray), tbb::auto_partitioner()); } else #endif { CalculateGBCDImpl serial(i, numMisoReps, m_SurfaceMeshFaceLabelsPtr.lock(), m_SurfaceMeshFaceNormalsPtr.lock(), m_FeatureEulerAnglesPtr.lock(), m_FeaturePhasesPtr.lock(), m_CrystalStructuresPtr.lock(), m_GbcdBinsArray, m_GbcdHemiCheckArray, m_GbcdDeltasArray, m_GbcdSizesArray, m_GbcdLimitsArray); serial.generate(i, i + faceChunkSize); } currentMillis = QDateTime::currentMSecsSinceEpoch(); if (currentMillis - millis > 1000) { QString ss = QObject::tr("Calculating GBCD || Triangles %1/%2 Completed").arg(i).arg(totalFaces); timeDiff = ((float)i / (float)(currentMillis - startMillis)); estimatedTime = (float)(totalFaces - i) / timeDiff; ss = ss + QObject::tr(" || Est. Time Remain: %1").arg(DREAM3D::convertMillisToHrsMinSecs(estimatedTime)); millis = QDateTime::currentMSecsSinceEpoch(); notifyStatusMessage(getMessagePrefix(), getHumanLabel(), ss); } if(getCancel() == true) { return; } int32_t phase = 0; int32_t feature = 0; double area = 0.0; for (size_t j = 0; j < faceChunkSize; j++) { area = m_SurfaceMeshFaceAreas[i + j]; feature = m_SurfaceMeshFaceLabels[2 * (i + j)]; phase = m_FeaturePhases[feature]; for (size_t k = 0; k < numMisoReps; k++) { if (m_GbcdBins[(j * numMisoReps) + (k)] >= 0) { hemisphere = 0; if (m_HemiCheck[(j * numMisoReps) + k] == false) { hemisphere = 1; } m_GBCD[(phase * totalGBCDBins) + (2 * m_GbcdBins[(j * numMisoReps) + (k)] + hemisphere)] += area; totalFaceArea[phase] += area; } } } } ss = QObject::tr("Starting GBCD Normalization"); notifyStatusMessage(getMessagePrefix(), getHumanLabel(), ss); for (int32_t i = 0; i < totalPhases; i++) { size_t phaseShift = i * totalGBCDBins; double MRDfactor = double(totalGBCDBins) / totalFaceArea[i]; for (int32_t j = 0; j < totalGBCDBins; j++) { m_GBCD[phaseShift + j] *= MRDfactor; } } /* Let the GUI know we are done with this filter */ notifyStatusMessage(getHumanLabel(), "Complete"); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void VisualizeGBCDPoleFigure::execute() { setErrorCondition(0); dataCheck(); if(getErrorCondition() < 0) { return; } // Make sure any directory path is also available as the user may have just typed // in a path without actually creating the full path QFileInfo fi(getOutputFile()); QDir dir(fi.path()); if(!dir.mkpath(".")) { QString ss; ss = QObject::tr("Error creating parent path '%1'").arg(dir.path()); setErrorCondition(-1); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return; } QFile file(getOutputFile()); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { QString ss = QObject::tr("Error opening output file '%1'").arg(getOutputFile()); setErrorCondition(-100); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return; } FloatArrayType::Pointer gbcdDeltasArray = FloatArrayType::CreateArray(5, "GBCDDeltas"); gbcdDeltasArray->initializeWithZeros(); FloatArrayType::Pointer gbcdLimitsArray = FloatArrayType::CreateArray(10, "GBCDLimits"); gbcdLimitsArray->initializeWithZeros(); Int32ArrayType::Pointer gbcdSizesArray = Int32ArrayType::CreateArray(5, "GBCDSizes"); gbcdSizesArray->initializeWithZeros(); float* gbcdDeltas = gbcdDeltasArray->getPointer(0); int* gbcdSizes = gbcdSizesArray->getPointer(0); float* gbcdLimits = gbcdLimitsArray->getPointer(0); // Original Ranges from Dave R. //m_GBCDlimits[0] = 0.0f; //m_GBCDlimits[1] = cosf(1.0f*m_pi); //m_GBCDlimits[2] = 0.0f; //m_GBCDlimits[3] = 0.0f; //m_GBCDlimits[4] = cosf(1.0f*m_pi); //m_GBCDlimits[5] = 2.0f*m_pi; //m_GBCDlimits[6] = cosf(0.0f); //m_GBCDlimits[7] = 2.0f*m_pi; //m_GBCDlimits[8] = 2.0f*m_pi; //m_GBCDlimits[9] = cosf(0.0f); // Greg R. Ranges gbcdLimits[0] = 0.0f; gbcdLimits[1] = 0.0f; gbcdLimits[2] = 0.0f; gbcdLimits[3] = 0.0f; gbcdLimits[4] = 0.0f; gbcdLimits[5] = SIMPLib::Constants::k_PiOver2; gbcdLimits[6] = 1.0f; gbcdLimits[7] = SIMPLib::Constants::k_PiOver2; gbcdLimits[8] = 1.0f; gbcdLimits[9] = SIMPLib::Constants::k_2Pi; // reset the 3rd and 4th dimensions using the square grid approach gbcdLimits[3] = -sqrtf(SIMPLib::Constants::k_PiOver2); gbcdLimits[4] = -sqrtf(SIMPLib::Constants::k_PiOver2); gbcdLimits[8] = sqrtf(SIMPLib::Constants::k_PiOver2); gbcdLimits[9] = sqrtf(SIMPLib::Constants::k_PiOver2); // get num components of GBCD QVector<size_t> cDims = m_GBCDPtr.lock()->getComponentDimensions(); gbcdSizes[0] = cDims[0]; gbcdSizes[1] = cDims[1]; gbcdSizes[2] = cDims[2]; gbcdSizes[3] = cDims[3]; gbcdSizes[4] = cDims[4]; gbcdDeltas[0] = (gbcdLimits[5] - gbcdLimits[0]) / float(gbcdSizes[0]); gbcdDeltas[1] = (gbcdLimits[6] - gbcdLimits[1]) / float(gbcdSizes[1]); gbcdDeltas[2] = (gbcdLimits[7] - gbcdLimits[2]) / float(gbcdSizes[2]); gbcdDeltas[3] = (gbcdLimits[8] - gbcdLimits[3]) / float(gbcdSizes[3]); gbcdDeltas[4] = (gbcdLimits[9] - gbcdLimits[4]) / float(gbcdSizes[4]); float vec[3] = { 0.0f, 0.0f, 0.0f }; float vec2[3] = { 0.0f, 0.0f, 0.0f }; float rotNormal[3] = { 0.0f, 0.0f, 0.0f }; float rotNormal2[3] = { 0.0f, 0.0f, 0.0f }; float sqCoord[2] = { 0.0f, 0.0f }; float dg[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float dgt[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float dg1[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float dg2[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float sym1[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float sym2[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float sym2t[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float mis_euler1[3] = { 0.0f, 0.0f, 0.0f }; float misAngle = m_MisorientationRotation.angle * SIMPLib::Constants::k_PiOver180; float normAxis[3] = { m_MisorientationRotation.h, m_MisorientationRotation.k, m_MisorientationRotation.l }; MatrixMath::Normalize3x1(normAxis); // convert axis angle to matrix representation of misorientation FOrientArrayType om(9, 0.0f); FOrientTransformsType::ax2om(FOrientArrayType(normAxis[0], normAxis[1], normAxis[2], misAngle), om); om.toGMatrix(dg); // take inverse of misorientation variable to use for switching symmetry MatrixMath::Transpose3x3(dg, dgt); // Get our SpaceGroupOps pointer for the selected crystal structure SpaceGroupOps::Pointer orientOps = m_OrientationOps[m_CrystalStructures[m_PhaseOfInterest]]; // get number of symmetry operators int32_t n_sym = orientOps->getNumSymOps(); int32_t xpoints = 100; int32_t ypoints = 100; int32_t zpoints = 1; int32_t xpointshalf = xpoints / 2; int32_t ypointshalf = ypoints / 2; float xres = 2.0f / float(xpoints); float yres = 2.0f / float(ypoints); float zres = (xres + yres) / 2.0; float x = 0.0f, y = 0.0f; float sum = 0; int32_t count = 0; bool nhCheck = false; int32_t hemisphere = 0; int32_t shift1 = gbcdSizes[0]; int32_t shift2 = gbcdSizes[0] * gbcdSizes[1]; int32_t shift3 = gbcdSizes[0] * gbcdSizes[1] * gbcdSizes[2]; int32_t shift4 = gbcdSizes[0] * gbcdSizes[1] * gbcdSizes[2] * gbcdSizes[3]; int64_t totalGBCDBins = gbcdSizes[0] * gbcdSizes[1] * gbcdSizes[2] * gbcdSizes[3] * gbcdSizes[4] * 2; QVector<size_t> dims(1, 1); DoubleArrayType::Pointer poleFigureArray = DoubleArrayType::NullPointer(); poleFigureArray = DoubleArrayType::CreateArray(xpoints * ypoints, dims, "PoleFigure"); poleFigureArray->initializeWithZeros(); double* poleFigure = poleFigureArray->getPointer(0); for (int32_t k = 0; k < ypoints; k++) { for (int32_t l = 0; l < xpoints; l++) { // get (x,y) for stereographic projection pixel x = float(l - xpointshalf) * xres + (xres / 2.0); y = float(k - ypointshalf) * yres + (yres / 2.0); if ((x * x + y * y) <= 1.0) { sum = 0.0f; count = 0; vec[2] = -((x * x + y * y) - 1) / ((x * x + y * y) + 1); vec[0] = x * (1 + vec[2]); vec[1] = y * (1 + vec[2]); MatrixMath::Multiply3x3with3x1(dgt, vec, vec2); // Loop over all the symetry operators in the given cystal symmetry for (int32_t i = 0; i < n_sym; i++) { //get symmetry operator1 orientOps->getMatSymOp(i, sym1); for (int32_t j = 0; j < n_sym; j++) { // get symmetry operator2 orientOps->getMatSymOp(j, sym2); MatrixMath::Transpose3x3(sym2, sym2t); // calculate symmetric misorientation MatrixMath::Multiply3x3with3x3(dg, sym2t, dg1); MatrixMath::Multiply3x3with3x3(sym1, dg1, dg2); // convert to euler angle FOrientArrayType eu(mis_euler1, 3); FOrientTransformsType::om2eu(FOrientArrayType(dg2), eu); if (mis_euler1[0] < SIMPLib::Constants::k_PiOver2 && mis_euler1[1] < SIMPLib::Constants::k_PiOver2 && mis_euler1[2] < SIMPLib::Constants::k_PiOver2) { mis_euler1[1] = cosf(mis_euler1[1]); // find bins in GBCD int32_t location1 = int32_t((mis_euler1[0] - gbcdLimits[0]) / gbcdDeltas[0]); int32_t location2 = int32_t((mis_euler1[1] - gbcdLimits[1]) / gbcdDeltas[1]); int32_t location3 = int32_t((mis_euler1[2] - gbcdLimits[2]) / gbcdDeltas[2]); //find symmetric poles using the first symmetry operator MatrixMath::Multiply3x3with3x1(sym1, vec, rotNormal); //get coordinates in square projection of crystal normal parallel to boundary normal nhCheck = getSquareCoord(rotNormal, sqCoord); // Note the switch to have theta in the 4 slot and cos(Phi) int he 3 slot int32_t location4 = int32_t((sqCoord[0] - gbcdLimits[3]) / gbcdDeltas[3]); int32_t location5 = int32_t((sqCoord[1] - gbcdLimits[4]) / gbcdDeltas[4]); if (location1 >= 0 && location2 >= 0 && location3 >= 0 && location4 >= 0 && location5 >= 0 && location1 < gbcdSizes[0] && location2 < gbcdSizes[1] && location3 < gbcdSizes[2] && location4 < gbcdSizes[3] && location5 < gbcdSizes[4]) { hemisphere = 0; if (nhCheck == false) { hemisphere = 1; } sum += m_GBCD[(m_PhaseOfInterest * totalGBCDBins) + 2 * ((location5 * shift4) + (location4 * shift3) + (location3 * shift2) + (location2 * shift1) + location1) + hemisphere]; count++; } } // again in second crystal reference frame // calculate symmetric misorientation MatrixMath::Multiply3x3with3x3(dgt, sym2, dg1); MatrixMath::Multiply3x3with3x3(sym1, dg1, dg2); // convert to euler angle FOrientTransformsType::om2eu(FOrientArrayType(dg2), eu); if (mis_euler1[0] < SIMPLib::Constants::k_PiOver2 && mis_euler1[1] < SIMPLib::Constants::k_PiOver2 && mis_euler1[2] < SIMPLib::Constants::k_PiOver2) { mis_euler1[1] = cosf(mis_euler1[1]); // find bins in GBCD int32_t location1 = int32_t((mis_euler1[0] - gbcdLimits[0]) / gbcdDeltas[0]); int32_t location2 = int32_t((mis_euler1[1] - gbcdLimits[1]) / gbcdDeltas[1]); int32_t location3 = int32_t((mis_euler1[2] - gbcdLimits[2]) / gbcdDeltas[2]); // find symmetric poles using the first symmetry operator MatrixMath::Multiply3x3with3x1(sym1, vec2, rotNormal2); // get coordinates in square projection of crystal normal parallel to boundary normal nhCheck = getSquareCoord(rotNormal2, sqCoord); // Note the switch to have theta in the 4 slot and cos(Phi) int he 3 slot int32_t location4 = int32_t((sqCoord[0] - gbcdLimits[3]) / gbcdDeltas[3]); int32_t location5 = int32_t((sqCoord[1] - gbcdLimits[4]) / gbcdDeltas[4]); if (location1 >= 0 && location2 >= 0 && location3 >= 0 && location4 >= 0 && location5 >= 0 && location1 < gbcdSizes[0] && location2 < gbcdSizes[1] && location3 < gbcdSizes[2] && location4 < gbcdSizes[3] && location5 < gbcdSizes[4]) { hemisphere = 0; if (nhCheck == false) { hemisphere = 1; } sum += m_GBCD[(m_PhaseOfInterest * totalGBCDBins) + 2 * ((location5 * shift4) + (location4 * shift3) + (location3 * shift2) + (location2 * shift1) + location1) + hemisphere]; count++; } } } } if (count > 0) { poleFigure[(k * xpoints) + l] = sum / float(count); } } } } FILE* f = NULL; f = fopen(m_OutputFile.toLatin1().data(), "wb"); if (NULL == f) { QString ss = QObject::tr("Error opening output file '%1'").arg(m_OutputFile); setErrorCondition(-1); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); return; } // Write the correct header fprintf(f, "# vtk DataFile Version 2.0\n"); fprintf(f, "data set from DREAM3D\n"); fprintf(f, "BINARY"); fprintf(f, "\n"); fprintf(f, "DATASET RECTILINEAR_GRID\n"); fprintf(f, "DIMENSIONS %d %d %d\n", xpoints + 1, ypoints + 1, zpoints + 1); // Write the Coords writeCoords(f, "X_COORDINATES", "float", xpoints + 1, (-float(xpoints)*xres / 2.0f), xres); writeCoords(f, "Y_COORDINATES", "float", ypoints + 1, (-float(ypoints)*yres / 2.0f), yres); writeCoords(f, "Z_COORDINATES", "float", zpoints + 1, (-float(zpoints)*zres / 2.0f), zres); int32_t total = xpoints * ypoints * zpoints; fprintf(f, "CELL_DATA %d\n", total); fprintf(f, "SCALARS %s %s 1\n", "Intensity", "float"); fprintf(f, "LOOKUP_TABLE default\n"); { float* gn = new float[total]; float t; count = 0; for (int32_t j = 0; j < ypoints; j++) { for (int32_t i = 0; i < xpoints; i++) { t = float(poleFigure[(j * xpoints) + i]); SIMPLib::Endian::FromSystemToBig::convert(t); gn[count] = t; count++; } } size_t totalWritten = fwrite(gn, sizeof(float), (total), f); delete[] gn; if (totalWritten != (total)) { QString ss = QObject::tr("Error writing binary VTK data to file '%1'").arg(m_OutputFile); setErrorCondition(-1); notifyErrorMessage(getHumanLabel(), ss, getErrorCondition()); fclose(f); return; } } fclose(f); /* Let the GUI know we are done with this filter */ notifyStatusMessage(getHumanLabel(), "Complete"); }
void generate(size_t start, size_t end) const { // We want to work with the raw pointers for speed so get those pointers. float* m_GBCDdeltas = m_GbcdDeltasArray->getPointer(0); float* m_GBCDlimits = m_GbcdLimitsArray->getPointer(0); int* m_GBCDsizes = m_GbcdSizesArray->getPointer(0); int32_t* m_Bins = m_GbcdBinsArray->getPointer(0); bool* m_HemiCheck = m_GbcdHemiCheckArray->getPointer(0); int32_t* m_Labels = m_LabelsArray->getPointer(0); double* m_Normals = m_NormalsArray->getPointer(0); int32_t* m_Phases = m_PhasesArray->getPointer(0); float* m_Eulers = m_EulersArray->getPointer(0); uint32_t* m_CrystalStructures = m_CrystalStructuresArray->getPointer(0); int32_t j = 0;//, j4; int32_t k = 0;//, k4; int32_t m = 0; int32_t temp = 0; //bool gbcd_indices_good; int32_t feature1 = 0, feature2 = 0; int32_t inversion = 1; float g1ea[3] = { 0.0f, 0.0f, 0.0f }, g2ea[3] = { 0.0f, 0.0f, 0.0f }; float g1[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, g2[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float g1s[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, g2s[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float sym1[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, sym2[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float g2t[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, dg[3][3] = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }; float euler_mis[3] = { 0.0f, 0.0f, 0.0f }; float normal[3] = { 0.0f, 0.0f, 0.0f }; float xstl1_norm1[3] = { 0.0f, 0.0f, 0.0f }; int32_t gbcd_index = 0; float sqCoord[2] = { 0.0f, 0.0f }, sqCoordInv[2] = { 0.0f, 0.0f }; bool nhCheck = false, nhCheckInv = true; int32_t SYMcounter = 0; int64_t TRIcounter = static_cast<int64_t>(start - startOffset); int64_t TRIcounterShift = 0; for (size_t i = start; i < end; i++) { SYMcounter = 0; feature1 = m_Labels[2 * i]; feature2 = m_Labels[2 * i + 1]; normal[0] = m_Normals[3 * i]; normal[1] = m_Normals[3 * i + 1]; normal[2] = m_Normals[3 * i + 2]; if (feature1 < 0 || feature2 < 0) { continue; } if (m_Phases[feature1] == m_Phases[feature2] && m_Phases[feature1] > 0) { TRIcounterShift = (TRIcounter * numEntriesPerTri); uint32_t cryst = m_CrystalStructures[m_Phases[feature1]]; for (int32_t q = 0; q < 2; q++) { if (q == 1) { temp = feature1; feature1 = feature2; feature2 = temp; normal[0] = -normal[0]; normal[1] = -normal[1]; normal[2] = -normal[2]; } for (m = 0; m < 3; m++) { g1ea[m] = m_Eulers[3 * feature1 + m]; g2ea[m] = m_Eulers[3 * feature2 + m]; } FOrientArrayType om(9, 0.0f); FOrientTransformsType::eu2om(FOrientArrayType(g1ea, 3), om); om.toGMatrix(g1); FOrientTransformsType::eu2om(FOrientArrayType(g2ea, 3), om); om.toGMatrix(g2); int32_t nsym = m_OrientationOps[cryst]->getNumSymOps(); for (j = 0; j < nsym; j++) { // rotate g1 by symOp m_OrientationOps[cryst]->getMatSymOp(j, sym1); MatrixMath::Multiply3x3with3x3(sym1, g1, g1s); // get the crystal directions along the triangle normals MatrixMath::Multiply3x3with3x1(g1s, normal, xstl1_norm1); // get coordinates in square projection of crystal normal parallel to boundary normal nhCheck = getSquareCoord(xstl1_norm1, sqCoord); if (inversion == 1) { sqCoordInv[0] = -sqCoord[0]; sqCoordInv[1] = -sqCoord[1]; if (nhCheck == false) { nhCheckInv = true; } else { nhCheckInv = false; } } for (k = 0; k < nsym; k++) { // calculate the symmetric misorienation m_OrientationOps[cryst]->getMatSymOp(k, sym2); // rotate g2 by symOp MatrixMath::Multiply3x3with3x3(sym2, g2, g2s); // transpose rotated g2 MatrixMath::Transpose3x3(g2s, g2t); // calculate delta g MatrixMath::Multiply3x3with3x3(g1s, g2t, dg); // translate matrix to euler angles FOrientArrayType om(dg); FOrientArrayType eu(euler_mis, 3); FOrientTransformsType::om2eu(om, eu); if (euler_mis[0] < SIMPLib::Constants::k_PiOver2 && euler_mis[1] < SIMPLib::Constants::k_PiOver2 && euler_mis[2] < SIMPLib::Constants::k_PiOver2) { // PHI euler angle is stored in GBCD as cos(PHI) euler_mis[1] = cosf(euler_mis[1]); //get the indexes that this point would be in the GBCD histogram gbcd_index = GBCDIndex(m_GBCDdeltas, m_GBCDsizes, m_GBCDlimits, euler_mis, sqCoord); if (gbcd_index != -1) { m_HemiCheck[TRIcounterShift + SYMcounter] = nhCheck; m_Bins[TRIcounterShift + SYMcounter] = gbcd_index; } SYMcounter++; if (inversion == 1) { gbcd_index = GBCDIndex(m_GBCDdeltas, m_GBCDsizes, m_GBCDlimits, euler_mis, sqCoordInv); if (gbcd_index != -1) { m_HemiCheck[TRIcounterShift + SYMcounter] = nhCheckInv; m_Bins[TRIcounterShift + SYMcounter] = gbcd_index; } SYMcounter++; } } else { SYMcounter += 2; } } } } } TRIcounter++; } }