InnerRegion::InnerRegion(int boundarySize, int endpoint1, int endpoint2) : BaseRegion(boundarySize){ this->endpoint1 = endpoint1; this->endpoint2 = endpoint2; // Start without boundary for (int i = 0; i < getBoundarySize(); i++) { removeEdge(i, (i+1)%getBoundarySize()); } }
void FlexBody::writeBodyInfo(std::ofstream * outFile) { // DONE: set type to MESH (alt:GALERKIN), export the connectivity and read it in mknixPost // Implemented 2D; 3D shows strange connectivity when read in mknixpost. // Previous code is use for 3D meshes till fixed. if (Simulation::getDim() == 2) { *outFile << "\t" << "MESH" << " " << this->title << endl; if (bodyPoints.size() == 0) { //regular one domain meshes *outFile << "\t" << "\t" << "NODES " << this->getNode(0)->getNumber() << " " << this->getLastNode()->getNumber() << endl; } else { // multiple domains *outFile << "\t" << "\t" << "NODES " << this->getBodyPoint(0)->getNumber() << " " << this->getLastBodyPoint()->getNumber() << endl; } *outFile << "\t" << "\t" << "CELLS " << this->cells.size() << endl; for (auto& cell : cells) { cell.second->outputConnectivityToFile(outFile); } *outFile << "\n\t" << "END" << "MESH" << endl; } else { // if(itFlexBodies->second->getType() == "MESHFREE"){ // *outFile << "\t" << itFlexBodies->second->getType() << " " *outFile << "\t" << "MESHFREE" << " " << this->title << endl; if (bodyPoints.size() == 0) { //regular one domain meshes *outFile << "\t" << "\t" << "NODES " << this->getNode(0)->getNumber() << " " << this->getLastNode()->getNumber() << endl; } else { // multiple domains *outFile << "\t" << "\t" << "NODES " << this->getBodyPoint(0)->getNumber() << " " << this->getLastBodyPoint()->getNumber() << endl; } //TODO: implement for 3D. For the moment if (Simulation::getDim() == 2) { *outFile << "\t" << "\t" << "BOUNDARY " << getBoundarySize() << endl; if (getBoundarySize() > 0) { int firstNode = getBoundaryFirstNode()->getNumber(); //int actualNode = firstNode; //Point * p_actualNode = getBoundaryFirstNode(); *outFile << "\t" << "\t" << firstNode << " "; // for( int i=1; i<boundary.size(); ++i ) // { // actualNode = p_actualNode->getNumber(); // *outFile << actualNode << " " ; // cout <<actualNode << endl; // p_actualNode = getBoundaryNextNode( p_actualNode ); // } // Following code works only with either MESH or one CELLS file. Testing an alternative below... // for(int i=0; i<getBoundarySize(); ++i){ // p_actualNode = getBoundaryNextNode( p_actualNode ); // actualNode = p_actualNode->getNumber(); for (auto& boundary : linearBoundary) { auto p_actualNode = boundary.second; auto actualNode = p_actualNode->getNumber(); *outFile << actualNode << " "; cout << "BoundaryNextNode: " << actualNode << endl; } // while( actualNode != firstNode ); *outFile << endl;// << "\t" << "\t" << "ENDBOUNDARY" << endl; } } *outFile << "\n\t" << "END" << "MESHFREE" << endl; } // *outFile << "\t" << "END" << itFlexBodies->second->getType() << endl; }