This private function is used by ProcessData to process SP card. It calculate the patch ends from data stored in elementList. The four patch shapes are: NS = 0, Arbitrary patch shape. NS = 1, Rectangular patch shape. NS = 2, Triangular patch shape. NS = 3, Quadrilateral patch shape. Note: NS is stored in element->parameter(1). FIXME ask Gustavo about this (I think I made a mistake while rewritting)!!! Definition at line 399 of file necinput.cpp. References Patch::CalculateMaxModule(), cardsList, CompareModule(), SPCard::getPatchShape(), SPCard::getXCoordinateCorner1(), SPCard::getXCoordinateCorner2(), SCCard::getXCoordinateCorner3(), SCCard::getXCoordinateCorner4(), SPCard::getYCoordinateCorner1(), SPCard::getYCoordinateCorner2(), SCCard::getYCoordinateCorner3(), SCCard::getYCoordinateCorner4(), SPCard::getZCoordinateCorner1(), SPCard::getZCoordinateCorner2(), SCCard::getZCoordinateCorner3(), SCCard::getZCoordinateCorner4(), primitiveList, Patch::SetCardParameter(), Patch::SetEnd1(), Patch::SetEnd2(), Patch::SetEnd3(), Patch::SetEnd4(), and Patch::SetLabel(). Referenced by ProcessData(). { Patch* newPatch; SPCard * spcard = 0; // Patch shape int ns; spcard = (SPCard*)cardsList.at(index); ns = spcard->getPatchShape(); // Patch position. QVector<double> pos; QVector<double> ang; switch(ns) { // Arbitrary patch shape. case 0: // Angle from X axis. double alpha; // Elevation above X-Y plane. double phi; double edge; newPatch = new Patch(); pos.append(spcard->getXCoordinateCorner1()); pos.append(spcard->getYCoordinateCorner1()); pos.append(spcard->getZCoordinateCorner1()); phi = spcard->getXCoordinateCorner2(); alpha = spcard->getYCoordinateCorner2(); // We calculate the patch edge edge = sqrt(spcard->getZCoordinateCorner2()); newPatch = new Patch(); newPatch->SetLabel("SP"); newPatch->SetCardParameter(ns); newPatch->SetEnd1( edge/2, edge/2, 0); newPatch->SetEnd2(-edge/2, edge/2, 0); newPatch->SetEnd3(-edge/2, -edge/2, 0); newPatch->SetEnd4( edge/2, -edge/2, 0); ang.append(0.0); ang.append(-phi-90); ang.append(0.0); newPatch->Rotate(ang); ang.append(0.0); ang.append(0.0); ang.append(alpha); newPatch->Rotate(ang); newPatch->Move(pos); CompareModule(newPatch->CalculateMaxModule()); primitiveList.append(newPatch); break; // Rectangular patch shape. case 1: if((index+1)<cardsList.size()) { // We need the next element. GenericCard * nextCard = 0; nextCard = cardsList.at(index+1); if(nextCard->getCardType() == "SC") { SCCard * sccard = (SCCard*)cardsList.at(index+1); Patch* newPatch; newPatch = new Patch; newPatch->SetLabel("SP"); newPatch->SetCardParameter(ns); newPatch->SetEnd1(spcard->getXCoordinateCorner1(), spcard->getYCoordinateCorner1(), spcard->getZCoordinateCorner1()); newPatch->SetEnd2(spcard->getXCoordinateCorner2(), spcard->getYCoordinateCorner2(), spcard->getZCoordinateCorner2()); newPatch->SetEnd3(sccard->getXCoordinateCorner3(), sccard->getYCoordinateCorner3(), sccard->getZCoordinateCorner3()); /// FIXME ask Gustavo about this (I think I made a mistake while rewritting)!!! newPatch->SetEnd4(spcard->getXCoordinateCorner1() + sccard->getXCoordinateCorner3() - spcard->getXCoordinateCorner2(), spcard->getYCoordinateCorner1() + sccard->getYCoordinateCorner3() - spcard->getXCoordinateCorner2(), spcard->getZCoordinateCorner1() + sccard->getZCoordinateCorner3() - spcard->getZCoordinateCorner2()); /* newPatch->SetEnd4(thisElem->GetParameter(2)+nextElem->GetParameter(2)-thisElem->GetParameter(5), thisElem->GetParameter(3)+nextElem->GetParameter(3)-thisElem->GetParameter(6), thisElem->GetParameter(4)+nextElem->GetParameter(4)-thisElem->GetParameter(7));*/ CompareModule(newPatch->CalculateMaxModule()); primitiveList.append(newPatch); } } break; // Triangular patch shape. case 2: if((index+1)<cardsList.size()) { // We need the next element. GenericCard * nextElem; nextElem = cardsList.at(index+1); if(nextElem->getCardType() == "SC") { SCCard * sccard = (SCCard*)cardsList.at(index+1); Patch* newPatch; newPatch = new Patch; newPatch->SetLabel("SP"); newPatch->SetCardParameter(ns); newPatch->SetEnd1(spcard->getXCoordinateCorner1(), spcard->getYCoordinateCorner1(), spcard->getZCoordinateCorner1()); newPatch->SetEnd2(spcard->getXCoordinateCorner2(), spcard->getYCoordinateCorner2(), spcard->getZCoordinateCorner2()); newPatch->SetEnd3(sccard->getXCoordinateCorner3(), sccard->getYCoordinateCorner3(), sccard->getZCoordinateCorner3()); newPatch->SetEnd4( 0.0, 0.0, 0.0); CompareModule(newPatch->CalculateMaxModule()); primitiveList.append(newPatch); } } break; // Quadrilateral patch shape. case 3: if((index+1)<cardsList.size()) { // We need the next element. GenericCard * nextElem; nextElem = cardsList.at(index+1); if(nextElem->getCardType() == "SC") { SCCard * sccard = (SCCard*)cardsList.at(index+1); Patch* newPatch; newPatch = new Patch; newPatch->SetLabel("SP"); newPatch->SetCardParameter(ns); newPatch->SetEnd1(spcard->getXCoordinateCorner1(), spcard->getYCoordinateCorner1(), spcard->getZCoordinateCorner1()); newPatch->SetEnd2(spcard->getXCoordinateCorner2(), spcard->getYCoordinateCorner2(), spcard->getZCoordinateCorner2()); newPatch->SetEnd3(sccard->getXCoordinateCorner3(), sccard->getYCoordinateCorner3(), sccard->getZCoordinateCorner3()); newPatch->SetEnd4(sccard->getXCoordinateCorner4(), sccard->getYCoordinateCorner4(), sccard->getZCoordinateCorner4()); CompareModule(newPatch->CalculateMaxModule()); primitiveList.append(newPatch); } } break; } }
|