bool CellInitHelper::anyBoundaryNodeTooClose(vector<CVector> &bdryNodes, CVector position) { double MinDistToOtherBdryNodes = globalConfigVars.getConfigValue( "MinDistToBdryNodes").toDouble(); int size = bdryNodes.size(); for (int i = 0; i < size; i++) { if (Modul(bdryNodes[i] - position) < MinDistToOtherBdryNodes) { return true; } } return false; }
bool CellInitHelper::anyECMCenterTooClose(vector<CVector> &ecmCenters, CVector position) { double MinDistToOtherECMCenters = globalConfigVars.getConfigValue( "MinDistToECMCenter").toDouble(); int size = ecmCenters.size(); for (int i = 0; i < size; i++) { if (Modul(ecmCenters[i] - position) < MinDistToOtherECMCenters) { return true; } } return false; }
int main(){ Complex C1, C2, CADD; C1 = cRead(); C2 = cRead(); Complex_Output(C1); Complex_Output(C2); CADD = cAdd(C1, C2); Complex_Output(CADD); Complex_Output(cMul(C1,C2)); printf("\nArg(C1) = %lf", Arg(C1)); printf("\nMODUL(C2) = %lf", Modul(C1)); return 0; }
CVector CVector::getUnitVector(double tolerance) { CVector result; if (fabs(this->GetX()) < tolerance && fabs(this->GetY()) < tolerance && fabs(this->GetZ()) < tolerance) { result = CVector(1, 0, 0); throw UnitVectorCalculationException( "Warning ! two points are too close when calculating unit " "vector of a vector"); } else { result = *this / Modul(*this); } return result; }
Complex cDiv(const Complex C1, const Complex C2){ Complex C; C.Re = (C1.Re*C2.Re + C1.Im*C2.Im)/Modul(C2); C.Im = (C2.Re*C1.Im + C2.Im*C1.Re)/Modul(C2); return C; }