static const jsonrpc::ProcedureValidator& get_procedure() { static const jsonrpc::ProcedureValidator procedure{ jsonrpc::PARAMS_BY_NAME, literals::ComponentNotification::COMPONENT, VALID_UUID, literals::ComponentNotification::NOTIFICATION, VALID_ENUM(agent_framework::model::enums::Notification), literals::ComponentNotification::TYPE, VALID_ENUM(agent_framework::model::enums::Component), literals::ComponentNotification::PARENT, jsonrpc::JSON_STRING, nullptr }; return procedure; }
SurfFitType_e SurfaceFitGetType(const SurfaceFit_pa SurfaceFit) { SurfFitType_e Type = SurfFitType_NoFit; REQUIRE(SurfaceFitIsValid(SurfaceFit)); Type = SurfaceFit->SurfFitType; ENSURE(VALID_ENUM(Type, SurfFitType_e)); return Type; }
/** * For an existing SurfaceFit and independent coordinates, compute the * interpolated value of Var. * * param SurfaceFit * SurfaceFit structure containing the input points for the curve fit. * param SurfFitType * Type of surface fit (NoFit, Planar, Quadratic, etc.).. * * return * Var at Coord1,Coord2 if everything is OK, -LARGEDOUBLE otherwise. */ double SurfaceFitInterpolateVar(SurfaceFit_pa SurfaceFit, double Coord1, double Coord2) { double Result = -LARGEDOUBLE; Boolean_t IsOk = TRUE; REQUIRE(SurfaceFitIsValid(SurfaceFit)); ENSURE(VALID_ENUM(SurfaceFit->SurfFitType, SurfFitType_e)); switch (SurfaceFit->SurfFitType) { case SurfFitType_Quadratic: { double a, b, c, d, e, f; CHECK(SurfaceFitGetCoefCount(SurfaceFit) == 6); if (SurfaceFitGetCoefCount(SurfaceFit) == 6) { a = SurfaceFitGetCoefFromOffset(SurfaceFit, 0); b = SurfaceFitGetCoefFromOffset(SurfaceFit, 1); c = SurfaceFitGetCoefFromOffset(SurfaceFit, 2); d = SurfaceFitGetCoefFromOffset(SurfaceFit, 3); e = SurfaceFitGetCoefFromOffset(SurfaceFit, 4); f = SurfaceFitGetCoefFromOffset(SurfaceFit, 5); Result = a + (b + d * Coord1 + e * Coord2) * Coord1 + (c + f * Coord2) * Coord2; } } break; case SurfFitType_Planar: { double a, b, c; CHECK(SurfaceFitGetCoefCount(SurfaceFit) == 3); if (SurfaceFitGetCoefCount(SurfaceFit) == 3) { a = SurfaceFitGetCoefFromOffset(SurfaceFit, 0); b = SurfaceFitGetCoefFromOffset(SurfaceFit, 1); c = SurfaceFitGetCoefFromOffset(SurfaceFit, 2); Result = a + b * Coord1 + c * Coord2; } } break; case SurfFitType_NoFit: IsOk = FALSE; } ENSURE(VALID_BOOLEAN(IsOk)); return Result; }
/** * Determine if the SurfaceFit handle is sane. * * param SurfaceFit * SurfaceFit structure in question. * * return * TRUE if the SurfaceFit structure is valid, otherwise FALSE. */ Boolean_t SurfaceFitIsValid(SurfaceFit_pa SurfaceFit) { Boolean_t IsValid = FALSE; IsValid = (VALID_REF(SurfaceFit) && VALID_REF(SurfaceFit->Coord1) && ArrListIsValid(SurfaceFit->Coord1) && VALID_REF(SurfaceFit->Coord2) && ArrListIsValid(SurfaceFit->Coord2) && VALID_REF(SurfaceFit->Var) && ArrListIsValid(SurfaceFit->Var)); if (IsValid) IsValid = VALID_ENUM(SurfaceFit->SurfFitType, SurfFitType_e); /* Require the same count for each array list in SurfaceFit structure. */ if (IsValid) { LgIndex_t Count = ArrListGetCount(SurfaceFit->Coord1); IsValid = (ArrListGetCount(SurfaceFit->Coord2) == Count); if (IsValid) IsValid = (ArrListGetCount(SurfaceFit->Var) == Count); } ENSURE(VALID_BOOLEAN(IsValid)); return IsValid; }
return ___2039; } ___372 FileStreamWriter::close(bool ___3361) { return m_fileIOStream.close(___3361); } ___1393 FileStreamWriter::fileLoc() { REQUIRE(___2041()); return m_fileIOStream.fileLoc(); } ___372 FileStreamWriter::___3460() { REQUIRE(___2041()); return m_fileIOStream.___3460(); } ___372 FileStreamWriter::___3459(___1393 fileLoc) { REQUIRE(___2041()); REQUIRE(fileLoc != ___330); return m_fileIOStream.___3459(fileLoc); } ___372 FileStreamWriter::seekToFileEnd() { REQUIRE(___2041()); return m_fileIOStream.seekToFileEnd(); } std::string const& FileStreamWriter::___1394() const { return m_fileIOStream.___1394(); } void FileStreamWriter::___3494(___372 ___2002) { REQUIRE(VALID_BOOLEAN(___2002)); m_fileIOStream.___3494(___2002); } ___372 FileStreamWriter::___2002() const { return m_fileIOStream.___2002(); } void FileStreamWriter::setDataFileType(DataFileType_e ___844) { REQUIRE(VALID_ENUM(___844, DataFileType_e)); m_fileIOStream.setDataFileType(___844); } DataFileType_e FileStreamWriter::___844() const { return m_fileIOStream.___844(); } class FileIOStatistics& FileStreamWriter::statistics() { return m_fileIOStream.statistics(); } size_t FileStreamWriter::fwrite(void const* ___416, size_t size, size_t count) { REQUIRE(___2041()); REQUIRE(VALID_REF(___416)); size_t ___3358 = ::fwrite(___416, size, count, m_fileIOStream.handle());
/** * Compute the surface fit, of requested type, based on the input Coord1, * Coord2, and Var data stored in the SurfaceFit structure. Use a singular * value decomposition to compute the coefficients of the surface fit * equations. * * param SurfaceFit * SurfaceFit structure containing the input points for the curve fit. * param SurfFitType * Type of surface fit (NoFit, Planar, Quadratic, etc.).. * * return * SurfFitType if the surface fit has been computed, SurfFitType_NoFit otherwise. */ Boolean_t SurfaceFitCompute(SurfaceFit_pa SurfaceFit, SurfFitType_e SurfFitType) { Boolean_t IsOk = TRUE; REQUIRE(SurfaceFitIsValid(SurfaceFit)); REQUIRE(VALID_ENUM(SurfFitType, SurfFitType_e)); if (SurfFitType == SurfFitType_NoFit) IsOk = FALSE; // TODO: Add the surface fit if (IsOk) { int i; double wmax = 0.0; double wmin = 0.0; double *b, *x, *w, **a, **v; double r2sum = 0.0; double r2ave = 0.0; double r2min = LARGEFLOAT; switch (SurfFitType) { case SurfFitType_Quadratic: { // Allocate memory for temporary matrices and vectors LgIndex_t NumPoints = SurfaceFitGetPointCount(SurfaceFit); a = SVDAllocMatrix(1, NumPoints, 1, 6); v = SVDAllocMatrix(1, 6, 1, 6); b = SVDAllocVector(1, NumPoints); w = SVDAllocVector(1, NumPoints); x = SVDAllocVector(1, NumPoints); if (a == NULL || b == NULL) IsOk = FALSE; if (!IsOk) break; // Build up the coefficient matrix and RHS vector for (i = 0; i < NumPoints; i++) { double Coord1, Coord2, Var, dc1, dc2; double r2; IsOk = SurfaceFitGetPointFromOffset(SurfaceFit, i, &Coord1, &Coord2, &Var); if (!IsOk) break; dc1 = Coord1; // TODO: make xn - x0; dc2 = Coord2; // TODO: make yn - y0; a[i+1][1] = 1; a[i+1][2] = dc1; a[i+1][3] = dc2; a[i+1][4] = dc1 * dc1; a[i+1][5] = dc1 * dc2; a[i+1][6] = dc2 * dc2; b[i+1] = Var; r2 = dc1 * dc1 + dc2 * dc2; r2sum += r2; if (i == 0) r2min = r2; else r2min = MIN(r2, r2min); } if (!IsOk) break; /* * Scale the rows to by the weighting parameter 1/(r**2/r2ave + 0.1). * Use the fact that dx and dy are stored in the a matrix. */ r2ave = r2sum / (double)NumPoints; for (i = 0; i < NumPoints; i++) { double weight, r2; double dc1 = a[i+1][2]; double dc2 = a[i+1][3]; r2 = dc1 * dc1 + dc2 * dc2; weight = r2ave / (r2 + 0.1 * r2ave); a[i+1][1] = weight * a[i+1][1]; a[i+1][2] = weight * a[i+1][2]; a[i+1][3] = weight * a[i+1][3]; a[i+1][4] = weight * a[i+1][4]; a[i+1][5] = weight * a[i+1][5]; a[i+1][6] = weight * a[i+1][6]; b[i+1] = weight * b[i+1]; } /* Compute the singular value decomposition. */ ComputeSVD(a, NumPoints, 6, w, v); /* If singular values are less than a certain level, set them to zero. */ for (i = 1; i <= 6; i++) if (wmax < w[i]) wmax = w[i]; wmin = 1.0e-6 * wmax; for (i = 1; i <= 6; i++) { if (w[i] < wmin) { w[i] = 0.0; } } /* * Solve the system of equations for the coefficients of * the curve fit. */ BackSubstituteSVD(a, w, v, NumPoints, 6, b, x); // Store coefficients in the SurfaceFit structure for (i = 0; IsOk && i < 6; i++) IsOk = SurfaceFitSetCoefAtOffset(SurfaceFit, i, x[i+1]); // Free temporary matrices SVDFreeMatrix(a, 1, NumPoints, 1, 6); SVDFreeMatrix(v, 1, 6, 1, 6); SVDFreeVector(b, 1, NumPoints); SVDFreeVector(w, 1, NumPoints); SVDFreeVector(x, 1, NumPoints); } break; case SurfFitType_Planar: { // Allocate memory for temporary matrices and vectors LgIndex_t NumPoints = SurfaceFitGetPointCount(SurfaceFit); a = SVDAllocMatrix(1, NumPoints, 1, 3); v = SVDAllocMatrix(1, 3, 1, 3); b = SVDAllocVector(1, NumPoints); w = SVDAllocVector(1, NumPoints); x = SVDAllocVector(1, NumPoints); if (a == NULL || b == NULL) IsOk = FALSE; if (!IsOk) break; // Build up the coefficient matrix and RHS vector for (i = 0; i < NumPoints; i++) { double Coord1, Coord2, Var, dc1, dc2; double r2; IsOk = SurfaceFitGetPointFromOffset(SurfaceFit, i, &Coord1, &Coord2, &Var); if (!IsOk) break; dc1 = Coord1; // TODO: make xn - x0; dc2 = Coord2; // TODO: make yn - y0; a[i+1][1] = 1; a[i+1][2] = dc1; a[i+1][3] = dc2; b[i+1] = Var; r2 = dc1 * dc1 + dc2 * dc2; r2sum += r2; if (i == 0) r2min = r2; else r2min = MIN(r2, r2min); } if (!IsOk) break; /* * Scale the rows to by the weighting parameter 1/(r**2/r2ave + 0.1). * Use the fact that dx and dy are stored in the a matrix. */ r2ave = r2sum / (double)NumPoints; for (i = 0; i < NumPoints; i++) { double weight, r2; double dc1 = a[i+1][2]; double dc2 = a[i+1][3]; r2 = dc1 * dc1 + dc2 * dc2; weight = r2ave / (r2 + 0.1 * r2ave); a[i+1][1] = weight * a[i+1][1]; a[i+1][2] = weight * a[i+1][2]; a[i+1][3] = weight * a[i+1][3]; b[i+1] = weight * b[i+1]; } /* Compute the singular value decomposition. */ ComputeSVD(a, NumPoints, 3, w, v); /* If singular values are less than a certain level, set them to zero. */ for (i = 1; i <= 3; i++) if (wmax < w[i]) wmax = w[i]; wmin = 1.0e-6 * wmax; for (i = 1; i <= 3; i++) { if (w[i] < wmin) { w[i] = 0.0; } } /* * Solve the system of equations for the coefficients of * the curve fit. */ BackSubstituteSVD(a, w, v, NumPoints, 3, b, x); // Store coefficients in the SurfaceFit structure for (i = 0; IsOk && i < 3; i++) IsOk = SurfaceFitSetCoefAtOffset(SurfaceFit, i, x[i+1]); // Free temporary matrices SVDFreeMatrix(a, 1, NumPoints, 1, 3); SVDFreeMatrix(v, 1, 3, 1, 3); SVDFreeVector(b, 1, NumPoints); SVDFreeVector(w, 1, NumPoints); SVDFreeVector(x, 1, NumPoints); } break; } if (IsOk) SurfaceFit->SurfFitType = SurfFitType; } ENSURE(VALID_ENUM(SurfaceFit->SurfFitType, SurfFitType_e)); ENSURE(VALID_BOOLEAN(IsOk)); return IsOk; }