diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 75e58c9525d8da967be1a379a99b62ef146b356d..9e4c57ad5200394172f5803d97560b4823f61f4a 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -174,13 +174,13 @@ void GetOptions(int argc, char *argv[]) } else if(!strcmp(argv[i] + 1, "renumber")) { CTX::instance()->batchAfterMesh = 1; - CTX::instance()->partitionOptions.renumber = 1; + CTX::instance()->partitionOptions.renumber = 1; i++; } else if(!strcmp(argv[i] + 1, "part")) { i++; if(argv[i]){ - CTX::instance()->batchAfterMesh =1 ; + CTX::instance()->batchAfterMesh = 1 ; opt_mesh_partition_num(0, GMSH_SET, atoi(argv[i++])); } else diff --git a/Common/GmshRemote.cpp b/Common/GmshRemote.cpp index 96776ac066dcbe9984b3cdd40f9500a133665644..17f3a35eb36cc10743788a0c835c085af0dfc9d7 100644 --- a/Common/GmshRemote.cpp +++ b/Common/GmshRemote.cpp @@ -89,8 +89,8 @@ static void computeAndSendVertexArrays() (p->getNum(), data->getName(), type + 1, min, max, data->getNumTimeSteps(), data->getTime(opt->timeStep), data->getBoundingBox(), len); - MPI_Send(&len, 1, MPI_INT, 0, MPI_GMSH_VARRAY_LEN, MPI_COMM_WORLD); - MPI_Send(str, len, MPI_CHAR, 0, MPI_GMSH_VARRAY, MPI_COMM_WORLD); + MPI_Send(&len, 1, MPI_INT, 0, MPI_GMSH_VARRAY_LEN, MPI_COMM_WORLD); + MPI_Send(str, len, MPI_CHAR, 0, MPI_GMSH_VARRAY, MPI_COMM_WORLD); delete [] str; } } @@ -188,71 +188,72 @@ int GmshRemote() // stop if we have no communications for 5 minutes int ret = client->Select(300, 0); if(!ret){ - client->Info("Timout: stopping remote Gmsh..."); - break; + client->Info("Timout: stopping remote Gmsh..."); + break; } else if(ret < 0){ - client->Error("Error on select: stopping remote Gmsh..."); - break; + client->Error("Error on select: stopping remote Gmsh..."); + break; } int type, length, swap; if(!client->ReceiveHeader(&type, &length, &swap)){ - client->Error("Did not receive message header: stopping remote Gmsh..."); - break; + client->Error("Did not receive message header: stopping remote Gmsh..."); + break; } char *msg = new char[length + 1]; if(!client->ReceiveString(length, msg)){ - client->Error("Did not receive message body: stopping remote Gmsh..."); - delete [] msg; - break; + client->Error("Did not receive message body: stopping remote Gmsh..."); + delete [] msg; + break; } if(type == GmshSocket::GMSH_STOP){ - client->Info("Stopping remote Gmsh..."); - break; + client->Info("Stopping remote Gmsh..."); + delete [] msg; + break; } else if(type == GmshSocket::GMSH_VERTEX_ARRAY){ ParseString(msg); #if !defined(HAVE_MPI) computeAndSendVertexArrays(client); #else - int mpi_msg = MPI_GMSH_PARSE_STRING; - MPI_Bcast(&mpi_msg, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); - gatherAndSendVertexArrays(client, swap); + int mpi_msg = MPI_GMSH_PARSE_STRING; + MPI_Bcast(&mpi_msg, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); + gatherAndSendVertexArrays(client, swap); #endif } else if(type == GmshSocket::GMSH_MERGE_FILE){ - MergeFile(msg); + MergeFile(msg); #if !defined(HAVE_MPI) - computeAndSendVertexArrays(client); + computeAndSendVertexArrays(client); #else - int mpi_msg = MPI_GMSH_MERGE_FILE; - MPI_Bcast(&mpi_msg, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); - gatherAndSendVertexArrays(client, swap); + int mpi_msg = MPI_GMSH_MERGE_FILE; + MPI_Bcast(&mpi_msg, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); + gatherAndSendVertexArrays(client, swap); #endif } else if(type == GmshSocket::GMSH_PARSE_STRING){ - ParseString(msg); + ParseString(msg); #if defined(HAVE_MPI) - int mpi_msg = MPI_GMSH_PARSE_STRING; - MPI_Bcast(&mpi_msg, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); + int mpi_msg = MPI_GMSH_PARSE_STRING; + MPI_Bcast(&mpi_msg, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); #endif } else if(type == GmshSocket::GMSH_SPEED_TEST){ - client->Info("Sending huge array"); - std::string huge(500000000, 'a'); - client->SpeedTest(huge.c_str()); + client->Info("Sending huge array"); + std::string huge(500000000, 'a'); + client->SpeedTest(huge.c_str()); } else{ - client->Error("Ignoring unknown message"); + client->Error("Ignoring unknown message"); } delete [] msg; @@ -262,22 +263,22 @@ int GmshRemote() int mpi_msg; MPI_Bcast(&mpi_msg, 1, MPI_INT, 0, MPI_COMM_WORLD); if (mpi_msg == MPI_GMSH_COMPUTE_VIEW) - computeAndSendVertexArrays(); + computeAndSendVertexArrays(); else if(mpi_msg == MPI_GMSH_SHUTDOWN) - Msg::Exit(0); + Msg::Exit(0); else if(mpi_msg == MPI_GMSH_PARSE_STRING){ - int length; - MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); - char msg[length]; - MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); - ParseString(msg); + int length; + MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); + char msg[length]; + MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); + ParseString(msg); } else if (mpi_msg == MPI_GMSH_MERGE_FILE){ - int length; - MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); - char msg[length]; - MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); - MergeFile(msg); + int length; + MPI_Bcast(&length, 1, MPI_INT, 0, MPI_COMM_WORLD); + char msg[length]; + MPI_Bcast(msg, length, MPI_CHAR, 0, MPI_COMM_WORLD); + MergeFile(msg); } #endif } diff --git a/Common/VertexArray.cpp b/Common/VertexArray.cpp index c45d601a0342da64c8406b89724ff37b77577136..beb751af077c2ee06db1b72967bdba175b8bee3b 100644 --- a/Common/VertexArray.cpp +++ b/Common/VertexArray.cpp @@ -328,6 +328,6 @@ void VertexArray::merge(VertexArray* va) _normals.insert(_normals.end(), va->firstNormal(), va->lastNormal()); _colors.insert(_colors.end(), va->firstColor(), va->lastColor()); _elements.insert(_elements.end(), va->firstElementPointer(), - va->lastElementPointer()); + va->lastElementPointer()); } } diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp index 3176e529ed5da35aaadda99ba3f771da2d2be738..9bf4bcf55d09841c0452712d0b1527651415e84e 100644 --- a/Fltk/fileDialogs.cpp +++ b/Fltk/fileDialogs.cpp @@ -788,7 +788,7 @@ int mshFileDialog(const char *name) opt_mesh_binary(0, GMSH_SET | GMSH_GUI, (dialog->c->value() == 2) ? 1 : 0); opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value() ? 1 : 0); opt_mesh_save_parametric(0, GMSH_SET | GMSH_GUI, dialog->b[1]->value() ? 1 : 0); - opt_mesh_msh_file_partitioned(0, GMSH_SET | GMSH_GUI, dialog->b[2]->value() ? 1 : 0); + opt_mesh_msh_file_partitioned(0, GMSH_SET | GMSH_GUI, dialog->b[2]->value() ? 1 : 0); CreateOutputFile(name, FORMAT_MSH); dialog->window->hide(); return 1; diff --git a/Fltk/visibilityWindow.cpp b/Fltk/visibilityWindow.cpp index bdfeb78d83cdca92ab5a739aa9af83483ae6bb13..e761daa3cf8b17f897b35aaa6b326f09971473c4 100644 --- a/Fltk/visibilityWindow.cpp +++ b/Fltk/visibilityWindow.cpp @@ -475,7 +475,7 @@ static void _add_region(GRegion *gr, Fl_Tree *tree, std::string path) } static void _add_physical_group(int dim, int num, std::vector<GEntity*> &ge, - std::map<int, std::string> &oldLabels, + std::map<int, std::string> &oldLabels, Fl_Tree *tree, std::string path) { if(ge.empty()) return; diff --git a/Geo/Cell.cpp b/Geo/Cell.cpp index c0a27460b719eba5f6d3f918d13c99722f2db0ac..a7a63fdbd3c3e2a14f640bbb3cfcefafb362b558 100755 --- a/Geo/Cell.cpp +++ b/Geo/Cell.cpp @@ -59,8 +59,8 @@ bool Cell::findBoundaryCells(std::vector<Cell*>& bdCells) if(type == TYPE_TET) newtype = MSH_TRI_3; else if(type == TYPE_HEX) newtype = MSH_QUA_4; else if(type == TYPE_PRI) { - if(vertices.size() == 3) newtype = MSH_TRI_3; - else if(vertices.size() == 4) newtype = MSH_QUA_4; + if(vertices.size() == 3) newtype = MSH_TRI_3; + else if(vertices.size() == 4) newtype = MSH_QUA_4; } } else if(_dim == 2) newtype = MSH_LIN_2; @@ -70,7 +70,7 @@ bool Cell::findBoundaryCells(std::vector<Cell*>& bdCells) return false; } MElement* element = factory.create(newtype, vertices, 0, - _image->getPartition()); + _image->getPartition()); Cell* cell = new Cell(element); bdCells.push_back(cell); } @@ -143,7 +143,7 @@ int Cell::getFacetOri(Cell* cell) bool Cell::hasVertex(int vertex) const { std::vector<int>::const_iterator it = std::find(_vs.begin(), _vs.end(), - vertex); + vertex); if (it != _vs.end()) return true; else return false; } @@ -168,7 +168,7 @@ void Cell::restoreCell(){ } void Cell::addBoundaryCell(int orientation, Cell* cell, - bool orig, bool other) + bool orig, bool other) { if(orig) _obd.insert( std::make_pair(cell, orientation ) ); biter it = _bd.find(cell); @@ -186,7 +186,7 @@ void Cell::addBoundaryCell(int orientation, Cell* cell, } void Cell::addCoboundaryCell(int orientation, Cell* cell, - bool orig, bool other) + bool orig, bool other) { if(orig) _ocbd.insert( std::make_pair(cell, orientation ) ); biter it = _cbd.find(cell); @@ -332,7 +332,7 @@ CombinedCell::CombinedCell(Cell* c1, Cell* c2, bool orMatch, bool co) : Cell() if(co){ biter it2 = c1Boundary.find(cell); if(it2 == c1Boundary.end()){ - this->addBoundaryCell(ori, cell, false, true); + this->addBoundaryCell(ori, cell, false, true); } } else this->addBoundaryCell(ori, cell, false, true); @@ -358,7 +358,7 @@ CombinedCell::CombinedCell(Cell* c1, Cell* c2, bool orMatch, bool co) : Cell() if(!co){ biter it2 = c1Coboundary.find(cell); if(it2 == c1Coboundary.end()){ - this->addCoboundaryCell(ori, cell, false, true); + this->addCoboundaryCell(ori, cell, false, true); } } else this->addCoboundaryCell(ori, cell, false, true); diff --git a/Geo/Cell.h b/Geo/Cell.h index 27d2002834b35fe4f88b6664f70602042fb397c1..3750a5ae4c5123551d1cdbed918ee97cfae32312 100644 --- a/Geo/Cell.h +++ b/Geo/Cell.h @@ -136,17 +136,17 @@ class Cell // get the cell boundary virtual void getBoundary(std::map<Cell*, int, Less_Cell >& boundary, - bool orig=false){ + bool orig=false){ orig ? boundary = _obd : boundary = _bd; } virtual void getCoboundary(std::map<Cell*, int, Less_Cell >& coboundary, - bool orig=false){ + bool orig=false){ orig ? coboundary = _ocbd : coboundary = _cbd; } // add (co)boundary cell virtual void addBoundaryCell(int orientation, Cell* cell, - bool orig=false, bool other=true); + bool orig=false, bool other=true); virtual void addCoboundaryCell(int orientation, Cell* cell, - bool orig=false, bool other=true); + bool orig=false, bool other=true); // remove (co)boundary cell virtual void removeBoundaryCell(Cell* cell, bool other=true); @@ -180,7 +180,7 @@ class Cell } for(int i=0; i < this->getNumSortedVertices();i++){ if(this->getSortedVertex(i) != c2.getSortedVertex(i)){ - return false; + return false; } } return true; diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp index 143032694b0b54a9049152d47bb2f9257605e3f5..c85982e77fb5fb3bfa5926eb9473675e0ea3dabf 100644 --- a/Geo/CellComplex.cpp +++ b/Geo/CellComplex.cpp @@ -10,7 +10,7 @@ #if defined(HAVE_KBIPACK) CellComplex::CellComplex( std::vector<MElement*>& domainElements, - std::vector<MElement*>& subdomainElements) + std::vector<MElement*>& subdomainElements) { _dim = 0; _simplicial = true; @@ -41,7 +41,7 @@ void CellComplex::panic_exit(){ } bool CellComplex::insert_cells(std::vector<MElement*>& elements, - bool subdomain) + bool subdomain) { // add highest dimensional cells for(unsigned int i=0; i < elements.size(); i++){ @@ -49,7 +49,7 @@ bool CellComplex::insert_cells(std::vector<MElement*>& elements, int type = element->getType(); if(_simplicial && !(type == TYPE_PNT || type == TYPE_LIN - || type == TYPE_TRI || type == TYPE_TET) ){ + || type == TYPE_TRI || type == TYPE_TET) ){ _simplicial = false; } //FIXME: no getFaceInfo methods for these MElements @@ -70,19 +70,19 @@ bool CellComplex::insert_cells(std::vector<MElement*>& elements, std::vector<Cell*> bdCells; if(!cell->findBoundaryCells(bdCells)) return false; for(unsigned int i = 0; i < bdCells.size(); i++){ - Cell* newCell = bdCells.at(i); - newCell->setInSubdomain(subdomain); - newCell->setDeleteImage(true); - std::pair<citer, bool> insertInfo = - _cells[newCell->getDim()].insert(newCell); - if(!insertInfo.second){ // the cell was already in the cell complex - delete newCell; - newCell = *(insertInfo.first); - } - if(!subdomain) { - int ori = cell->getFacetOri(newCell); - cell->addBoundaryCell( ori, newCell, true, true); - } + Cell* newCell = bdCells.at(i); + newCell->setInSubdomain(subdomain); + newCell->setDeleteImage(true); + std::pair<citer, bool> insertInfo = + _cells[newCell->getDim()].insert(newCell); + if(!insertInfo.second){ // the cell was already in the cell complex + delete newCell; + newCell = *(insertInfo.first); + } + if(!subdomain) { + int ori = cell->getFacetOri(newCell); + cell->addBoundaryCell( ori, newCell, true, true); + } } } } @@ -133,14 +133,14 @@ void CellComplex::removeCell(Cell* cell, bool other) } void CellComplex::removeCellQset(Cell* cell, - std::set<Cell*, Less_Cell>& Qset) + std::set<Cell*, Less_Cell>& Qset) { Qset.erase(cell); } void CellComplex::enqueueCells(std::map<Cell*, int, Less_Cell>& cells, - std::queue<Cell*>& Q, - std::set<Cell*, Less_Cell>& Qset) + std::queue<Cell*>& Q, + std::set<Cell*, Less_Cell>& Qset) { for(std::map<Cell*, int, Less_Cell>::iterator cit = cells.begin(); cit != cells.end(); cit++){ @@ -180,7 +180,7 @@ int CellComplex::coreduction(Cell* startCell, int omitted) enqueueCells(cbd_c, Q, Qset); removeCell(bd_s.begin()->first); if(bd_s.begin()->first->getDim() == 0 && omitted > 0){ - _store.at(omitted-1).insert(bd_s.begin()->first); + _store.at(omitted-1).insert(bd_s.begin()->first); } coreductions++; } @@ -207,15 +207,15 @@ int CellComplex::reduction(int dim, int omitted) while(cit != lastCell(dim-1)){ Cell* cell = *cit; if( cell->getCoboundarySize() == 1 - && inSameDomain(cell, cell->firstCoboundary()->first)){ - ++cit; - if(dim == getDim() && omitted > 0){ - _store.at(omitted-1).insert(cell->firstCoboundary()->first); - } - removeCell(cell->firstCoboundary()->first); - removeCell(cell); - count++; - reduced = true; + && inSameDomain(cell, cell->firstCoboundary()->first)){ + ++cit; + if(dim == getDim() && omitted > 0){ + _store.at(omitted-1).insert(cell->firstCoboundary()->first); + } + removeCell(cell->firstCoboundary()->first); + removeCell(cell); + count++; + reduced = true; } if(getSize(dim) == 0 || getSize(dim-1) == 0) break; @@ -242,9 +242,9 @@ int CellComplex::coreduction(int dim, int omitted) if( cell->getBoundarySize() == 1 && inSameDomain(cell, cell->firstBoundary()->first)){ ++cit; - if(dim-1 == 0 && omitted > 0){ - _store.at(omitted-1).insert(cell->firstBoundary()->first); - } + if(dim-1 == 0 && omitted > 0){ + _store.at(omitted-1).insert(cell->firstBoundary()->first); + } removeCell(cell->firstBoundary()->first); removeCell(cell); count++; @@ -261,7 +261,7 @@ int CellComplex::coreduction(int dim, int omitted) int CellComplex::reduceComplex(bool omit) { printf("Cell Complex: \n %d volumes, %d faces, %d edges and %d vertices. \n", - getSize(3), getSize(2), getSize(1), getSize(0)); + getSize(3), getSize(2), getSize(1), getSize(0)); int count = 0; for(int i = 3; i > 0; i--) count = count + reduction(i); @@ -296,7 +296,7 @@ int CellComplex::reduceComplex(bool omit) combine(1); printf(" %d volumes, %d faces, %d edges and %d vertices. \n", - getSize(3), getSize(2), getSize(1), getSize(0)); + getSize(3), getSize(2), getSize(1), getSize(0)); return 0; } @@ -316,7 +316,7 @@ void CellComplex::removeSubdomain() int CellComplex::coreduceComplex(bool omit) { printf("Cell Complex: \n %d volumes, %d faces, %d edges and %d vertices. \n", - getSize(3), getSize(2), getSize(1), getSize(0)); + getSize(3), getSize(2), getSize(1), getSize(0)); int count = 0; removeSubdomain(); @@ -349,7 +349,7 @@ int CellComplex::coreduceComplex(bool omit) } printf(" %d volumes, %d faces, %d edges and %d vertices. \n", - getSize(3), getSize(2), getSize(1), getSize(0)); + getSize(3), getSize(2), getSize(1), getSize(0)); cocombine(0); coreduction(1); @@ -360,7 +360,7 @@ int CellComplex::coreduceComplex(bool omit) coherent(); printf(" %d volumes, %d faces, %d edges and %d vertices. \n", - getSize(3), getSize(2), getSize(1), getSize(0)); + getSize(3), getSize(2), getSize(1), getSize(0)); return omitted; } @@ -385,7 +385,7 @@ int CellComplex::cocombine(int dim) Cell* s = Q.front(); Q.pop(); if(s->getBoundarySize() == 2){ - Cell::biter it = s->firstBoundary(); + Cell::biter it = s->firstBoundary(); int or1 = (*it).second; Cell* c1 = (*it).first; it++; @@ -395,10 +395,10 @@ int CellComplex::cocombine(int dim) if(!(*c1 == *c2) && abs(or1) == abs(or2) && inSameDomain(s, c1) && inSameDomain(s, c2) && c1->getNumSortedVertices() < getSize(dim) - // heuristics for mammoth cell birth control + // heuristics for mammoth cell birth control && c2->getNumSortedVertices() < getSize(dim)){ - removeCell(s); + removeCell(s); c1->getCoboundary(cbd_c); enqueueCells(cbd_c, Q, Qset); @@ -406,7 +406,7 @@ int CellComplex::cocombine(int dim) enqueueCells(cbd_c, Q, Qset); CombinedCell* newCell = new CombinedCell(c1, c2, - (or1 != or2), true ); + (or1 != or2), true ); removeCell(c1); removeCell(c2); insertCell(newCell); @@ -447,7 +447,7 @@ int CellComplex::combine(int dim) Q.pop(); if(s->getCoboundarySize() == 2){ - Cell::biter it = s->firstCoboundary(); + Cell::biter it = s->firstCoboundary(); int or1 = (*it).second; Cell* c1 = (*it).first; it++; @@ -457,7 +457,7 @@ int CellComplex::combine(int dim) if(!(*c1 == *c2) && abs(or1) == abs(or2) && inSameDomain(s, c1) && inSameDomain(s, c2) && c1->getNumSortedVertices() < getSize(dim) - // heuristics for mammoth cell birth control + // heuristics for mammoth cell birth control && c2->getNumSortedVertices() < getSize(dim)){ removeCell(s); @@ -471,7 +471,7 @@ int CellComplex::combine(int dim) removeCell(c1); removeCell(c2); insertCell(newCell); - + cit = firstCell(dim); count++; } @@ -495,18 +495,18 @@ bool CellComplex::coherent() std::map<Cell*, int, Less_Cell> boundary; cell->getBoundary(boundary); for(Cell::biter it = boundary.begin(); - it != boundary.end(); it++){ + it != boundary.end(); it++){ Cell* bdCell = (*it).first; int ori = (*it).second; citer cit = _cells[bdCell->getDim()].find(bdCell); if(cit == lastCell(bdCell->getDim())){ - printf("Warning! Boundary cell not in cell complex! Boundary removed. \n"); + printf("Warning! Boundary cell not in cell complex! Boundary removed. \n"); cell->removeBoundaryCell(bdCell); coherent = false; } if(!bdCell->hasCoboundary(cell)){ printf("Warning! Incoherent boundary/coboundary pair! Fixed. \n"); - bdCell->addCoboundaryCell(ori, cell, false, false); + bdCell->addCoboundaryCell(ori, cell, false, false); coherent = false; } @@ -514,18 +514,18 @@ bool CellComplex::coherent() std::map<Cell*, int, Less_Cell> coboundary; cell->getCoboundary(coboundary); for(Cell::biter it = coboundary.begin(); - it != coboundary.end(); it++){ + it != coboundary.end(); it++){ Cell* cbdCell = (*it).first; int ori = (*it).second; citer cit = _cells[cbdCell->getDim()].find(cbdCell); if(cit == lastCell(cbdCell->getDim())){ printf("Warning! Coboundary cell not in cell complex! Coboundary removed. \n"); - cell->removeCoboundaryCell(cbdCell); + cell->removeCoboundaryCell(cbdCell); coherent = false; } if(!cbdCell->hasBoundary(cell)){ printf("Warning! Incoherent coboundary/boundary pair! Fixed. \n"); - cbdCell->addBoundaryCell(ori, cell, false, false); + cbdCell->addBoundaryCell(ori, cell, false, false); coherent = false; } @@ -546,12 +546,12 @@ bool CellComplex::hasCell(Cell* cell, bool orig) } void CellComplex::getCells(std::set<Cell*, Less_Cell>& cells, - int dim, int domain){ + int dim, int domain){ cells.clear(); for(citer cit = firstCell(dim); cit != lastCell(dim); cit++){ Cell* cell = *cit; if( (domain == 0 && !cell->inSubdomain()) || domain == 1 - || (domain == 2 && cell->inSubdomain()) ){ + || (domain == 2 && cell->inSubdomain()) ){ cells.insert(cell); } } diff --git a/Geo/CellComplex.h b/Geo/CellComplex.h index a801d1f9281fa219dcf7892442a169bf76e2ccb5..ae6ced80e378880da21b28b0da12ecaec9a2021e 100644 --- a/Geo/CellComplex.h +++ b/Geo/CellComplex.h @@ -48,7 +48,7 @@ class CellComplex // enqueue cells in queue if they are not there already void enqueueCells(std::map<Cell*, int, Less_Cell>& cells, - std::queue<Cell*>& Q, std::set<Cell*, Less_Cell>& Qset); + std::queue<Cell*>& Q, std::set<Cell*, Less_Cell>& Qset); // remove cell from the queue set void removeCellQset(Cell* cell, std::set<Cell*, Less_Cell>& Qset); @@ -66,7 +66,7 @@ class CellComplex public: CellComplex( std::vector<MElement*>& domainElements, - std::vector<MElement*>& subdomainElements); + std::vector<MElement*>& subdomainElements); ~CellComplex(); // get the number of certain dimensional cells @@ -99,7 +99,7 @@ class CellComplex // check whether two cells both belong to subdomain or if neither one does bool inSameDomain(Cell* c1, Cell* c2) const { return ( (!c1->inSubdomain() && !c2->inSubdomain()) - || (c1->inSubdomain() && c2->inSubdomain() )); } + || (c1->inSubdomain() && c2->inSubdomain() )); } // remove cells in subdomain from this cell complex void removeSubdomain(); diff --git a/Geo/ChainComplex.cpp b/Geo/ChainComplex.cpp index 21f722e307ad6691ce7453e60b80c9646052968f..c65b079c99056fbb7eedc26a461af33b755cdd4f 100644 --- a/Geo/ChainComplex.cpp +++ b/Geo/ChainComplex.cpp @@ -30,32 +30,32 @@ ChainComplex::ChainComplex(CellComplex* cellComplex, int domain) int index = 1; // ignore cells depending on domain for(CellComplex::citer cit = cellComplex->firstCell(dim); - cit != cellComplex->lastCell(dim); cit++){ + cit != cellComplex->lastCell(dim); cit++){ Cell* cell = *cit; cell->setIndex(0); cols--; if((domain == 0 && !cell->inSubdomain()) - || (domain == 2 && cell->inSubdomain()) ){ + || (domain == 2 && cell->inSubdomain()) ){ cols++; - cell->setIndex(index); - index++; - _cellIndices[dim][cell->getIndex()] = cell; + cell->setIndex(index); + index++; + _cellIndices[dim][cell->getIndex()] = cell; } } index = 1; if(dim > 0){ for(CellComplex::citer cit = cellComplex->firstCell(dim-1); - cit != cellComplex->lastCell(dim-1); cit++){ + cit != cellComplex->lastCell(dim-1); cit++){ Cell* cell = *cit; - cell->setIndex(0); - rows--; - if((domain == 0 && !cell->inSubdomain()) - || (domain == 2 && cell->inSubdomain()) ){ - rows++; - cell->setIndex(index); - index++; - _cellIndices[dim-1][cell->getIndex()] = cell; - } + cell->setIndex(0); + rows--; + if((domain == 0 && !cell->inSubdomain()) + || (domain == 2 && cell->inSubdomain()) ){ + rows++; + cell->setIndex(index); + index++; + _cellIndices[dim-1][cell->getIndex()] = cell; + } } } @@ -73,34 +73,34 @@ ChainComplex::ChainComplex(CellComplex* cellComplex, int domain) mpz_init(elem); _HMatrix[dim] = create_gmp_matrix_zero(rows, cols); for( std::set<Cell*, Less_Cell>::iterator cit = - cellComplex->firstCell(dim); - cit != cellComplex->lastCell(dim); cit++){ + cellComplex->firstCell(dim); + cit != cellComplex->lastCell(dim); cit++){ Cell* cell = *cit; if( (domain == 0 && !cell->inSubdomain()) || domain == 1 - || (domain == 2 && cell->inSubdomain()) ){ + || (domain == 2 && cell->inSubdomain()) ){ for(Cell::biter it = cell->firstBoundary(); - it != cell->lastBoundary(); it++){ + it != cell->lastBoundary(); it++){ Cell* bdCell = (*it).first; if((domain == 0 && !bdCell->inSubdomain()) || domain == 1 - || (domain == 2 && cell->inSubdomain()) ){ + || (domain == 2 && cell->inSubdomain()) ){ int old_elem = 0; if(bdCell->getIndex() > (int)gmp_matrix_rows( _HMatrix[dim]) - || bdCell->getIndex() < 1 + || bdCell->getIndex() < 1 || cell->getIndex() > (int)gmp_matrix_cols( _HMatrix[dim]) - || cell->getIndex() < 1){ + || cell->getIndex() < 1){ //printf("Warning: Index out of bound! HMatrix: %d. \n", dim); } else{ gmp_matrix_get_elem(elem, bdCell->getIndex(), - cell->getIndex(), _HMatrix[dim]); + cell->getIndex(), _HMatrix[dim]); old_elem = mpz_get_si(elem); mpz_set_si(elem, old_elem + (*it).second); if( abs((old_elem + (*it).second)) > 1){ - //printf("Incidence index: %d, in HMatrix: %d. \n", (old_elem + (*it).second), dim); + //printf("Incidence index: %d, in HMatrix: %d. \n", (old_elem + (*it).second), dim); } gmp_matrix_set_elem(elem, bdCell->getIndex(), - cell->getIndex(), _HMatrix[dim]); + cell->getIndex(), _HMatrix[dim]); } } } @@ -125,8 +125,8 @@ void ChainComplex::KerCod(int dim) gmp_matrix* HMatrix = copy_gmp_matrix(_HMatrix[dim], 1, 1, - gmp_matrix_rows(_HMatrix[dim]), - gmp_matrix_cols(_HMatrix[dim])); + gmp_matrix_rows(_HMatrix[dim]), + gmp_matrix_cols(_HMatrix[dim])); gmp_normal_form* normalForm = create_gmp_Hermite_normal_form(HMatrix, NOT_INVERTED, INVERTED); @@ -135,7 +135,7 @@ void ChainComplex::KerCod(int dim) //printMatrix(normalForm->right); int minRowCol = std::min(gmp_matrix_rows(normalForm->canonical), - gmp_matrix_cols(normalForm->canonical)); + gmp_matrix_cols(normalForm->canonical)); int rank = 0; mpz_t elem; mpz_init(elem); @@ -150,14 +150,14 @@ void ChainComplex::KerCod(int dim) if(rank != (int)gmp_matrix_cols(normalForm->canonical)){ _kerH[dim] = copy_gmp_matrix(normalForm->right, 1, rank+1, - gmp_matrix_rows(normalForm->right), - gmp_matrix_cols(normalForm->right)); + gmp_matrix_rows(normalForm->right), + gmp_matrix_cols(normalForm->right)); } if(rank > 0){ _codH[dim] = copy_gmp_matrix(normalForm->canonical, 1, 1, - gmp_matrix_rows(normalForm->canonical), rank); + gmp_matrix_rows(normalForm->canonical), rank); gmp_matrix_left_mult(normalForm->left, _codH[dim]); } @@ -176,12 +176,12 @@ void ChainComplex::Inclusion(int lowDim, int highDim) gmp_matrix* Zbasis = copy_gmp_matrix(_kerH[lowDim], 1, 1, - gmp_matrix_rows(_kerH[lowDim]), - gmp_matrix_cols(_kerH[lowDim])); + gmp_matrix_rows(_kerH[lowDim]), + gmp_matrix_cols(_kerH[lowDim])); gmp_matrix* Bbasis = copy_gmp_matrix(_codH[highDim], 1, 1, - gmp_matrix_rows(_codH[highDim]), - gmp_matrix_cols(_codH[highDim])); + gmp_matrix_rows(_codH[highDim]), + gmp_matrix_cols(_codH[highDim])); int rows = gmp_matrix_rows(Bbasis); @@ -211,8 +211,8 @@ void ChainComplex::Inclusion(int lowDim, int highDim) gmp_matrix_left_mult(normalForm->left, Bbasis); gmp_matrix* LB = copy_gmp_matrix(Bbasis, 1, 1, - gmp_matrix_cols(Zbasis), - gmp_matrix_cols(Bbasis)); + gmp_matrix_cols(Zbasis), + gmp_matrix_cols(Bbasis)); destroy_gmp_matrix(Bbasis); rows = gmp_matrix_rows(LB); @@ -255,8 +255,8 @@ void ChainComplex::Quotient(int dim) gmp_matrix* JMatrix = copy_gmp_matrix(_JMatrix[dim], 1, 1, - gmp_matrix_rows(_JMatrix[dim]), - gmp_matrix_cols(_JMatrix[dim])); + gmp_matrix_rows(_JMatrix[dim]), + gmp_matrix_cols(_JMatrix[dim])); int rows = gmp_matrix_rows(JMatrix); int cols = gmp_matrix_cols(JMatrix); @@ -321,13 +321,13 @@ void ChainComplex::computeHomology(bool dual) && gmp_matrix_cols(getHMatrix(lowDim)) > 0 && getHMatrix(highDim) == NULL) { setHbasis( setDim, - create_gmp_matrix_identity(gmp_matrix_cols(getHMatrix(lowDim))) ); + create_gmp_matrix_identity(gmp_matrix_cols(getHMatrix(lowDim))) ); } else if(highDim == 0 && dual - && gmp_matrix_rows(getHMatrix(highDim)) > 0 - && getHMatrix(lowDim) == NULL) { + && gmp_matrix_rows(getHMatrix(highDim)) > 0 + && getHMatrix(lowDim) == NULL) { setHbasis( setDim, - create_gmp_matrix_identity(gmp_matrix_rows(getHMatrix(highDim))) ); + create_gmp_matrix_identity(gmp_matrix_rows(getHMatrix(highDim))) ); } // 2) this dimension is empty @@ -337,9 +337,9 @@ void ChainComplex::computeHomology(bool dual) // 3) No higher dimension cells -> none of the cycles are boundaries else if(getHMatrix(highDim) == NULL){ setHbasis( setDim, - copy_gmp_matrix(getKerHMatrix(lowDim), 1, 1, - gmp_matrix_rows(getKerHMatrix(lowDim)), - gmp_matrix_cols(getKerHMatrix(lowDim))) ); + copy_gmp_matrix(getKerHMatrix(lowDim), 1, 1, + gmp_matrix_rows(getKerHMatrix(lowDim)), + gmp_matrix_cols(getKerHMatrix(lowDim))) ); } @@ -352,25 +352,25 @@ void ChainComplex::computeHomology(bool dual) // 4) No lower dimension cells -> all chains are cycles if(getHMatrix(lowDim) == NULL){ setKerHMatrix(lowDim, - create_gmp_matrix_identity(gmp_matrix_rows(getHMatrix(highDim))) ); + create_gmp_matrix_identity(gmp_matrix_rows(getHMatrix(highDim))) ); } Inclusion(lowDim, highDim); Quotient(lowDim); if(getCodHMatrix(highDim) == NULL){ setHbasis(setDim, - copy_gmp_matrix(getKerHMatrix(lowDim), 1, 1, - gmp_matrix_rows(getKerHMatrix(lowDim)), - gmp_matrix_cols(getKerHMatrix(lowDim))) ); + copy_gmp_matrix(getKerHMatrix(lowDim), 1, 1, + gmp_matrix_rows(getKerHMatrix(lowDim)), + gmp_matrix_cols(getKerHMatrix(lowDim))) ); } else if(getJMatrix(lowDim) == NULL || getQMatrix(lowDim) == NULL){ setHbasis(setDim, NULL); } else{ setHbasis(setDim, - copy_gmp_matrix(getKerHMatrix(lowDim), 1, 1, - gmp_matrix_rows(getKerHMatrix(lowDim)), - gmp_matrix_cols(getKerHMatrix(lowDim))) ); + copy_gmp_matrix(getKerHMatrix(lowDim), 1, 1, + gmp_matrix_rows(getKerHMatrix(lowDim)), + gmp_matrix_cols(getKerHMatrix(lowDim))) ); gmp_matrix_right_mult(getHbasis(setDim), getQMatrix(lowDim)); } @@ -434,7 +434,7 @@ std::vector<int> ChainComplex::getCoeffVector(int dim, int chainNumber) } void ChainComplex::getChain(std::map<Cell*, int, Less_Cell>& chain, - int dim, int chainNumber) + int dim, int chainNumber) { chain.clear(); if(dim < 0 || dim > 4) return; @@ -461,7 +461,7 @@ void ChainComplex::getChain(std::map<Cell*, int, Less_Cell>& chain, std::list< std::pair<int, Cell*> > subCells; cell->getCells(subCells); for(std::list< std::pair<int, Cell*> >::iterator it = - subCells.begin(); it != subCells.end(); it++){ + subCells.begin(); it != subCells.end(); it++){ Cell* subCell = (*it).second; int coeff = (*it).first; chain[subCell] = coeff*elemi; diff --git a/Geo/ChainComplex.h b/Geo/ChainComplex.h index 4c5ebece479808e1c142a8aa6a1d0ad65ad9289f..ef2308128e8b82c9285c2e803fd45b76c67debb9 100644 --- a/Geo/ChainComplex.h +++ b/Geo/ChainComplex.h @@ -137,7 +137,7 @@ class ChainComplex{ int printMatrix(gmp_matrix* matrix){ printf("%d rows and %d columns\n", - (int)gmp_matrix_rows(matrix), (int)gmp_matrix_cols(matrix)); + (int)gmp_matrix_rows(matrix), (int)gmp_matrix_cols(matrix)); return gmp_matrix_printf(matrix); } // debugging aid diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp index 012c4cd8a5e8e57ef663df76429bf736c27e07c5..03c2f109e0808e9ef4969a9529f2de71c69bf8e6 100644 --- a/Geo/GFaceCompound.cpp +++ b/Geo/GFaceCompound.cpp @@ -47,8 +47,8 @@ static void fixEdgeToValue(GEdge *ed, double value, dofManager<double> &myAssemb //-------------------------------------------------------------- static int intersection_segments (SPoint3 &p1, SPoint3 &p2, - SPoint3 &q1, SPoint3 &q2, - double x[2]){ + SPoint3 &q1, SPoint3 &q2, + double x[2]){ double xp_max = std::max(p1.x(),p2.x()); @@ -74,7 +74,7 @@ static int intersection_segments (SPoint3 &p1, SPoint3 &p2, sys2x2(A,b,x); return (x[0] >= 0.0 && x[0] <= 1. && - x[1] >= 0.0 && x[1] <= 1.); + x[1] >= 0.0 && x[1] <= 1.); } } @@ -141,11 +141,11 @@ static void computeCGKernelPolygon(std::map<MVertex*,SPoint3> &coordinates, if(next == nbPts) next = 0; double p1[2] = {u(next, 0) - u(i, 0), u(next, 1) - u(i, 1)}; for(int k = 0; k < nbAll; k++){ - double p2[2] = {u(k, 0) - u(i, 0), u(k, 1) - u(i, 1)}; - double crossProd = p1[0] * p2[1] - p2[0] * p1[1]; - if(crossProd < eps){ - setP.erase(k); - } + double p2[2] = {u(k, 0) - u(i, 0), u(k, 1) - u(i, 1)}; + double crossProd = p1[0] * p2[1] - p2[0] * p1[1]; + if(crossProd < eps){ + setP.erase(k); + } } } } @@ -181,9 +181,9 @@ static void myPolygon(std::vector<MElement*> &vTri, std::vector<MVertex*> &vPoly for(int iEdge = 0; iEdge < 3; iEdge++) { MEdge tmp_edge = t->getEdge(iEdge); if(std::find(ePoly.begin(), ePoly.end(), tmp_edge) == ePoly.end()) - ePoly.push_back(tmp_edge); + ePoly.push_back(tmp_edge); else - ePoly.erase(std::find(ePoly.begin(), ePoly.end(),tmp_edge)); + ePoly.erase(std::find(ePoly.begin(), ePoly.end(),tmp_edge)); } } @@ -206,12 +206,12 @@ static void myPolygon(std::vector<MElement*> &vTri, std::vector<MVertex*> &vPoly MVertex *vB = ite->getVertex(0); MVertex *vE = ite->getVertex(1); if(vB == vPoly.back()){ - if(vE != vINIT) vPoly.push_back(vE); - ePoly.erase(ite); + if(vE != vINIT) vPoly.push_back(vE); + ePoly.erase(ite); } else if(vE == vPoly.back()){ - if(vB != vINIT) vPoly.push_back(vB); - ePoly.erase(ite); + if(vB != vINIT) vPoly.push_back(vB); + ePoly.erase(ite); } else ite++; } @@ -253,8 +253,8 @@ static bool closedCavity(MVertex *v, std::vector<MElement*> &vTri){ for (int j = 0; j < t->getNumVertices(); j++){ MVertex *vv = t->getVertex(j); if (vv != v){ - if (vs.find(vv) == vs.end())vs.insert(vv); - else vs.erase(vv); + if (vs.find(vv) == vs.end())vs.insert(vv); + else vs.erase(vv); } } } @@ -280,43 +280,43 @@ void GFaceCompound::fillNeumannBCS() const //EMI- TODO FIND KERNEL OF POLYGON AND PLACE AT CG KERNEL ! //IF NO KERNEL -> DO NOT FILL TRIS for (std::list<GEdge*>::iterator ite = loop.begin(); ite != loop.end(); ite++){ - for (unsigned int k= 0; k< (*ite)->getNumMeshElements(); k++){ - MVertex *v0 = (*ite)->getMeshElement(k)->getVertex(0); - MVertex *v1 = (*ite)->getMeshElement(k)->getVertex(1); - x += .5*(v0->x() + v1->x()); - y += .5*(v0->y() + v1->y()); - z += .5*(v0->z() + v1->z()); - nb++; - } + for (unsigned int k= 0; k< (*ite)->getNumMeshElements(); k++){ + MVertex *v0 = (*ite)->getMeshElement(k)->getVertex(0); + MVertex *v1 = (*ite)->getMeshElement(k)->getVertex(1); + x += .5*(v0->x() + v1->x()); + y += .5*(v0->y() + v1->y()); + z += .5*(v0->z() + v1->z()); + nb++; + } } x/=nb; y/=nb; z/=nb; MVertex *c = new MVertex(x, y, z); //--- create new triangles for (std::list<GEdge*>::iterator ite = loop.begin(); ite != loop.end(); ite++){ - for (unsigned int i= 0; i< (*ite)->getNumMeshElements(); i++){ - MVertex *v0 = (*ite)->getMeshElement(i)->getVertex(0); - MVertex *v1 = (*ite)->getMeshElement(i)->getVertex(1); + for (unsigned int i= 0; i< (*ite)->getNumMeshElements(); i++){ + MVertex *v0 = (*ite)->getMeshElement(i)->getVertex(0); + MVertex *v1 = (*ite)->getMeshElement(i)->getVertex(1); -// fillTris.push_back(new MTriangle(v0,v1, c)); - - MVertex *v2 = new MVertex(.5*(v0->x()+c->x()), .5*(v0->y()+c->y()), .5*(v0->z()+c->z())); - MVertex *v3 = new MVertex(.5*(v1->x()+c->x()), .5*(v1->y()+c->y()), .5*(v1->z()+c->z())); - fillTris.push_back(new MTriangle(v0,v2,v3)); - fillTris.push_back(new MTriangle(v2,c, v3)); - fillTris.push_back(new MTriangle(v0,v3, v1)) ; - -// MVertex *v2 = new MVertex(.66*v0->x()+.33*c->x(), .66*v0->y()+.33*c->y(), .66*v0->z()+.33*c->z()); -// MVertex *v3 = new MVertex(.66*v1->x()+.33*c->x(), .66*v1->y()+.33*c->y(), .66*v1->z()+.33*c->z()); -// MVertex *v4 = new MVertex(.33*v0->x()+.66*c->x(), .33*v0->y()+.66*c->y(), .33*v0->z()+.66*c->z()); -// MVertex *v5 = new MVertex(.33*v1->x()+.66*c->x(), .33*v1->y()+.66*c->y(), .33*v1->z()+.66*c->z()); -// fillTris.push_back(new MTriangle(v0,v2,v3)); -// fillTris.push_back(new MTriangle(v2,v5,v3)); -// fillTris.push_back(new MTriangle(v2,v4,v5)); -// fillTris.push_back(new MTriangle(v4,c,v5)); -// fillTris.push_back(new MTriangle(v0,v3,v1)); - - } +// fillTris.push_back(new MTriangle(v0,v1, c)); + + MVertex *v2 = new MVertex(.5*(v0->x()+c->x()), .5*(v0->y()+c->y()), .5*(v0->z()+c->z())); + MVertex *v3 = new MVertex(.5*(v1->x()+c->x()), .5*(v1->y()+c->y()), .5*(v1->z()+c->z())); + fillTris.push_back(new MTriangle(v0,v2,v3)); + fillTris.push_back(new MTriangle(v2,c, v3)); + fillTris.push_back(new MTriangle(v0,v3, v1)) ; + +// MVertex *v2 = new MVertex(.66*v0->x()+.33*c->x(), .66*v0->y()+.33*c->y(), .66*v0->z()+.33*c->z()); +// MVertex *v3 = new MVertex(.66*v1->x()+.33*c->x(), .66*v1->y()+.33*c->y(), .66*v1->z()+.33*c->z()); +// MVertex *v4 = new MVertex(.33*v0->x()+.66*c->x(), .33*v0->y()+.66*c->y(), .33*v0->z()+.66*c->z()); +// MVertex *v5 = new MVertex(.33*v1->x()+.66*c->x(), .33*v1->y()+.66*c->y(), .33*v1->z()+.66*c->z()); +// fillTris.push_back(new MTriangle(v0,v2,v3)); +// fillTris.push_back(new MTriangle(v2,v5,v3)); +// fillTris.push_back(new MTriangle(v2,v4,v5)); +// fillTris.push_back(new MTriangle(v4,c,v5)); +// fillTris.push_back(new MTriangle(v0,v3,v1)); + + } } } } @@ -328,10 +328,10 @@ void GFaceCompound::fillNeumannBCS() const for (std::list<MTriangle*>::iterator it2 = fillTris.begin(); it2 !=fillTris.end(); it2++ ){ MTriangle *t = (*it2); fprintf(ftri,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n", - t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), - t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), - t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), - 1., 1., 1.); + t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), + t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), + t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), + 1., 1., 1.); } fprintf(ftri,"};\n"); fclose(ftri); @@ -400,11 +400,11 @@ bool GFaceCompound::checkOrientation(int iter) const a_new = robustPredicates::orient2d(p0, p1, p2); if(count == 0) a_old=a_new; if(a_new*a_old < 0.){ - oriented = false; - break; + oriented = false; + break; } else{ - a_old = a_new; + a_old = a_new; } count++; } @@ -444,8 +444,8 @@ void GFaceCompound::one2OneMap() const std::map<MVertex*,SPoint2> vCoord; for (unsigned int j = 0; j < vTri.size(); j++){ for (int k = 0; k < vTri[j]->getNumVertices(); k++){ - MVertex *vk = vTri[j]->getVertex(k); - vCoord[vk] = getCoordinates(vk); + MVertex *vk = vTri[j]->getVertex(k); + vCoord[vk] = getCoordinates(vk); } } bool badCavity = closedCavity(v,vTri) ? checkCavity(vTri, vCoord) : false; @@ -496,7 +496,7 @@ bool GFaceCompound::parametrize() const std::vector<MElement*> _elements; for( std::list<GFace*>::const_iterator itt = _compound.begin(); itt != _compound.end(); ++itt) for(unsigned int i = 0; i < (*itt)->triangles.size(); ++i) - _elements.push_back((*itt)->triangles[i]); + _elements.push_back((*itt)->triangles[i]); multiscaleLaplace multiLaplace(_elements, coordinates); } //Conformal map parametrization @@ -585,11 +585,11 @@ void GFaceCompound::getBoundingEdges() //assign Derichlet BC (_U0) to bound with largest size double maxSize = 0.0; for(std::list<std::list<GEdge*> >::iterator it = _interior_loops.begin(); - it != _interior_loops.end(); it++){ + it != _interior_loops.end(); it++){ double size = getSizeBB(*it); if (size > maxSize) { - _U0 = *it; - maxSize = size; + _U0 = *it; + maxSize = size; } } @@ -705,8 +705,8 @@ void GFaceCompound::getUniqueEdges(std::set<GEdge*> &_unique) std::list<GEdge*> ed = (*it)->edges(); std::list<GEdge*>::iterator ite = ed.begin(); for( ; ite != ed.end() ; ++ite){ - if(!(*ite)->degenerate(0) && _touched.count(*ite) == 1) { - _unique.insert(*ite); } + if(!(*ite)->degenerate(0) && _touched.count(*ite) == 1) { + _unique.insert(*ite); } } } @@ -728,32 +728,32 @@ void GFaceCompound::computeALoop(std::set<GEdge*> &_unique, std::list<GEdge*> &l for(int i = 0; i < 2; i++) { for(std::set<GEdge*>::iterator itx = _unique.begin(); itx != _unique.end(); ++itx){ - GVertex *v1 = (*itx)->getBeginVertex(); - GVertex *v2 = (*itx)->getEndVertex(); - - std::set<GEdge*>::iterator itp; - if(v1 == vE){ - _loop.push_back(*itx); - itp = itx; - itx++; - _unique.erase(itp); - vE = v2; - i = -1; - } - else if(v2 == vE){ - _loop.push_back(*itx); - itp = itx; - itx++; - _unique.erase(itp); - vE = v1; - i=-1; - } - if(itx == _unique.end()) break; + GVertex *v1 = (*itx)->getBeginVertex(); + GVertex *v2 = (*itx)->getEndVertex(); + + std::set<GEdge*>::iterator itp; + if(v1 == vE){ + _loop.push_back(*itx); + itp = itx; + itx++; + _unique.erase(itp); + vE = v2; + i = -1; + } + else if(v2 == vE){ + _loop.push_back(*itx); + itp = itx; + itx++; + _unique.erase(itp); + vE = v1; + i=-1; + } + if(itx == _unique.end()) break; } if(vB == vE) { - found = true; - break; + found = true; + break; } if(_unique.empty()) break; @@ -776,10 +776,10 @@ void GFaceCompound::computeALoop(std::set<GEdge*> &_unique, std::list<GEdge*> &l } GFaceCompound::GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, - std::list<GEdge*> &U0, std::list<GEdge*> &V0, - std::list<GEdge*> &U1, std::list<GEdge*> &V1, - linearSystem<double> *lsys, typeOfMapping mpg, - int allowPartition) + std::list<GEdge*> &U0, std::list<GEdge*> &V0, + std::list<GEdge*> &U1, std::list<GEdge*> &V1, + linearSystem<double> *lsys, typeOfMapping mpg, + int allowPartition) : GFace(m, tag), _compound(compound), _U0(U0), _U1(U1), _V0(V0), _V1(V1), oct(0), _lsys(lsys),_mapping(mpg), _allowPartition(allowPartition) { @@ -875,26 +875,26 @@ static bool orderVertices(const std::list<GEdge*> &e, std::vector<MVertex*> &l, MVertex *v0 = ll->getVertex(0); MVertex *v1 = ll->getVertex(1); if(v0 == current_v){ - found = true; - l.push_back(current_v); - current_v = v1; - temp.erase(itl); - const double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + + found = true; + l.push_back(current_v); + current_v = v1; + temp.erase(itl); + const double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + (v0->y() - v1->y()) * (v0->y() - v1->y()) + - (v0->z() - v1->z()) * (v0->z() - v1->z())); - coord.push_back(coord[coord.size()-1] + length / tot_length); - break; + (v0->z() - v1->z()) * (v0->z() - v1->z())); + coord.push_back(coord[coord.size()-1] + length / tot_length); + break; } else if(v1 == current_v){ - found = true; - l.push_back(current_v); - current_v = v0; - temp.erase(itl); - const double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + + found = true; + l.push_back(current_v); + current_v = v0; + temp.erase(itl); + const double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + (v0->y() - v1->y()) * (v0->y() - v1->y()) + (v0->z() - v1->z()) * (v0->z() - v1->z())); - coord.push_back(coord[coord.size()-1] + length / tot_length); - break; + coord.push_back(coord[coord.size()-1] + length / tot_length); + break; } } if(!found) return false; @@ -949,31 +949,31 @@ SPoint2 GFaceCompound::getCoordinates(MVertex *v) const tL=tB; bool found = false; while(j < (int)ge->mesh_vertices.size()){ - vR = ge->mesh_vertices[j]; - vR->getParameter(0,tR); - if(!vR->getParameter(0,tR)) { - Msg::Error("vertex vr %p not MedgeVertex \n", vR); - Msg::Exit(1); - } - if(tLoc >= tL && tLoc <= tR){ - found = true; - itR = coordinates.find(vR); - if(itR == coordinates.end()){ - Msg::Error("vertex %p (%g %g %g) not found\n", vR, vR->x(), vR->y(), vR->z()); - Msg::Exit(1); - } - break; - } - else{ - itL = coordinates.find(vR); - vL = vR; - tL = tR; - } - j++; + vR = ge->mesh_vertices[j]; + vR->getParameter(0,tR); + if(!vR->getParameter(0,tR)) { + Msg::Error("vertex vr %p not MedgeVertex \n", vR); + Msg::Exit(1); + } + if(tLoc >= tL && tLoc <= tR){ + found = true; + itR = coordinates.find(vR); + if(itR == coordinates.end()){ + Msg::Error("vertex %p (%g %g %g) not found\n", vR, vR->x(), vR->y(), vR->z()); + Msg::Exit(1); + } + break; + } + else{ + itL = coordinates.find(vR); + vL = vR; + tL = tR; + } + j++; } if(!found) { - vR = v1; - tR = tE; + vR = v1; + tR = tE; } //Linear interpolation between tL and tR @@ -1014,21 +1014,21 @@ void GFaceCompound::parametrize(iterationStep step, typeOfMapping tom) const if(step == ITERU){ std::list<GEdge*>::const_iterator it = _U0.begin(); for( ; it != _U0.end(); ++it){ - fixEdgeToValue(*it, 0.0, myAssembler); + fixEdgeToValue(*it, 0.0, myAssembler); } it = _U1.begin(); for( ; it != _U1.end(); ++it){ - fixEdgeToValue(*it, 1.0, myAssembler); + fixEdgeToValue(*it, 1.0, myAssembler); } } else if(step == ITERV){ std::list<GEdge*>::const_iterator it = _V0.begin(); for( ; it != _V0.end(); ++it){ - fixEdgeToValue(*it, 0.0, myAssembler); + fixEdgeToValue(*it, 0.0, myAssembler); } it = _V1.begin(); for( ; it != _V1.end(); ++it){ - fixEdgeToValue(*it, 1.0, myAssembler); + fixEdgeToValue(*it, 1.0, myAssembler); } } } @@ -1215,11 +1215,11 @@ bool GFaceCompound::parametrize_conformal_spectral() const // int k = 0; // std::vector<std::complex<double> > &ev = eig.getEigenVector(1); // for(std::set<MVertex *>::iterator itv = allNodes.begin(); itv !=allNodes.end() ; ++itv){ -// MVertex *v = *itv; -// double paramu = ev[k].real(); -// double paramv = ev[k+1].real(); -// coordinates[v] = SPoint3(paramu,paramv,0.0); -// k = k+2; +// MVertex *v = *itv; +// double paramu = ev[k].real(); +// double paramv = ev[k+1].real(); +// coordinates[v] = SPoint3(paramu,paramv,0.0); +// k = k+2; // } // } @@ -1407,9 +1407,9 @@ void GFaceCompound::computeNormals() const SVector3 n (J[2][0],J[2][1],J[2][2]); n.normalize(); for(int j = 0; j < 3; j++){ - std::map<MVertex*, SVector3>::iterator itn = _normals.find(t->getVertex(j)); - if(itn == _normals.end())_normals[t->getVertex(j)] = n; - else itn->second += n; + std::map<MVertex*, SVector3>::iterator itn = _normals.find(t->getVertex(j)); + if(itn == _normals.end())_normals[t->getVertex(j)] = n; + else itn->second += n; } } } @@ -1451,8 +1451,8 @@ double GFaceCompound::locCurvature(MTriangle *t, double u, double v) const SVector3 n2 = _normals[t->getVertex(1)]; SVector3 n3 = _normals[t->getVertex(2)]; double val[9] = {n1.x(), n2.x(), n3.x(), - n1.y(), n2.y(), n3.y(), - n1.z(), n2.z(), n3.z()}; + n1.y(), n2.y(), n3.y(), + n1.z(), n2.z(), n3.z()}; return fabs(t->interpolateDiv(val, u, v, 3)); @@ -1580,7 +1580,7 @@ Pair<SVector3,SVector3> GFaceCompound::firstDer(const SPoint2 ¶m) const return Pair<SVector3, SVector3>(SVector3(1, 0, 0), SVector3(0, 1, 0)); double mat[2][2] = {{lt->p2.x() - lt->p1.x(), lt->p3.x() - lt->p1.x()}, - {lt->p2.y() - lt->p1.y(), lt->p3.y() - lt->p1.y()}}; + {lt->p2.y() - lt->p1.y(), lt->p3.y() - lt->p1.y()}}; double inv[2][2]; inv2x2(mat,inv); @@ -1706,8 +1706,8 @@ void GFaceCompound::getTriangle(double u, double v, // if(!(*lt)) { // for(int i=0;i<nbT;i++){ // if(GFaceCompoundInEle (&_gfct[i],uv)){ -// *lt = &_gfct[i]; -// break; +// *lt = &_gfct[i]; +// break; // } // } // } @@ -1741,9 +1741,9 @@ void GFaceCompound::buildOct() const for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; for(int j = 0; j < 3; j++){ - std::map<MVertex*,SPoint3>::const_iterator itj = coordinates.find(t->getVertex(j)); - _coordPoints.insert(std::make_pair(t->getVertex(j)->point(), itj->second)); - bb += SPoint3(itj->second.x(),itj->second.y(),0.0); + std::map<MVertex*,SPoint3>::const_iterator itj = coordinates.find(t->getVertex(j)); + _coordPoints.insert(std::make_pair(t->getVertex(j)->point(), itj->second)); + bb += SPoint3(itj->second.x(),itj->second.y(),0.0); } count++; } @@ -1751,8 +1751,8 @@ void GFaceCompound::buildOct() const _gfct = new GFaceCompoundTriangle[count]; double origin[3] = {bb.min().x(), bb.min().y(), bb.min().z()}; double ssize[3] = {bb.max().x() - bb.min().x(), - bb.max().y() - bb.min().y(), - bb.max().z() - bb.min().z()}; + bb.max().y() - bb.min().y(), + bb.max().z() - bb.min().z()}; const int maxElePerBucket = 11; oct = Octree_Create(maxElePerBucket, origin, ssize, GFaceCompoundBB, GFaceCompoundCentroid, GFaceCompoundInEle); @@ -1764,18 +1764,18 @@ void GFaceCompound::buildOct() const for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; std::map<MVertex*,SPoint3>::const_iterator it0 = - coordinates.find(t->getVertex(0)); + coordinates.find(t->getVertex(0)); std::map<MVertex*,SPoint3>::const_iterator it1 = - coordinates.find(t->getVertex(1)); + coordinates.find(t->getVertex(1)); std::map<MVertex*,SPoint3>::const_iterator it2 = - coordinates.find(t->getVertex(2)); + coordinates.find(t->getVertex(2)); _gfct[count].p1 = it0->second; _gfct[count].p2 = it1->second; _gfct[count].p3 = it2->second; if((*it)->geomType() != GEntity::DiscreteSurface){ - reparamMeshVertexOnFace(t->getVertex(0), *it, _gfct[count].gfp1); - reparamMeshVertexOnFace(t->getVertex(1), *it, _gfct[count].gfp2); - reparamMeshVertexOnFace(t->getVertex(2), *it, _gfct[count].gfp3); + reparamMeshVertexOnFace(t->getVertex(0), *it, _gfct[count].gfp1); + reparamMeshVertexOnFace(t->getVertex(1), *it, _gfct[count].gfp2); + reparamMeshVertexOnFace(t->getVertex(2), *it, _gfct[count].gfp3); } _gfct[count].v1 = SPoint3(t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z()); @@ -1856,7 +1856,7 @@ double GFaceCompound::checkAspectRatio() const MTriangle *t = (*it)->triangles[i]; std::vector<MVertex *> v(3); for(int k = 0; k < 3; k++){ - v[k] = t->getVertex(k); + v[k] = t->getVertex(k); } std::map<MVertex*,SPoint3>::const_iterator it0 = coordinates.find(v[0]); std::map<MVertex*,SPoint3>::const_iterator it1 = coordinates.find(v[1]); @@ -1912,14 +1912,14 @@ void GFaceCompound::coherenceNormals() MEdge me = t->getEdge(j); std::map<MEdge, std::set<MTriangle*, std::less<MTriangle*> >, Less_Edge >::iterator it = edge2tris.find(me); if (it == edge2tris.end()) { - std::set<MTriangle*, std::less<MTriangle*> > mySet; - mySet.insert(t); - edge2tris.insert(std::make_pair(me, mySet)); + std::set<MTriangle*, std::less<MTriangle*> > mySet; + mySet.insert(t); + edge2tris.insert(std::make_pair(me, mySet)); } else{ - std::set<MTriangle*, std::less<MTriangle*> > mySet = it->second; - mySet.insert(t); - it->second = mySet; + std::set<MTriangle*, std::less<MTriangle*> > mySet = it->second; + mySet.insert(t); + it->second = mySet; } } } @@ -1932,19 +1932,19 @@ void GFaceCompound::coherenceNormals() MTriangle *t = triangles[i]; std::set<MTriangle*, std::less<MTriangle*> >::iterator it2 = touched.find(t); if(it2 != touched.end()){ - for (int j = 0; j < 3; j++){ - MEdge me = t->getEdge(j); - t->getEdgeInfo(me, iE,si); - std::map<MEdge, std::set<MTriangle*>, Less_Edge >::iterator it = edge2tris.find(me); - std::set<MTriangle*, std::less<MTriangle*> > mySet = it->second; - for(std::set<MTriangle*, std::less<MTriangle*> >::iterator itt = mySet.begin(); itt != mySet.end(); itt++){ - if (*itt != t){ - (*itt)->getEdgeInfo(me,iE2,si2); - if(si == si2) (*itt)->revert(); - touched.insert(*itt); - } - } - } + for (int j = 0; j < 3; j++){ + MEdge me = t->getEdge(j); + t->getEdgeInfo(me, iE,si); + std::map<MEdge, std::set<MTriangle*>, Less_Edge >::iterator it = edge2tris.find(me); + std::set<MTriangle*, std::less<MTriangle*> > mySet = it->second; + for(std::set<MTriangle*, std::less<MTriangle*> >::iterator itt = mySet.begin(); itt != mySet.end(); itt++){ + if (*itt != t){ + (*itt)->getEdgeInfo(me,iE2,si2); + if(si == si2) (*itt)->revert(); + touched.insert(*itt); + } + } + } } } } @@ -1961,7 +1961,7 @@ void GFaceCompound::buildAllNodes() const for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; for(int j = 0; j < 3; j++){ - allNodes.insert(t->getVertex(j)); + allNodes.insert(t->getVertex(j)); } } } @@ -1979,10 +1979,10 @@ int GFaceCompound::genusGeom() const N++; MTriangle *e = (*it)->triangles[i]; for(int j = 0; j < e->getNumVertices(); j++){ - vs.insert(e->getVertex(j)); + vs.insert(e->getVertex(j)); } for(int j = 0; j < e->getNumEdges(); j++){ - es.insert(e->getEdge(j)); + es.insert(e->getEdge(j)); } } } @@ -2029,29 +2029,29 @@ void GFaceCompound::printStuff() const for(unsigned int i = 0; i < (*it)->triangles.size(); ++i){ MTriangle *t = (*it)->triangles[i]; std::map<MVertex*,SPoint3>::const_iterator it0 = - coordinates.find(t->getVertex(0)); + coordinates.find(t->getVertex(0)); std::map<MVertex*,SPoint3>::const_iterator it1 = - coordinates.find(t->getVertex(1)); + coordinates.find(t->getVertex(1)); std::map<MVertex*,SPoint3>::const_iterator it2 = - coordinates.find(t->getVertex(2)); + coordinates.find(t->getVertex(2)); fprintf(xyzv,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n", - t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), - t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), - t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), - it0->second.y(),it1->second.y(),it2->second.y()); + t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), + t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), + t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), + it0->second.y(),it1->second.y(),it2->second.y()); fprintf(xyzu,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n", - t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), - t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), - t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), - it0->second.x(),it1->second.x(),it2->second.x()); + t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), + t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), + t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), + it0->second.x(),it1->second.x(),it2->second.x()); double K1 = locCurvature(t,it0->second.x(),it0->second.y()); double K2 = locCurvature(t,it1->second.x(),it1->second.y()); double K3 = locCurvature(t,it2->second.x(),it2->second.y()); fprintf(xyzc,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n", - t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), - t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), - t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), - K1, K2, K3); + t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z(), + t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z(), + t->getVertex(2)->x(), t->getVertex(2)->y(), t->getVertex(2)->z(), + K1, K2, K3); double p0[3] = {t->getVertex(0)->x(), t->getVertex(0)->y(), t->getVertex(0)->z()}; double p1[3] = {t->getVertex(1)->x(), t->getVertex(1)->y(), t->getVertex(1)->z()}; @@ -2063,25 +2063,25 @@ void GFaceCompound::printStuff() const double a_2D = fabs(triangle_area(q0, q1, q2)); double area = a_3D/a_2D; fprintf(uva,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n", - it0->second.x(), it0->second.y(), 0.0, - it1->second.x(), it1->second.y(), 0.0, - it2->second.x(), it2->second.y(), 0.0, - area, area, area); + it0->second.x(), it0->second.y(), 0.0, + it1->second.x(), it1->second.y(), 0.0, + it2->second.x(), it2->second.y(), 0.0, + area, area, area); fprintf(uvx,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n", - it0->second.x(), it0->second.y(), 0.0, - it1->second.x(), it1->second.y(), 0.0, - it2->second.x(), it2->second.y(), 0.0, - t->getVertex(0)->x(), t->getVertex(1)->x(), t->getVertex(2)->x()); + it0->second.x(), it0->second.y(), 0.0, + it1->second.x(), it1->second.y(), 0.0, + it2->second.x(), it2->second.y(), 0.0, + t->getVertex(0)->x(), t->getVertex(1)->x(), t->getVertex(2)->x()); fprintf(uvy,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n", - it0->second.x(), it0->second.y(), 0.0, - it1->second.x(), it1->second.y(), 0.0, - it2->second.x(), it2->second.y(), 0.0, - t->getVertex(0)->y(), t->getVertex(1)->y(), t->getVertex(2)->y()); + it0->second.x(), it0->second.y(), 0.0, + it1->second.x(), it1->second.y(), 0.0, + it2->second.x(), it2->second.y(), 0.0, + t->getVertex(0)->y(), t->getVertex(1)->y(), t->getVertex(2)->y()); fprintf(uvz,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n", - it0->second.x(), it0->second.y(), 0.0, - it1->second.x(), it1->second.y(), 0.0, - it2->second.x(), it2->second.y(), 0.0, - t->getVertex(0)->z(), t->getVertex(1)->z(), t->getVertex(2)->z()); + it0->second.x(), it0->second.y(), 0.0, + it1->second.x(), it1->second.y(), 0.0, + it2->second.x(), it2->second.y(), 0.0, + t->getVertex(0)->z(), t->getVertex(1)->z(), t->getVertex(2)->z()); } } fprintf(uva,"};\n"); diff --git a/Geo/GFaceCompound.h b/Geo/GFaceCompound.h index 73ce7eacf7478254908b68019bb18dd5426ce4b1..cbca113e0dd7d697cf67c7dc0e45423c6022e98e 100644 --- a/Geo/GFaceCompound.h +++ b/Geo/GFaceCompound.h @@ -99,8 +99,8 @@ class GFaceCompound : public GFace { GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, std::list<GEdge*> &U0, std::list<GEdge*> &U1, std::list<GEdge*> &V0, std::list<GEdge*> &V1, - linearSystem<double>* lsys =0, - typeOfMapping typ = HARMONIC, int allowPartition=1); + linearSystem<double>* lsys =0, + typeOfMapping typ = HARMONIC, int allowPartition=1); virtual ~GFaceCompound(); Range<double> parBounds(int i) const { return trivial() ? (*(_compound.begin()))->parBounds(i) : Range<double>(-1, 1); } @@ -136,8 +136,8 @@ class GFaceCompound : public GFace { GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, std::list<GEdge*> &U0, std::list<GEdge*> &U1, std::list<GEdge*> &V0, std::list<GEdge*> &V1, - linearSystem<double>* lsys = 0, - typeOfMapping typ = HARMONIC) : GFace(m, tag) + linearSystem<double>* lsys = 0, + typeOfMapping typ = HARMONIC) : GFace(m, tag) { Msg::Error("Gmsh has to be compiled with solver support to use GFaceCompounds"); } diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 69709d8af92fd28d4eb17e592163f01aa86a591d..a0f00bb5d79467ebe2fd87d5409b4f01abd5614f 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -60,13 +60,13 @@ static void recur_connect(MVertex *v, // starting form a list of elements, returns // lists of lists that are all simply connected static void recur_connect_e (const MEdge &e, - std::multimap<MEdge,MElement*,Less_Edge> &e2e, - std::set<MElement*> &group, - std::set<MEdge,Less_Edge> &touched){ + std::multimap<MEdge,MElement*,Less_Edge> &e2e, + std::set<MElement*> &group, + std::set<MEdge,Less_Edge> &touched){ if (touched.find(e) != touched.end())return; touched.insert(e); for (std::multimap <MEdge,MElement*,Less_Edge>::iterator it = e2e.lower_bound(e); - it != e2e.upper_bound(e) ; ++it){ + it != e2e.upper_bound(e) ; ++it){ group.insert(it->second); for (int i=0;i<it->second->getNumEdges();++i){ recur_connect_e (it->second->getEdge(i),e2e,group,touched); @@ -144,7 +144,7 @@ int GModel::setCurrent(GModel *m) break; } } - return _current; + return _current; } GModel *GModel::findByName(std::string name) @@ -782,7 +782,7 @@ void GModel::recomputeMeshPartitions() for(unsigned int i = 0; i < entities.size(); i++){ for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++){ int part = entities[i]->getMeshElement(j)->getPartition(); - if(part) meshPartitions.insert(part); + if(part) meshPartitions.insert(part); } } } @@ -818,9 +818,9 @@ void GModel::_storeElementsInEntities(std::map<int, std::vector<MElement*> > &ma add(v); } if(!v->points.empty()) { // CAD points already have one by default - v->points.clear(); - v->mesh_vertices.clear(); - } + v->points.clear(); + v->mesh_vertices.clear(); + } _addElements(v->points, it->second); } break; @@ -1175,34 +1175,34 @@ void GModel::createTopologyFromFaces(std::vector<discreteFace*> &discFaces) bool candidate = true; for (unsigned int i = 0; i < (*itE)->getNumMeshElements(); i++){ - MEdge me = (*itE)->getMeshElement(i)->getEdge(0); - std::set<MEdge, Less_Edge >::iterator itset = myEdges.find(me); - if (itset == myEdges.end()){ - candidate = false; - break; - } + MEdge me = (*itE)->getMeshElement(i)->getEdge(0); + std::set<MEdge, Less_Edge >::iterator itset = myEdges.find(me); + if (itset == myEdges.end()){ + candidate = false; + break; + } } if (candidate){ - std::vector<int> tagEdges; - tagEdges.push_back((*itE)->tag()); - for (unsigned int i = 0; i < (*itE)->getNumMeshElements(); i++){ - MEdge me = (*itE)->getMeshElement(i)->getEdge(0); - std::set<MEdge, Less_Edge >::iterator itset = myEdges.find(me); - myEdges.erase(itset); - } + std::vector<int> tagEdges; + tagEdges.push_back((*itE)->tag()); + for (unsigned int i = 0; i < (*itE)->getNumMeshElements(); i++){ + MEdge me = (*itE)->getMeshElement(i)->getEdge(0); + std::set<MEdge, Less_Edge >::iterator itset = myEdges.find(me); + myEdges.erase(itset); + } - for (std::vector<int>::iterator itFace = tagFaces.begin(); + for (std::vector<int>::iterator itFace = tagFaces.begin(); itFace != tagFaces.end(); itFace++) { - std::map<int, std::vector<int> >::iterator it = face2Edges.find(*itFace); - if (it == face2Edges.end()) face2Edges.insert(std::make_pair(*itFace, tagEdges)); - else{ - std::vector<int> allEdges = it->second; - allEdges.insert(allEdges.begin(), tagEdges.begin(), tagEdges.end()); - it->second = allEdges; - } - } + std::map<int, std::vector<int> >::iterator it = face2Edges.find(*itFace); + if (it == face2Edges.end()) face2Edges.insert(std::make_pair(*itFace, tagEdges)); + else{ + std::vector<int> allEdges = it->second; + allEdges.insert(allEdges.begin(), tagEdges.begin(), tagEdges.end()); + it->second = allEdges; + } + } } @@ -1223,38 +1223,38 @@ void GModel::createTopologyFromFaces(std::vector<discreteFace*> &discFaces) //fill new edge with mesh vertices std::vector<MVertex*> allV; for(unsigned int i = 0; i < myLines.size(); i++) { - MVertex *v0 = myLines[i].getVertex(0); - MVertex *v1 = myLines[i].getVertex(1); - e->lines.push_back(new MLine( v0, v1)); - if (std::find(allV.begin(), allV.end(), v0) == allV.end()) allV.push_back(v0); - if (std::find(allV.begin(), allV.end(), v1) == allV.end()) allV.push_back(v1); - v0->setEntity(e); - v1->setEntity(e); + MVertex *v0 = myLines[i].getVertex(0); + MVertex *v1 = myLines[i].getVertex(1); + e->lines.push_back(new MLine( v0, v1)); + if (std::find(allV.begin(), allV.end(), v0) == allV.end()) allV.push_back(v0); + if (std::find(allV.begin(), allV.end(), v1) == allV.end()) allV.push_back(v1); + v0->setEntity(e); + v1->setEntity(e); } e->mesh_vertices.insert(e->mesh_vertices.begin(), allV.begin(),allV.end()); for (std::vector<int>::iterator itFace = tagFaces.begin(); itFace != tagFaces.end(); itFace++) { - //delete new mesh vertices of edge from adjacent faces - GFace *dFace = getFaceByTag(*itFace); - for (std::vector<MVertex*>::iterator itv = allV.begin();itv != allV.end(); itv++) { - std::vector<MVertex*>::iterator itve = + //delete new mesh vertices of edge from adjacent faces + GFace *dFace = getFaceByTag(*itFace); + for (std::vector<MVertex*>::iterator itv = allV.begin();itv != allV.end(); itv++) { + std::vector<MVertex*>::iterator itve = std::find(dFace->mesh_vertices.begin(), dFace->mesh_vertices.end(), *itv); - if (itve != dFace->mesh_vertices.end()) dFace->mesh_vertices.erase(itve); - } + if (itve != dFace->mesh_vertices.end()) dFace->mesh_vertices.erase(itve); + } - //fill face2Edges with the new edge - std::map<int, std::vector<int> >::iterator f2e = face2Edges.find(*itFace); - if (f2e == face2Edges.end()){ - std::vector<int> tagEdges; - tagEdges.push_back(numE); - face2Edges.insert(std::make_pair(*itFace,tagEdges)); - } - else{ - std::vector<int> tagEdges = f2e->second; - tagEdges.push_back(numE); - f2e->second = tagEdges; - } + //fill face2Edges with the new edge + std::map<int, std::vector<int> >::iterator f2e = face2Edges.find(*itFace); + if (f2e == face2Edges.end()){ + std::vector<int> tagEdges; + tagEdges.push_back(numE); + face2Edges.insert(std::make_pair(*itFace,tagEdges)); + } + else{ + std::vector<int> tagEdges = f2e->second; + tagEdges.push_back(numE); + f2e->second = tagEdges; + } } @@ -1294,9 +1294,9 @@ void GModel::createTopologyFromFaces(std::vector<discreteFace*> &discFaces) for(int j = 0; j < N; j++) v[j] = e->getVertex(j); for (int j = 0; j < N; j++){ std::map<MVertex*, MVertex*, std::less<MVertex*> >::iterator itmap = old2new.find(v[j]); - MVertex *vNEW; + MVertex *vNEW; if (itmap != old2new.end()) { - vNEW = itmap->second; + vNEW = itmap->second; v[j]=vNEW; } } diff --git a/Geo/GModel.h b/Geo/GModel.h index 45a117e0724404bbdbb40cd3635feaf78a531a43..6aa2a37cae6f5cabcf6920b2999f6ca26a1a365a 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -385,7 +385,7 @@ class GModel bool saveAll=false, bool saveParametric=false, double scalingFactor=1.0); int writeDistanceMSH(const std::string &name, double version=1.0, bool binary=false, - bool saveAll=false, bool saveParametric=false, + bool saveAll=false, bool saveParametric=false, double scalingFactor=1.0); // Visual FEA file format diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp index 9de288891a36be27bb48ebe733406c777cfe2eb1..37873357044aa9641956f81a740afbbaf9337fbf 100644 --- a/Geo/GModelIO_Geo.cpp +++ b/Geo/GModelIO_Geo.cpp @@ -63,16 +63,16 @@ int GModel::exportDiscreteGEOInternals() int nb = 2 ; c->Control_Points = List_Create(nb, 1, sizeof(Vertex *)); for(int i = 0; i < List_Nbr(points); i++) { - Vertex *v; - List_Read(points, i, &v); - if (v->Num == gvb->tag()) { - List_Add(c->Control_Points, &v); - c->beg = v; - } - if (v->Num == gve->tag()) { - List_Add(c->Control_Points, &v); - c->end = v; - } + Vertex *v; + List_Read(points, i, &v); + if (v->Num == gvb->tag()) { + List_Add(c->Control_Points, &v); + c->beg = v; + } + if (v->Num == gve->tag()) { + List_Add(c->Control_Points, &v); + c->end = v; + } } End_Curve(c); Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); @@ -88,12 +88,12 @@ int GModel::exportDiscreteGEOInternals() List_T *curves = Tree2List(_geo_internals->Curves); Curve *c; for(std::list<GEdge*>::iterator ite = edges.begin(); ite != edges.end(); ite++){ - for(int i = 0; i < List_Nbr(curves); i++) { - List_Read(curves, i, &c); - if (c->Num == (*ite)->tag()) { - List_Add(s->Generatrices, &c); - } - } + for(int i = 0; i < List_Nbr(curves); i++) { + List_Read(curves, i, &c); + if (c->Num == (*ite)->tag()) { + List_Add(s->Generatrices, &c); + } + } } Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); } @@ -155,8 +155,8 @@ int GModel::importGEOInternals() if(!c->Visible) e->setVisibility(0); if(c->Color.type) e->setColor(c->Color.mesh); if(c->degenerated) { - e->setTooSmall(true); - } + e->setTooSmall(true); + } } } List_Delete(curves); @@ -180,8 +180,8 @@ int GModel::importGEOInternals() if(ge) b[j].push_back(ge); } } - int allowPartition = 1; - if (abs(s->TypeOfMapping) != 1) allowPartition = 0; + int allowPartition = 1; + if (abs(s->TypeOfMapping) != 1) allowPartition = 0; f = new GFaceCompound(this, s->Num, comp, b[0], b[1], b[2], b[3], 0, s->TypeOfMapping > 0 ? GFaceCompound::HARMONIC : diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index ccb4f58a45c57ab02004f7600cea9b03f1ba445d..45002386829f1cbec8486eda2dcb524f7c0b2670 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -1798,10 +1798,10 @@ int GModel::writeFEA(const std::string &name, int elementTagType, for(unsigned int i = 0; i < entities.size(); i++) for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++) if(entities[i]->mesh_vertices[j]->getIndex() >= 0) - fprintf(fp,"%d %.16g %.16g %.16g\n", entities[i]->mesh_vertices[j]->getIndex(), - entities[i]->mesh_vertices[j]->x() * scalingFactor, - entities[i]->mesh_vertices[j]->y() * scalingFactor, - entities[i]->mesh_vertices[j]->z() * scalingFactor); + fprintf(fp,"%d %.16g %.16g %.16g\n", entities[i]->mesh_vertices[j]->getIndex(), + entities[i]->mesh_vertices[j]->x() * scalingFactor, + entities[i]->mesh_vertices[j]->y() * scalingFactor, + entities[i]->mesh_vertices[j]->z() * scalingFactor); int iElement = 1; for(fiter it = firstFace(); it != lastFace(); ++it){ diff --git a/Geo/GeomMeshMatcher.cpp b/Geo/GeomMeshMatcher.cpp index 51b2286b6fad9672a8b8721b8ae5876ff47b5e53..de6b3838f696c7d4ed67f39e586cba35aba0280f 100644 --- a/Geo/GeomMeshMatcher.cpp +++ b/Geo/GeomMeshMatcher.cpp @@ -109,13 +109,13 @@ GeomMeshMatcher::matchVertices(GModel* m1, GModel *m2, bool& ok) // We match the vertices if their coordinates are the same under the // specified tolerance. - double score = std::max(fabs(v1->x() - v2->x()), + double score = std::max(fabs(v1->x() - v2->x()), std::max(fabs(v1->y() - v2->y()), fabs(v1->z() - v2->z()))); if (score < tol && score < best_score) { - best_candidate = v2; - best_candidate_ge = (*entity2); - best_score = score; + best_candidate = v2; + best_candidate_ge = (*entity2); + best_score = score; } } counter2++; @@ -123,11 +123,11 @@ GeomMeshMatcher::matchVertices(GModel* m1, GModel *m2, bool& ok) if (best_score != DBL_MAX) { Msg::Info("Vertices %i (geom) and %i (mesh) match.", - (*entity1)->tag(), - best_candidate_ge->tag()); + (*entity1)->tag(), + best_candidate_ge->tag()); coresp_v->push_back(Pair<GVertex*,GVertex*>((GVertex*) *entity1, - (GVertex*) best_candidate_ge)); + (GVertex*) best_candidate_ge)); ((GVertex*) best_candidate_ge)->setTag(((GVertex*) *entity1)->tag()); m2->remove((GVertex*) best_candidate_ge); vertices.push_back((GVertex*) best_candidate_ge); @@ -213,7 +213,7 @@ GeomMeshMatcher::matchEdges(GModel* m1, GModel* m2, // This reverses the edge if it's not parametrized in the right direction if (choice->getBeginVertex() == findMatching<GVertex*>(*coresp_v,v2) && - choice->getEndVertex() == findMatching<GVertex*>(*coresp_v,v1)) { + choice->getEndVertex() == findMatching<GVertex*>(*coresp_v,v1)) { Msg::Info("Wrong parametrization direction, reversing."); choice->reverse(); } @@ -415,18 +415,18 @@ int GeomMeshMatcher:: match(GModel *geom, GModel *mesh) // This will match SURFACES std::vector<Pair<GFace*, GFace*> > *coresp_f = matchFaces(geom, mesh, coresp_e,ok); if (ok) { - // This will match REGIONS - std::vector<Pair<GRegion*, GRegion*> >* coresp_r = matchRegions(geom, mesh, coresp_f,ok); - if (ok) { - mesh->writeMSH("out.msh",2.0,false,true); - return 1; - } else { - Msg::Error("Could not match every region !"); - return 0; - } + // This will match REGIONS + std::vector<Pair<GRegion*, GRegion*> >* coresp_r = matchRegions(geom, mesh, coresp_f,ok); + if (ok) { + mesh->writeMSH("out.msh",2.0,false,true); + return 1; + } else { + Msg::Error("Could not match every region !"); + return 0; + } } else { - Msg::Error("Could not match every surface !"); - return 0; + Msg::Error("Could not match every surface !"); + return 0; } } else { Msg::Error("Could not match every edge !"); diff --git a/Geo/Homology.cpp b/Geo/Homology.cpp index eb88889d13c31017977685dd8251eb1044e4f204..213594166d795c6d6a63a751d4d95cc39585b0b4 100644 --- a/Geo/Homology.cpp +++ b/Geo/Homology.cpp @@ -11,7 +11,7 @@ #if defined(HAVE_KBIPACK) Homology::Homology(GModel* model, std::vector<int> physicalDomain, - std::vector<int> physicalSubdomain) + std::vector<int> physicalSubdomain) { _model = model; _domain = physicalDomain; @@ -37,10 +37,10 @@ Homology::Homology(GModel* model, std::vector<int> physicalDomain, for(int j = 0; j < 4; j++){ it = groups[j].find(_domain.at(i)); if(it != groups[j].end()){ - std::vector<GEntity*> physicalGroup = (*it).second; - for(unsigned int k = 0; k < physicalGroup.size(); k++){ - _domainEntities.push_back(physicalGroup.at(k)); - } + std::vector<GEntity*> physicalGroup = (*it).second; + for(unsigned int k = 0; k < physicalGroup.size(); k++){ + _domainEntities.push_back(physicalGroup.at(k)); + } } } } @@ -48,10 +48,10 @@ Homology::Homology(GModel* model, std::vector<int> physicalDomain, for(int j = 0; j < 4; j++){ it = groups[j].find(_subdomain.at(i)); if(it != groups[j].end()){ - std::vector<GEntity*> physicalGroup = (*it).second; - for(unsigned int k = 0; k < physicalGroup.size(); k++){ - _subdomainEntities.push_back(physicalGroup.at(k)); - } + std::vector<GEntity*> physicalGroup = (*it).second; + for(unsigned int k = 0; k < physicalGroup.size(); k++){ + _subdomainEntities.push_back(physicalGroup.at(k)); + } } } } @@ -59,7 +59,7 @@ Homology::Homology(GModel* model, std::vector<int> physicalDomain, } CellComplex* Homology::createCellComplex(std::vector<GEntity*>& domainEntities, - std::vector<GEntity*>& subdomainEntities){ + std::vector<GEntity*>& subdomainEntities){ Msg::Info("Creating a Cell Complex..."); Msg::StatusBar(1, false, "Cell Complex..."); Msg::StatusBar(2, false, ""); @@ -79,14 +79,14 @@ CellComplex* Homology::createCellComplex(std::vector<GEntity*>& domainEntities, } for(unsigned int j=0; j < subdomainEntities.size(); j++) { for(unsigned int i=0; i < subdomainEntities.at(j)->getNumMeshElements(); - i++){ + i++){ MElement* element = subdomainEntities.at(j)->getMeshElement(i); subdomainElements.push_back(element); } } CellComplex* cellComplex = new CellComplex(domainElements, - subdomainElements); + subdomainElements); if(cellComplex->getSize(0) == 0){ Msg::Error("Cell Complex is empty!"); @@ -96,10 +96,10 @@ CellComplex* Homology::createCellComplex(std::vector<GEntity*>& domainEntities, Msg::Info("Cell Complex complete (%g s).", t2 - t1); Msg::Info("%d volumes, %d faces, %d edges and %d vertices.", cellComplex->getSize(3), cellComplex->getSize(2), - cellComplex->getSize(1), cellComplex->getSize(0)); + cellComplex->getSize(1), cellComplex->getSize(0)); Msg::StatusBar(2, false, "%d V, %d F, %d E, %d V.", - cellComplex->getSize(3), cellComplex->getSize(2), - cellComplex->getSize(1), cellComplex->getSize(0)); + cellComplex->getSize(3), cellComplex->getSize(2), + cellComplex->getSize(1), cellComplex->getSize(0)); return cellComplex; } @@ -113,7 +113,7 @@ void Homology::findGenerators(CellComplex* cellComplex) bool ownComplex = false; if(cellComplex==NULL){ cellComplex = createCellComplex(_domainEntities, - _subdomainEntities); + _subdomainEntities); ownComplex = true; } std::string domainString = getDomainString(_domain, _subdomain); @@ -127,10 +127,10 @@ void Homology::findGenerators(CellComplex* cellComplex) Msg::Info("Cell Complex reduction complete (%g s).", t2 - t1); Msg::Info("%d volumes, %d faces, %d edges and %d vertices.", cellComplex->getSize(3), cellComplex->getSize(2), - cellComplex->getSize(1), cellComplex->getSize(0)); + cellComplex->getSize(1), cellComplex->getSize(0)); Msg::StatusBar(2, false, "%d V, %d F, %d E, %d N.", - cellComplex->getSize(3), cellComplex->getSize(2), - cellComplex->getSize(1), cellComplex->getSize(0)); + cellComplex->getSize(3), cellComplex->getSize(2), + cellComplex->getSize(1), cellComplex->getSize(0)); Msg::Info("Computing homology spaces..."); Msg::StatusBar(1, false, "Computing..."); @@ -161,13 +161,13 @@ void Homology::findGenerators(CellComplex* cellComplex) chain->smoothenChain(); t2 = Cpu(); Msg::Info("Smoothened H%d %d from %d cells to %d cells (%g s).", - j, i, start, chain->getSize(), t2 - t1); + j, i, start, chain->getSize(), t2 - t1); if(chain->getSize() != 0) { HRank[j] = HRank[j] + 1; if(chain->getTorsion() != 1){ - Msg::Warning("H%d %d has torsion coefficient %d!", - j, i, chain->getTorsion()); - } + Msg::Warning("H%d %d has torsion coefficient %d!", + j, i, chain->getTorsion()); + } } _generators.push_back(chain->createPGroup()); delete chain; @@ -179,10 +179,10 @@ void Homology::findGenerators(CellComplex* cellComplex) std::string name = "H" + dimension + domainString + generator; std::vector<int> coeffs (cellComplex->getOmitted(i).size(),1); Chain* chain = new Chain(cellComplex->getOmitted(i), coeffs, - cellComplex, _model, name, 1); + cellComplex, _model, name, 1); if(chain->getSize() != 0) HRank[j] = HRank[j] + 1; - _generators.push_back(chain->createPGroup()); - delete chain; + _generators.push_back(chain->createPGroup()); + delete chain; } } } @@ -201,7 +201,7 @@ void Homology::findGenerators(CellComplex* cellComplex) Msg::StatusBar(1, false, "Homology"); Msg::StatusBar(2, false, "H0: %d, H1: %d, H2: %d, H3: %d.", - HRank[0], HRank[1], HRank[2], HRank[3]); + HRank[0], HRank[1], HRank[2], HRank[3]); } void Homology::findDualGenerators(CellComplex* cellComplex) @@ -209,7 +209,7 @@ void Homology::findDualGenerators(CellComplex* cellComplex) bool ownComplex = false; if(cellComplex==NULL){ cellComplex = createCellComplex(_domainEntities, - _subdomainEntities); + _subdomainEntities); ownComplex = true; } @@ -223,10 +223,10 @@ void Homology::findDualGenerators(CellComplex* cellComplex) Msg::Info("Cell Complex reduction complete (%g s).", t2 - t1); Msg::Info("%d volumes, %d faces, %d edges and %d vertices.", cellComplex->getSize(3), cellComplex->getSize(2), - cellComplex->getSize(1), cellComplex->getSize(0)); + cellComplex->getSize(1), cellComplex->getSize(0)); Msg::StatusBar(2, false, "%d V, %d F, %d E, %d N.", - cellComplex->getSize(3), cellComplex->getSize(2), - cellComplex->getSize(1), cellComplex->getSize(0)); + cellComplex->getSize(3), cellComplex->getSize(2), + cellComplex->getSize(1), cellComplex->getSize(0)); Msg::Info("Computing homology spaces..."); Msg::StatusBar(1, false, "Computing..."); @@ -251,20 +251,20 @@ void Homology::findDualGenerators(CellComplex* cellComplex) convert(i, generator); std::string name = "H" + dimension + "*" + - getDomainString(_domain, _subdomain) + generator; + getDomainString(_domain, _subdomain) + generator; std::set<Cell*, Less_Cell> cells; cellComplex->getCells(cells, j); Chain* chain = new Chain(cells, - chains->getCoeffVector(j,i), cellComplex, - _model, name, chains->getTorsion(j,i)); + chains->getCoeffVector(j,i), cellComplex, + _model, name, chains->getTorsion(j,i)); _generators.push_back(chain->createPGroup()); delete chain; if(chain->getSize() != 0){ HRank[dim-j] = HRank[dim-j] + 1; if(chain->getTorsion() != 1){ - Msg::Warning("H%d* %d has torsion coefficient %d!", - dim-j, i, chain->getTorsion()); - } + Msg::Warning("H%d* %d has torsion coefficient %d!", + dim-j, i, chain->getTorsion()); + } } } @@ -274,14 +274,14 @@ void Homology::findDualGenerators(CellComplex* cellComplex) std::string generator; convert(i+1, generator); std::string name - = "H" + dimension + "*" + - getDomainString(_domain, _subdomain) + generator; + = "H" + dimension + "*" + + getDomainString(_domain, _subdomain) + generator; std::vector<int> coeffs (cellComplex->getOmitted(i).size(),1); Chain* chain = new Chain(cellComplex->getOmitted(i), coeffs, - cellComplex, _model, name, 1); + cellComplex, _model, name, 1); if(chain->getSize() != 0) HRank[dim-j] = HRank[dim-j] + 1; - _generators.push_back(chain->createPGroup()); - delete chain; + _generators.push_back(chain->createPGroup()); + delete chain; } } } @@ -300,12 +300,12 @@ void Homology::findDualGenerators(CellComplex* cellComplex) Msg::StatusBar(1, false, "Homology"); Msg::StatusBar(2, false, "H0*: %d, H1*: %d, H2*: %d, H3*: %d.", - HRank[0], HRank[1], HRank[2], HRank[3]); + HRank[0], HRank[1], HRank[2], HRank[3]); } void Homology::findHomSequence(){ CellComplex* cellComplex = createCellComplex(_domainEntities, - _subdomainEntities); + _subdomainEntities); Msg::Info("Reducing the Cell Complex..."); Msg::StatusBar(1, false, "Reducing..."); @@ -316,10 +316,10 @@ void Homology::findHomSequence(){ Msg::Info("Cell Complex reduction complete (%g s).", t2 - t1); Msg::Info("%d volumes, %d faces, %d edges and %d vertices.", cellComplex->getSize(3), cellComplex->getSize(2), - cellComplex->getSize(1), cellComplex->getSize(0)); + cellComplex->getSize(1), cellComplex->getSize(0)); Msg::StatusBar(2, false, "%d V, %d F, %d E, %d N.", - cellComplex->getSize(3), cellComplex->getSize(2), - cellComplex->getSize(1), cellComplex->getSize(0)); + cellComplex->getSize(3), cellComplex->getSize(2), + cellComplex->getSize(1), cellComplex->getSize(0)); Msg::Info("Computing homology spaces..."); Msg::StatusBar(1, false, "Computing..."); @@ -342,32 +342,32 @@ void Homology::findHomSequence(){ std::string dimension = ""; convert(j, dimension); for(int i = 1; i <= chains->getBasisSize(j); i++){ - - std::string generator = ""; - convert(i, generator); + + std::string generator = ""; + convert(i, generator); - std::string name = "H" + dimension + domainString + generator; - std::set<Cell*, Less_Cell> cells; - cellComplex->getCells(cells, j, task); - Chain* chain = new Chain(cells, - chains->getCoeffVector(j,i), - cellComplex, _model, name, - chains->getTorsion(j,i)); - t1 = Cpu(); - int start = chain->getSize(); - //chain->smoothenChain(); - t2 = Cpu(); - //Msg::Info("Smoothened H%d %d from %d cells to %d cells (%g s).", - // j, i, start, chain->getSize(), t2 - t1); - if(chain->getSize() != 0) { - HRank[j] = HRank[j] + 1; - if(chain->getTorsion() != 1){ - Msg::Warning("H%d %d has torsion coefficient %d!", - j, i, chain->getTorsion()); - } - } - _generators.push_back(chain->createPGroup()); - delete chain; + std::string name = "H" + dimension + domainString + generator; + std::set<Cell*, Less_Cell> cells; + cellComplex->getCells(cells, j, task); + Chain* chain = new Chain(cells, + chains->getCoeffVector(j,i), + cellComplex, _model, name, + chains->getTorsion(j,i)); + t1 = Cpu(); + int start = chain->getSize(); + //chain->smoothenChain(); + t2 = Cpu(); + //Msg::Info("Smoothened H%d %d from %d cells to %d cells (%g s).", + // j, i, start, chain->getSize(), t2 - t1); + if(chain->getSize() != 0) { + HRank[j] = HRank[j] + 1; + if(chain->getTorsion() != 1){ + Msg::Warning("H%d %d has torsion coefficient %d!", + j, i, chain->getTorsion()); + } + } + _generators.push_back(chain->createPGroup()); + delete chain; } } @@ -387,7 +387,7 @@ void Homology::findHomSequence(){ Msg::StatusBar(1, false, "Homology"); Msg::StatusBar(2, false, "H0: %d, H1: %d, H2: %d, H3: %d.", - HRank[0], HRank[1], HRank[2], HRank[3]); + HRank[0], HRank[1], HRank[2], HRank[3]); delete chains; } @@ -396,7 +396,7 @@ void Homology::findHomSequence(){ } std::string Homology::getDomainString(const std::vector<int>& domain, - const std::vector<int>& subdomain) + const std::vector<int>& subdomain) { std::string domainString = "({"; if(domain.empty()) domainString += "0"; @@ -406,7 +406,7 @@ std::string Homology::getDomainString(const std::vector<int>& domain, convert(domain.at(i),temp); domainString += temp; if (domain.size()-1 > i){ - domainString += ", "; + domainString += ", "; } } } @@ -436,8 +436,8 @@ bool Homology::writeGeneratorsMSH(bool binary) return true; } Chain::Chain(std::set<Cell*, Less_Cell> cells, std::vector<int> coeffs, - CellComplex* cellComplex, GModel* model, - std::string name, int torsion) + CellComplex* cellComplex, GModel* model, + std::string name, int torsion) { int i = 0; for(std::set<Cell*, Less_Cell>::iterator cit = cells.begin(); @@ -447,9 +447,9 @@ Chain::Chain(std::set<Cell*, Less_Cell> cells, std::vector<int> coeffs, if((int)coeffs.size() > i){ if(coeffs.at(i) != 0){ std::list< std::pair<int, Cell*> > subCells; - cell->getCells(subCells); + cell->getCells(subCells); for(std::list< std::pair<int, Cell*> >::iterator it = - subCells.begin(); it != subCells.end(); it++){ + subCells.begin(); it != subCells.end(); it++){ Cell* subCell = (*it).second; int coeff = (*it).first; _cells.insert( std::make_pair(subCell, coeffs.at(i)*coeff)); @@ -477,7 +477,7 @@ void Homology::storeCells(CellComplex* cellComplex, int dim) std::list< std::pair<int, Cell*> > cells; cell->getCells(cells); for(std::list< std::pair<int, Cell*> >::iterator it = cells.begin(); - it != cells.end(); it++){ + it != cells.end(); it++){ Cell* subCell = it->second; MElement* e = subCell->getImageMElement(); @@ -504,8 +504,8 @@ void Homology::storeCells(CellComplex* cellComplex, int dim) } Chain::Chain(std::map<Cell*, int, Less_Cell>& chain, - CellComplex* cellComplex, GModel* model, - std::string name, int torsion) + CellComplex* cellComplex, GModel* model, + std::string name, int torsion) { _cells = chain; if(!_cells.empty()) _dim = firstCell()->first->getDim(); @@ -518,7 +518,7 @@ Chain::Chain(std::map<Cell*, int, Less_Cell>& chain, } bool Chain::deform(std::map<Cell*, int, Less_Cell>& cellsInChain, - std::map<Cell*, int, Less_Cell>& cellsNotInChain) + std::map<Cell*, int, Less_Cell>& cellsNotInChain) { std::vector<int> cc; std::vector<int> bc; @@ -567,12 +567,12 @@ bool Chain::deformChain(std::pair<Cell*, int> cell, bool bend) Cell* c1CbdCell = (*cit).first; for(citer cit2 = c1CbdCell->firstBoundary(true); - cit2 != c1CbdCell->lastBoundary(true); cit2++){ + cit2 != c1CbdCell->lastBoundary(true); cit2++){ Cell* c1CbdBdCell = (*cit2).first; int coeff = (*cit2).second; if( (hasCell(c1CbdBdCell) && getCoeff(c1CbdBdCell) != 0) - || c1CbdBdCell->inSubdomain()){ - cellsInChain.insert(std::make_pair(c1CbdBdCell, coeff)); + || c1CbdBdCell->inSubdomain()){ + cellsInChain.insert(std::make_pair(c1CbdBdCell, coeff)); } else cellsNotInChain.insert(std::make_pair(c1CbdBdCell, coeff)); } @@ -588,30 +588,30 @@ bool Chain::deformChain(std::pair<Cell*, int> cell, bool bend) } for(citer cit2 = cellsNotInChain.begin(); cit2 != cellsNotInChain.end(); - cit2++){ + cit2++){ Cell* c = (*cit2).first; if(c->inSubdomain()) next = true; } if(next) continue; if( (getDim() == 1 && cellsInChain.size() == 2 - && cellsNotInChain.size() == 1) || - (getDim() == 2 && cellsInChain.size() == 3 - && cellsNotInChain.size() == 1)){ + && cellsNotInChain.size() == 1) || + (getDim() == 2 && cellsInChain.size() == 3 + && cellsNotInChain.size() == 1)){ //printf("straighten \n"); return deform(cellsInChain, cellsNotInChain); } else if ( (getDim() == 1 && cellsInChain.size() == 1 - && cellsNotInChain.size() == 2 && bend) || + && cellsNotInChain.size() == 2 && bend) || (getDim() == 2 && cellsInChain.size() == 2 - && cellsNotInChain.size() == 2 && bend)){ + && cellsNotInChain.size() == 2 && bend)){ //printf("bend \n"); return deform(cellsInChain, cellsNotInChain); } else if ((getDim() == 1 && cellsInChain.size() == 3 - && cellsNotInChain.size() == 0) || + && cellsNotInChain.size() == 0) || (getDim() == 2 && cellsInChain.size() == 4 - && cellsNotInChain.size() == 0)){ + && cellsNotInChain.size() == 0)){ //printf("remove boundary \n"); return deform(cellsInChain, cellsNotInChain); } @@ -650,7 +650,7 @@ void Chain::smoothenChain() eraseNullCells(); double t2 = Cpu(); Msg::Debug("Smoothened a %d-chain from %d cells to %d cells (%g s).\n", - getDim(), start, getSize(), t2-t1); + getDim(), start, getSize(), t2-t1); return; } @@ -749,7 +749,7 @@ int Chain::createPGroup() // create PView for visualization PView* chain = new PView(getName(), "ElementData", getGModel(), - data, 0, 1); + data, 0, 1); } return physicalNum; diff --git a/Geo/Homology.h b/Geo/Homology.h index 1412d3afb9d0f6284f6da395a78ae52b61174cef..9bd285f598362c063d9e5a637b934548e096957b 100644 --- a/Geo/Homology.h +++ b/Geo/Homology.h @@ -50,12 +50,12 @@ class Homology public: Homology(GModel* model, std::vector<int> physicalDomain, - std::vector<int> physicalSubdomain); + std::vector<int> physicalSubdomain); ~Homology(); CellComplex* createCellComplex(std::vector<GEntity*>& domainEntities, - std::vector<GEntity*>& subdomainEntities); + std::vector<GEntity*>& subdomainEntities); CellComplex* createCellComplex() { return createCellComplex(_domainEntities, _subdomainEntities); } @@ -72,7 +72,7 @@ class Homology // Create a string describing the generator std::string getDomainString(const std::vector<int>& domain, - const std::vector<int>& subdomain); + const std::vector<int>& subdomain); // write the generators to a file bool writeGeneratorsMSH(bool binary=false); @@ -103,15 +103,15 @@ class Chain{ int _dim; bool deform(std::map<Cell*, int, Less_Cell> &cellsInChain, - std::map<Cell*, int, Less_Cell> &cellsNotInChain); + std::map<Cell*, int, Less_Cell> &cellsNotInChain); bool deformChain(std::pair<Cell*, int> cell, bool bend); public: Chain() {} Chain(std::set<Cell*, Less_Cell> cells, std::vector<int> coeffs, - CellComplex* cellComplex, GModel* model, - std::string name="Chain", int torsion=0); + CellComplex* cellComplex, GModel* model, + std::string name="Chain", int torsion=0); Chain(std::map<Cell*, int, Less_Cell>& chain, CellComplex* cellComplex, GModel* model, std::string name="Chain", int torsion=0); diff --git a/Geo/MElementCut.cpp b/Geo/MElementCut.cpp index e26e93cf5d3cf1cdfe5e6d902ba0af61533708db..df45970ce23786ffb0ea8174c483f0d853aa6f68 100644 --- a/Geo/MElementCut.cpp +++ b/Geo/MElementCut.cpp @@ -471,7 +471,7 @@ static void elementCutMesh(MElement *e, std::vector<const gLevelset *> &RPN, fullMatrix<double> &verticesLs, GEntity *ge, GModel *GM, int &numEle, std::map<int, MVertex*> &vertexMap, - newVerticesContainer &newVertices, + newVerticesContainer &newVertices, std::map<int, std::vector<MElement*> > elements[10], std::map<int, std::map<int, std::string> > physicals[4], std::map<int, int> newElemTags[4], @@ -633,13 +633,13 @@ static void elementCutMesh(MElement *e, std::vector<const gLevelset *> &RPN, MVertex *mv[4] = {NULL, NULL, NULL, NULL}; for(int j = 0; j < 4; j++){ int numV = getElementVertexNum(tetras[i]->pt(j), e); - if (numV == -1){ - MVertex *newv = new MVertex(tetras[i]->x(j), tetras[i]->y(j), tetras[i]->z(j)); - std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); - mv[j] = *(it.first); - if (!it.second) newv->deleteLast(); - } - else { + if (numV == -1){ + MVertex *newv = new MVertex(tetras[i]->x(j), tetras[i]->y(j), tetras[i]->z(j)); + std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); + mv[j] = *(it.first); + if (!it.second) newv->deleteLast(); + } + else { std::map<int, MVertex*>::iterator it = vertexMap.find(numV); if(it == vertexMap.end()) { mv[j] = new MVertex(tetras[i]->x(j), tetras[i]->y(j), @@ -691,10 +691,10 @@ static void elementCutMesh(MElement *e, std::vector<const gLevelset *> &RPN, for(int j = 0; j < 3; j++){ int numV = getElementVertexNum(triangles[i]->pt(j), e); if(numV == -1) { - MVertex *newv = new MVertex(triangles[i]->x(j), triangles[i]->y(j), triangles[i]->z(j)); - std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); - mv[j] = *(it.first); - if (!it.second) newv->deleteLast(); + MVertex *newv = new MVertex(triangles[i]->x(j), triangles[i]->y(j), triangles[i]->z(j)); + std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); + mv[j] = *(it.first); + if (!it.second) newv->deleteLast(); } else { std::map<int, MVertex*>::iterator it = vertexMap.find(numV); @@ -763,10 +763,10 @@ static void elementCutMesh(MElement *e, std::vector<const gLevelset *> &RPN, for(int j = 0; j < 3; j++){ int numV = getElementVertexNum(triangles[i]->pt(j), e); if(numV == -1) { - MVertex *newv = new MVertex(triangles[i]->x(j), triangles[i]->y(j), triangles[i]->z(j)); - std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); - mv[j] = *(it.first); - if (!it.second) newv->deleteLast(); + MVertex *newv = new MVertex(triangles[i]->x(j), triangles[i]->y(j), triangles[i]->z(j)); + std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); + mv[j] = *(it.first); + if (!it.second) newv->deleteLast(); } else { std::map<int, MVertex*>::iterator it = vertexMap.find(numV); @@ -816,10 +816,10 @@ static void elementCutMesh(MElement *e, std::vector<const gLevelset *> &RPN, for(int j = 0; j < 2; j++){ int numV = getElementVertexNum(lines[i]->pt(j), e); if(numV == -1) { - MVertex *newv = new MVertex(lines[i]->x(j), lines[i]->y(j), lines[i]->z(j)); - std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); - mv[j] = *(it.first); - if (!it.second) newv->deleteLast(); + MVertex *newv = new MVertex(lines[i]->x(j), lines[i]->y(j), lines[i]->z(j)); + std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); + mv[j] = *(it.first); + if (!it.second) newv->deleteLast(); } else { std::map<int, MVertex*>::iterator it = vertexMap.find(numV); @@ -858,10 +858,10 @@ static void elementCutMesh(MElement *e, std::vector<const gLevelset *> &RPN, for(int j = 0; j < 2; j++){ int numV = getElementVertexNum(lines[i]->pt(j), e); if(numV == -1) { - MVertex *newv = new MVertex(lines[i]->x(j), lines[i]->y(j), lines[i]->z(j)); - std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); - mv[j] = *(it.first); - if (!it.second) newv->deleteLast(); + MVertex *newv = new MVertex(lines[i]->x(j), lines[i]->y(j), lines[i]->z(j)); + std::pair<newVerticesContainer::iterator, bool> it = newVertices.insert(newv); + mv[j] = *(it.first); + if (!it.second) newv->deleteLast(); } else { std::map<int, MVertex*>::iterator it = vertexMap.find(numV); diff --git a/Geo/MElementOctree.cpp b/Geo/MElementOctree.cpp index e419558200c23c6647f1e3c1946bf99f172e8b29..fe6e1a01280fe32fac72893d53e1b325af1feb95 100644 --- a/Geo/MElementOctree.cpp +++ b/Geo/MElementOctree.cpp @@ -47,11 +47,11 @@ Octree *buildMElementOctree (GModel *m) SBoundingBox3d bb = m->bounds(); double min[3] = {bb.min().x(), bb.min().y(), bb.min().z()}; double size[3] = {bb.max().x() - bb.min().x(), - bb.max().y() - bb.min().y(), - bb.max().z() - bb.min().z()}; + bb.max().y() - bb.min().y(), + bb.max().z() - bb.min().z()}; const int maxElePerBucket = 100; // memory vs. speed trade-off Octree *_octree = Octree_Create(maxElePerBucket, min, size, - MElementBB, MElementCentroid, MElementInEle); + MElementBB, MElementCentroid, MElementInEle); std::vector<GEntity*> entities; m->getEntities(entities); for(unsigned int i = 0; i < entities.size(); i++) @@ -67,17 +67,17 @@ Octree *buildMElementOctree(std::vector<MElement*> &v) for (unsigned int i=0;i<v.size();i++){ for(unsigned int j=0;j<v[i]->getNumVertices();j++){ bb += SPoint3(v[i]->getVertex(j)->x(), - v[i]->getVertex(j)->y(), - v[i]->getVertex(j)->z()); + v[i]->getVertex(j)->y(), + v[i]->getVertex(j)->z()); } } double min[3] = {bb.min().x(), bb.min().y(), bb.min().z()}; double size[3] = {bb.max().x() - bb.min().x(), - bb.max().y() - bb.min().y(), - bb.max().z() - bb.min().z()}; + bb.max().y() - bb.min().y(), + bb.max().z() - bb.min().z()}; const int maxElePerBucket = 100; // memory vs. speed trade-off Octree *_octree = Octree_Create(maxElePerBucket, min, size, - MElementBB, MElementCentroid, MElementInEle); + MElementBB, MElementCentroid, MElementInEle); for (unsigned int i = 0; i < v.size(); i++) Octree_Insert(v[i], _octree); Octree_Arrange(_octree); diff --git a/Geo/MQuadrangle.cpp b/Geo/MQuadrangle.cpp index ea1e90b6538a187119033d89e407b914a3be9762..80aaf08ee69b4cae5737a1d541f3bad6e8af342d 100644 --- a/Geo/MQuadrangle.cpp +++ b/Geo/MQuadrangle.cpp @@ -195,7 +195,7 @@ double MQuadrangle::getInnerRadius() double x[4] = {_v[0]->x(), _v[1]->x(), _v[2]->x(), _v[3]->x()}; double y[4] = {_v[0]->y(), _v[1]->y(), _v[2]->y(), _v[3]->y()}; double z[4] = {_v[0]->z(), _v[1]->z(), _v[2]->z(), _v[3]->z()}; - + // get the coefficient (a,b,c,d) of the mean plane - least square! // the plane has for equation " a*x+b*y+c*z+d=0 " @@ -203,7 +203,7 @@ double MQuadrangle::getInnerRadius() double xm = (x[0] + x[1] + x[2] + x[3]) / 4; double ym = (y[0] + y[1] + y[2] + y[3]) / 4; double zm = (z[0] + z[1] + z[2] + z[3]) / 4; - + // using svd decomposition fullMatrix<double> U(4,3), V(3,3); fullVector<double> sigma(3); diff --git a/Geo/MQuadrangle.h b/Geo/MQuadrangle.h index 7ec4a77ff218410c50b21a8bc81db243fbf93df1..4cc751606b99a47f1a238924458175a50aa23cda 100644 --- a/Geo/MQuadrangle.h +++ b/Geo/MQuadrangle.h @@ -74,10 +74,10 @@ class MQuadrangle : public MElement { const MVertex *v0 = _v[edges_quad(ithEdge, 0)]; const MVertex *v1 = _v[edges_quad(ithEdge, 1)]; if (v0 == edge.getVertex(0) && v1 == edge.getVertex(1)){ - sign = 1; return; + sign = 1; return; } if (v1 == edge.getVertex(0) && v0 == edge.getVertex(1)){ - sign = -1; return; + sign = -1; return; } } Msg::Error("Could not get edge information for quadranglee %d", getNum()); @@ -134,7 +134,7 @@ class MQuadrangle : public MElement { // Computes the minimum inradius of the all the circles tangents to 3 of the 4 // edges of the quad. If the 4 points of the quad are not planar, we compute // the mean plane due to the least-square criterion. - virtual double getInnerRadius(); + virtual double getInnerRadius(); private: int edges_quad(const int edge, const int vert) const { diff --git a/Geo/MTriangle.cpp b/Geo/MTriangle.cpp index 0dee7ba6039a1d25b41a53a06e59260e36729ed4..3aa43df13b83cc253dfbae7c88362d8405274076 100644 --- a/Geo/MTriangle.cpp +++ b/Geo/MTriangle.cpp @@ -37,7 +37,7 @@ double MTriangle::distoShapeMeasure() double MTriangle::getInnerRadius() { - // radius of inscribed circle = 2 * Area / sum(Line_i) + // radius of inscribed circle = 2 * Area / sum(Line_i) double dist[3], k = 0.; for (int i = 0; i < 3; i++){ MEdge e = getEdge(i); diff --git a/Geo/MTriangle.h b/Geo/MTriangle.h index 364bad106e79c7ee90e795b5ed4f0d6254bede00..5568ac8c565dd6e025b2452edd84408f3d766c7e 100644 --- a/Geo/MTriangle.h +++ b/Geo/MTriangle.h @@ -79,10 +79,10 @@ class MTriangle : public MElement { const MVertex *v0 = _v[edges_tri(ithEdge, 0)]; const MVertex *v1 = _v[edges_tri(ithEdge, 1)]; if (v0 == edge.getVertex(0) && v1 == edge.getVertex(1)){ - sign = 1; return; + sign = 1; return; } if (v1 == edge.getVertex(0) && v0 == edge.getVertex(1)){ - sign = -1; return; + sign = -1; return; } } Msg::Error("Could not get edge information for triangle %d", getNum()); diff --git a/Geo/discreteEdge.cpp b/Geo/discreteEdge.cpp index 40d2c1c42065bf7099efdca7b6d563ea7becb4dd..cfdb02623dccf249d650dd0f095b953bf98f5237 100644 --- a/Geo/discreteEdge.cpp +++ b/Geo/discreteEdge.cpp @@ -163,7 +163,7 @@ void discreteEdge::setBoundVertices() } if(!existVertex){ GVertex *gvB = new discreteVertex(model(), model()->maxVertexNum()+1); - //printf("*** Created discreteVertex %d\n", gvB->tag()); + //printf("*** Created discreteVertex %d\n", gvB->tag()); bound_vertices.push_back(gvB); vE->setEntity(gvB); gvB->mesh_vertices.push_back(vE); @@ -174,16 +174,16 @@ void discreteEdge::setBoundVertices() if (itve != mesh_vertices.end()) mesh_vertices.erase(itve); for(GModel::eiter edge = model()->firstEdge(); edge != model()->lastEdge(); edge++){ - std::vector<MVertex*>::iterator itve = std::find((*edge)->mesh_vertices.begin(), (*edge)->mesh_vertices.end(), vE); - if (itve != (*edge)->mesh_vertices.end()) (*edge)->mesh_vertices.erase(itve); + std::vector<MVertex*>::iterator itve = std::find((*edge)->mesh_vertices.begin(), (*edge)->mesh_vertices.end(), vE); + if (itve != (*edge)->mesh_vertices.end()) (*edge)->mesh_vertices.erase(itve); } for(GModel::fiter face = model()->firstFace(); face != model()->lastFace(); face++){ - std::vector<MVertex*>::iterator itve = std::find((*face)->mesh_vertices.begin(), (*face)->mesh_vertices.end(), vE); - if (itve != (*face)->mesh_vertices.end()) (*face)->mesh_vertices.erase(itve); + std::vector<MVertex*>::iterator itve = std::find((*face)->mesh_vertices.begin(), (*face)->mesh_vertices.end(), vE); + if (itve != (*face)->mesh_vertices.end()) (*face)->mesh_vertices.erase(itve); } for(GModel::riter reg = model()->firstRegion(); reg != model()->lastRegion(); reg++){ - std::vector<MVertex*>::iterator itve = std::find((*reg)->mesh_vertices.begin(), (*reg)->mesh_vertices.end(), vE); - if (itve != (*reg)->mesh_vertices.end()) (*reg)->mesh_vertices.erase(itve); + std::vector<MVertex*>::iterator itve = std::find((*reg)->mesh_vertices.begin(), (*reg)->mesh_vertices.end(), vE); + if (itve != (*reg)->mesh_vertices.end()) (*reg)->mesh_vertices.erase(itve); } } @@ -200,7 +200,7 @@ void discreteEdge::setBoundVertices() if ((*point)->mesh_vertices[0]->getNum() == vE->getNum()){ bound_vertex = (*point); existVertex = true; - //printf("vertex exist (%g,%g,%g)\n", vE->x(), vE->y(), vE->z()); + //printf("vertex exist (%g,%g,%g)\n", vE->x(), vE->y(), vE->z()); break; } } @@ -249,7 +249,7 @@ void discreteEdge::parametrize( std::map<GFace*, std::map<MVertex*, MVertex*, s } //Replace MVertex by MedgeVertex - std::map<MVertex*, MVertex*, std::less<MVertex*> > old2new; + std::map<MVertex*, MVertex*, std::less<MVertex*> > old2new; old2new.clear(); std::vector<MVertex* > newVertices; std::vector<MLine*> newLines; @@ -290,7 +290,7 @@ void discreteEdge::parametrize( std::map<GFace*, std::map<MVertex*, MVertex*, s else{ std::map<MVertex*, MVertex*, std::less<MVertex*> > mapVert = itmap->second; for (std::map<MVertex*, MVertex*, std::less<MVertex*> >::iterator it = old2new.begin(); it != old2new.end(); it++) - mapVert.insert(*it); + mapVert.insert(*it); itmap->second = mapVert; } } @@ -311,13 +311,13 @@ void discreteEdge::computeNormals () const for (int j = 0; j < 3; j++){ std::map<MVertex*, SVector3, std::less<MVertex*> >::iterator itn = _normals.find(t->getVertex(j)); if (itn != _normals.end()){ - t->getJacobian(0, 0, 0, J); - SVector3 d1(J[0][0], J[0][1], J[0][2]); - SVector3 d2(J[1][0], J[1][1], J[1][2]); - SVector3 n = crossprod(d1, d2); - n.normalize(); - _normals[t->getVertex(j)] += n; - } + t->getJacobian(0, 0, 0, J); + SVector3 d1(J[0][0], J[0][1], J[0][2]); + SVector3 d2(J[1][0], J[1][1], J[1][2]); + SVector3 n = crossprod(d1, d2); + n.normalize(); + _normals[t->getVertex(j)] += n; + } } } } diff --git a/Geo/discreteFace.cpp b/Geo/discreteFace.cpp index 4ddf81c4d6b3bc274b85a45305619d0fdd41d694..d07aeb3e8aa2f6297399236f43746f9a7b384c99 100644 --- a/Geo/discreteFace.cpp +++ b/Geo/discreteFace.cpp @@ -30,7 +30,7 @@ void discreteFace::findEdges(std::map<MEdge, std::vector<int>, Less_Edge> &map_e for (int iEdge = 0; iEdge < e->getNumEdges(); iEdge++) { MEdge tmp_edge = e->getEdge(iEdge); std::set<MEdge, Less_Edge >::iterator itset = bound_edges.find(tmp_edge); - if (itset == bound_edges.end()) bound_edges.insert(tmp_edge); + if (itset == bound_edges.end()) bound_edges.insert(tmp_edge); else bound_edges.erase(itset); } } diff --git a/Geo/gmshFace.cpp b/Geo/gmshFace.cpp index 75eac7757911d4297f9393fc3e9db36d50ae95bc..f5686724b4d27b7bbdbe5bec938a480cfd59435e 100644 --- a/Geo/gmshFace.cpp +++ b/Geo/gmshFace.cpp @@ -358,10 +358,10 @@ bool gmshFace::buildSTLTriangulation(bool force){ int C[3]; for (int i=0;i<3;i++){ std::map<MVertex*,int>::iterator it = - _v.find(triangles_stl[j]->getVertex(j)); + _v.find(triangles_stl[j]->getVertex(j)); if (it != _v.end()){ - stl_triangles.push_back(COUNT); - _v[triangles_stl[j]->getVertex(j)] = COUNT++; + stl_triangles.push_back(COUNT); + _v[triangles_stl[j]->getVertex(j)] = COUNT++; } else stl_triangles.push_back(it->second); } diff --git a/Geo/partitionEdge.h b/Geo/partitionEdge.h index a8dfae55b6bdab275924e029f13921410ab92fd8..e9324ac82ba7225f1059526adb454dec876d4390 100644 --- a/Geo/partitionEdge.h +++ b/Geo/partitionEdge.h @@ -15,7 +15,7 @@ class partitionEdge : public discreteEdge { std::vector<int> _partitions; public: partitionEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1, - std::vector<int> &partitions) + std::vector<int> &partitions) : discreteEdge(model,num,_v0,_v1),_partitions(partitions) { std::sort(_partitions.begin(),_partitions.end()); diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp index 91b58b4478cf5c0b6f5823617cb751536206b37a..f9df1bbcd31e6f62f5c304fc2e3d5eb7e7ba3792 100644 --- a/Mesh/BackgroundMesh.cpp +++ b/Mesh/BackgroundMesh.cpp @@ -323,19 +323,19 @@ void backgroundMesh::propagate1dMesh(GFace *_gf) for( ; it != e.end(); ++it ){ if (!(*it)->isSeam(_gf)){ for(unsigned int i = 0; i < (*it)->lines.size(); i++ ){ - MVertex *v1 = (*it)->lines[i]->getVertex(0); - MVertex *v2 = (*it)->lines[i]->getVertex(1); - double d = sqrt((v1->x() - v2->x()) * (v1->x() - v2->x()) + + MVertex *v1 = (*it)->lines[i]->getVertex(0); + MVertex *v2 = (*it)->lines[i]->getVertex(1); + double d = sqrt((v1->x() - v2->x()) * (v1->x() - v2->x()) + (v1->y() - v2->y()) * (v1->y() - v2->y()) + (v1->z() - v2->z()) * (v1->z() -v2->z())); - for (int k=0;k<2;k++){ - MVertex *v = (*it)->lines[i]->getVertex(k); - std::map<MVertex*, double>::iterator itv = sizes.find(v); - if (itv == sizes.end()) - sizes[v] = d; - else - itv->second = 0.5 * (itv->second + d); - } + for (int k=0;k<2;k++){ + MVertex *v = (*it)->lines[i]->getVertex(k); + std::map<MVertex*, double>::iterator itv = sizes.find(v); + if (itv == sizes.end()) + sizes[v] = d; + else + itv->second = 0.5 * (itv->second + d); + } } } } @@ -423,13 +423,13 @@ void backgroundMesh::updateSizes(GFace *_gf) for( ; it != e.end(); ++it ){ if (!(*it)->isSeam(_gf)){ for(unsigned int i = 0; i < (*it)->lines.size(); i++ ){ - MVertex *v1 = (*it)->lines[i]->getVertex(0); - MVertex *v2 = (*it)->lines[i]->getVertex(1); - MVertex *v1_2D = _3Dto2D[ v1 ]; - MVertex *v2_2D = _3Dto2D[ v2 ]; - - myAssembler.fixVertex(v1, 0, 1, _sizes[v1_2D]); - myAssembler.fixVertex(v2, 0, 1, _sizes[v2_2D]); + MVertex *v1 = (*it)->lines[i]->getVertex(0); + MVertex *v2 = (*it)->lines[i]->getVertex(1); + MVertex *v1_2D = _3Dto2D[ v1 ]; + MVertex *v2_2D = _3Dto2D[ v2 ]; + + myAssembler.fixVertex(v1, 0, 1, _sizes[v1_2D]); + myAssembler.fixVertex(v2, 0, 1, _sizes[v2_2D]); } } } @@ -455,8 +455,8 @@ void backgroundMesh::updateSizes(GFace *_gf) for (int i = 0; i < e->getNumVertices();i++){ double TERM = 0.0; for (int j = 0; j < e->getNumVertices();j++){ - MVertex *v_2D = _3Dto2D[ e->getVertex(j) ]; - TERM+=_sizes[v_2D] * mass_matrix(i,j); + MVertex *v_2D = _3Dto2D[ e->getVertex(j) ]; + TERM+=_sizes[v_2D] * mass_matrix(i,j); } myAssembler.assemble(e->getVertex(i),0,1,TERM); } @@ -503,18 +503,18 @@ void backgroundMesh::print (const std::string &filename, GFace *gf) const std::map<MVertex*,double>::const_iterator itv3 = _sizes.find(v3); if (!gf){ fprintf(f,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g) {%g,%g,%g};\n", - v1->x(),v1->y(),v1->z(), - v2->x(),v2->y(),v2->z(), - v3->x(),v3->y(),v3->z(),itv1->second,itv2->second,itv3->second); + v1->x(),v1->y(),v1->z(), + v2->x(),v2->y(),v2->z(), + v3->x(),v3->y(),v3->z(),itv1->second,itv2->second,itv3->second); } else { GPoint p1 = gf->point(SPoint2(v1->x(),v1->y())); GPoint p2 = gf->point(SPoint2(v2->x(),v2->y())); GPoint p3 = gf->point(SPoint2(v3->x(),v3->y())); fprintf(f,"ST(%g,%g,%g,%g,%g,%g,%g,%g,%g) {%g,%g,%g};\n", - p1.x(),p1.y(),p1.z(), - p2.x(),p2.y(),p2.z(), - p3.x(),p3.y(),p3.z(),itv1->second,itv2->second,itv3->second); + p1.x(),p1.y(),p1.z(), + p2.x(),p2.y(),p2.z(), + p3.x(),p3.y(),p3.z(),itv1->second,itv2->second,itv3->second); } } diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index a9097099ac4c63e5c34d82d6e1d827d17f324151..854b569d89d1cb21298dbe08fca008298817f685 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -412,9 +412,9 @@ static void Mesh2D(GModel *m) std::set<GFace*> compFaces; for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){ if ((*it)->geomType() != GEntity::CompoundSurface) - classFaces.insert(*it); + classFaces.insert(*it); else - compFaces.insert(*it); + compFaces.insert(*it); } std::for_each(classFaces.begin(), classFaces.end(), meshGFace()); std::for_each(compFaces.begin(), compFaces.end(), meshGFace()); diff --git a/Mesh/highOrderSmoother.cpp b/Mesh/highOrderSmoother.cpp index 321eacfb1b6390c82d50a623043323b7387802b7..1eca457d67911301f81e6cf11b567bc97c88b3ec 100644 --- a/Mesh/highOrderSmoother.cpp +++ b/Mesh/highOrderSmoother.cpp @@ -535,10 +535,10 @@ void highOrderSmoother::smooth_metric(std::vector<MElement*> & all, GFace *gf) } double highOrderSmoother::smooth_metric_(std::vector<MElement*> & v, - GFace *gf, - dofManager<double> &myAssembler, - std::set<MVertex*> &verticesToMove, - elasticityTerm &El) + GFace *gf, + dofManager<double> &myAssembler, + std::set<MVertex*> &verticesToMove, + elasticityTerm &El) { std::set<MVertex*>::iterator it; @@ -566,7 +566,7 @@ double highOrderSmoother::smooth_metric_(std::vector<MElement*> & v, J23K33.mult(D3, R2); J23K33.print("J23K33"); for (int j = 0; j < n2; j++){ - Dof RDOF = El.getLocalDofR(&se, j); + Dof RDOF = El.getLocalDofR(&se, j); myAssembler.assemble(RDOF, -R2(j)); for (int k = 0; k < n2; k++){ Dof CDOF = El.getLocalDofC(&se, k); @@ -709,8 +709,8 @@ void highOrderSmoother::smooth(std::vector<MElement*> &all) } void highOrderSmoother::smooth_cavity(std::vector<MElement*>& cavity, - std::vector<MElement*>& old_elems, - GFace* gf) { + std::vector<MElement*>& old_elems, + GFace* gf) { printf("Smoothing a cavity...\n"); printf("Old elems : %d and %d\n", old_elems[0]->getNum(), old_elems[1]->getNum()); @@ -744,10 +744,10 @@ void highOrderSmoother::smooth_cavity(std::vector<MElement*>& cavity, if (find(old_elems.begin(), old_elems.end(), layer[i]) == old_elems.end()) { printf("In the layer, there is element %d\n", layer[i]->getNum()); for (int j = 0; j < layer[i]->getNumVertices(); j++){ - MVertex *vert = layer[i]->getVertex(j); - myAssembler.fixVertex(vert, 0, getTag(), 0); - myAssembler.fixVertex(vert, 1, getTag(), 0); - printf("Fixing vertex (internal) %d\n", vert->getNum()); + MVertex *vert = layer[i]->getVertex(j); + myAssembler.fixVertex(vert, 0, getTag(), 0); + myAssembler.fixVertex(vert, 1, getTag(), 0); + printf("Fixing vertex (internal) %d\n", vert->getNum()); } } } @@ -761,26 +761,26 @@ void highOrderSmoother::smooth_cavity(std::vector<MElement*>& cavity, //std::map<MVertex*,SVector3> verticesToMove; std::set<MVertex*> verticesToMove; - printf(" size = %d\n",_straightSidedLocation.size()); + printf(" size = %d\n", (int)_straightSidedLocation.size()); for (unsigned int i = 0; i < cavity.size(); i++){ for (int j = 0; j < cavity[i]->getNumVertices(); j++){ MVertex *vert = cavity[i]->getVertex(j); its = _straightSidedLocation.find(vert); if (its == _straightSidedLocation.end()) { - printf("SETTING LOCATIONS for %d\n",vert->getNum()); + printf("SETTING LOCATIONS for %d\n",vert->getNum()); _straightSidedLocation[vert] = SVector3(vert->x(), vert->y(), vert->z()); _targetLocation[vert] = SVector3(vert->x(), vert->y(), vert->z()); }else { - vert->x() = its->second.x(); + vert->x() = its->second.x(); vert->y() = its->second.y(); vert->z() = its->second.z(); if (vert->onWhat()->dim() < _dim){ myAssembler.fixVertex(vert, 0, getTag(), 0); myAssembler.fixVertex(vert, 1, getTag(), 0); - printf("Fixing vertex (boundary) %d\n", vert->getNum()); + printf("Fixing vertex (boundary) %d\n", vert->getNum()); } } } @@ -1368,27 +1368,27 @@ static int swapHighOrderTriangles(GFace *gf, mesh_vertices2.insert(mesh_vertices2.end(),vf4.begin(),vf4.end()); for(std::vector<MVertex*>::iterator vit = ve1.begin(); vit != ve1.end(); vit++) { - if (find(ve2.begin(),ve2.end(),*vit)!=ve2.end()) - v_removed.insert(*vit); + if (find(ve2.begin(),ve2.end(),*vit)!=ve2.end()) + v_removed.insert(*vit); } for(std::vector<MVertex*>::iterator vit = ve3.begin(); vit != ve3.end(); vit++) { - //if (find(ve4.begin(),ve4.end(),*vit)!=ve4.end()) - // mesh_vertices2.push_back(*vit); + //if (find(ve4.begin(),ve4.end(),*vit)!=ve4.end()) + // mesh_vertices2.push_back(*vit); } nbSwap++; } else { if (!t1_rem || !t2_rem) { - for(std::vector<MVertex*>::iterator vit = ve1.begin(); vit != ve1.end(); vit++) { - //if (find(ve2.begin(),ve2.end(),*vit)!=ve2.end()) - //mesh_vertices2.push_back(*vit); - } + for(std::vector<MVertex*>::iterator vit = ve1.begin(); vit != ve1.end(); vit++) { + //if (find(ve2.begin(),ve2.end(),*vit)!=ve2.end()) + //mesh_vertices2.push_back(*vit); + } } for(std::vector<MVertex*>::iterator vit = ve3.begin(); vit != ve3.end(); vit++) { - if (find(ve4.begin(),ve4.end(),*vit)!=ve4.end()) - v_removed.insert(*vit); + if (find(ve4.begin(),ve4.end(),*vit)!=ve4.end()) + v_removed.insert(*vit); } delete itp->t3; delete itp->t4; diff --git a/Mesh/highOrderSmoother.h b/Mesh/highOrderSmoother.h index b5949b558a1691e444a3c027191c30db7e67436e..766613cf5e0f0601129dd9a561d7ec4c3732d940 100644 --- a/Mesh/highOrderSmoother.h +++ b/Mesh/highOrderSmoother.h @@ -53,8 +53,8 @@ public: void smooth_pNpoint(GFace *); void smooth(GRegion*); void smooth_cavity(std::vector<MElement*> &, - std::vector<MElement*> &, - GFace *gf); + std::vector<MElement*> &, + GFace *gf); int getTag() const { return _tag; } void swap(GFace *, edgeContainer &edgeVertices, diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index 3b2971cbed72bc429ea18cd0a085fc5d8ff5dc0c..537117d1f59d2bf304a3b99a5715cc184730ca45 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -272,8 +272,8 @@ static bool meshGenerator(GFace *gf, int RECUR_ITER, if((*it)->isSeam(gf)) return false; if(!(*it)->isMeshDegenerated()){ for(unsigned int i = 0; i< (*it)->lines.size(); i++){ - all_vertices.insert((*it)->lines[i]->getVertex(0)); - all_vertices.insert((*it)->lines[i]->getVertex(1)); + all_vertices.insert((*it)->lines[i]->getVertex(0)); + all_vertices.insert((*it)->lines[i]->getVertex(1)); } } ++it; @@ -284,7 +284,7 @@ static bool meshGenerator(GFace *gf, int RECUR_ITER, while(it != emb_edges.end()){ if(!(*it)->isMeshDegenerated()){ all_vertices.insert((*it)->mesh_vertices.begin(), - (*it)->mesh_vertices.end() ); + (*it)->mesh_vertices.end() ); all_vertices.insert((*it)->getBeginVertex()->mesh_vertices.begin(), (*it)->getBeginVertex()->mesh_vertices.end()); all_vertices.insert((*it)->getEndVertex()->mesh_vertices.begin(), @@ -304,7 +304,7 @@ static bool meshGenerator(GFace *gf, int RECUR_ITER, // add _additional_vertices all_vertices.insert(gf->_additional_vertices.begin(), - gf->_additional_vertices.end()); + gf->_additional_vertices.end()); if(all_vertices.size() < 3){ @@ -442,7 +442,7 @@ static bool meshGenerator(GFace *gf, int RECUR_ITER, if(edgesNotRecovered.size()){ std::ostringstream sstream; for(std::set<EdgeToRecover>::iterator itr = edgesNotRecovered.begin(); - itr != edgesNotRecovered.end(); ++itr) + itr != edgesNotRecovered.end(); ++itr) sstream << " " << itr->ge->tag(); Msg::Warning(":-( There are %d intersections in the 1D mesh (curves%s)", edgesNotRecovered.size(), sstream.str().c_str()); @@ -602,10 +602,10 @@ static bool meshGenerator(GFace *gf, int RECUR_ITER, optimizeMeshBDS(gf, *m, 2); } computeMeshSizeFieldAccuracy(gf, *m, gf->meshStatistics.efficiency_index, - gf->meshStatistics.longest_edge_length, - gf->meshStatistics.smallest_edge_length, - gf->meshStatistics.nbEdge, - gf->meshStatistics.nbGoodLength); + gf->meshStatistics.longest_edge_length, + gf->meshStatistics.smallest_edge_length, + gf->meshStatistics.nbEdge, + gf->meshStatistics.nbGoodLength); gf->meshStatistics.status = GFace::DONE; // fill the small gmsh structures @@ -637,7 +637,7 @@ static bool meshGenerator(GFace *gf, int RECUR_ITER, // may be created, for example on a sphere that contains one // pole if(v1 != v2 && v1 != v3 && v2 != v3) - gf->triangles.push_back(new MTriangle(v1, v2, v3)); + gf->triangles.push_back(new MTriangle(v1, v2, v3)); } else{ MVertex *v4 = recoverMap[n[3]]; @@ -675,10 +675,10 @@ static bool meshGenerator(GFace *gf, int RECUR_ITER, if(gf->meshAttributes.recombine) recombineIntoQuads(gf); computeElementShapes(gf, gf->meshStatistics.worst_element_shape, - gf->meshStatistics.average_element_shape, - gf->meshStatistics.best_element_shape, - gf->meshStatistics.nbTriangle, - gf->meshStatistics.nbGoodQuality); + gf->meshStatistics.average_element_shape, + gf->meshStatistics.best_element_shape, + gf->meshStatistics.nbTriangle, + gf->meshStatistics.nbGoodQuality); return true; } @@ -786,73 +786,73 @@ static bool buildConsecutiveListOfVertices(GFace *gf, GEdgeLoop &gel, if(seam){ mesh1d_seam = meshes_seam[ge]; } mesh1d_reversed.insert(mesh1d_reversed.begin(), mesh1d.rbegin(), mesh1d.rend()); if(seam) mesh1d_seam_reversed.insert(mesh1d_seam_reversed.begin(), - mesh1d_seam.rbegin(),mesh1d_seam.rend()); + mesh1d_seam.rbegin(),mesh1d_seam.rend()); if(!counter){ - counter++; - if(seam && seam_the_first){ - coords = ((*it)._sign == 1) ? mesh1d_seam : mesh1d_seam_reversed; - found = (*it); - Msg::Info("This test case would have failed in previous Gmsh versions ;-)"); - } - else{ - coords = ((*it)._sign == 1) ? mesh1d : mesh1d_reversed; - found = (*it); - } - unordered.erase(it); - if(MYDEBUG) - printf("Starting with edge = %d seam %d\n", (*it).ge->tag(), seam); - break; + counter++; + if(seam && seam_the_first){ + coords = ((*it)._sign == 1) ? mesh1d_seam : mesh1d_seam_reversed; + found = (*it); + Msg::Info("This test case would have failed in previous Gmsh versions ;-)"); + } + else{ + coords = ((*it)._sign == 1) ? mesh1d : mesh1d_reversed; + found = (*it); + } + unordered.erase(it); + if(MYDEBUG) + printf("Starting with edge = %d seam %d\n", (*it).ge->tag(), seam); + break; } else{ - if(MYDEBUG) - printf("Followed by edge = %d\n", (*it).ge->tag()); - SPoint2 first_coord = mesh1d[0]; - double d = -1, d_reversed = -1, d_seam = -1, d_seam_reversed = -1; - d = dist2(last_coord, first_coord); - if(MYDEBUG) - printf("%g %g dist = %12.5E\n", first_coord.x(), first_coord.y(), d); - if(d < tol){ - coords.clear(); - coords = mesh1d; - found = GEdgeSigned(1,ge); - unordered.erase(it); - goto Finalize; - } - SPoint2 first_coord_reversed = mesh1d_reversed[0]; - d_reversed = dist2(last_coord, first_coord_reversed); - if(MYDEBUG) - printf("%g %g dist_reversed = %12.5E\n", - first_coord_reversed.x(), first_coord_reversed.y(), d_reversed); - if(d_reversed < tol){ - coords.clear(); - coords = mesh1d_reversed; - found = (GEdgeSigned(-1,ge)); - unordered.erase(it); - goto Finalize; - } - if(seam){ - SPoint2 first_coord_seam = mesh1d_seam[0]; - SPoint2 first_coord_seam_reversed = mesh1d_seam_reversed[0]; - d_seam = dist2(last_coord,first_coord_seam); - if(MYDEBUG) printf("dist_seam = %12.5E\n", d_seam); - if(d_seam < tol){ - coords.clear(); - coords = mesh1d_seam; - found = (GEdgeSigned(1,ge)); - unordered.erase(it); - goto Finalize; - } - d_seam_reversed = dist2(last_coord, first_coord_seam_reversed); - if(MYDEBUG) printf("dist_seam_reversed = %12.5E\n", d_seam_reversed); - if(d_seam_reversed < tol){ - coords.clear(); - coords = mesh1d_seam_reversed; - found = GEdgeSigned(-1, ge); - unordered.erase(it); - break; - goto Finalize; - } - } + if(MYDEBUG) + printf("Followed by edge = %d\n", (*it).ge->tag()); + SPoint2 first_coord = mesh1d[0]; + double d = -1, d_reversed = -1, d_seam = -1, d_seam_reversed = -1; + d = dist2(last_coord, first_coord); + if(MYDEBUG) + printf("%g %g dist = %12.5E\n", first_coord.x(), first_coord.y(), d); + if(d < tol){ + coords.clear(); + coords = mesh1d; + found = GEdgeSigned(1,ge); + unordered.erase(it); + goto Finalize; + } + SPoint2 first_coord_reversed = mesh1d_reversed[0]; + d_reversed = dist2(last_coord, first_coord_reversed); + if(MYDEBUG) + printf("%g %g dist_reversed = %12.5E\n", + first_coord_reversed.x(), first_coord_reversed.y(), d_reversed); + if(d_reversed < tol){ + coords.clear(); + coords = mesh1d_reversed; + found = (GEdgeSigned(-1,ge)); + unordered.erase(it); + goto Finalize; + } + if(seam){ + SPoint2 first_coord_seam = mesh1d_seam[0]; + SPoint2 first_coord_seam_reversed = mesh1d_seam_reversed[0]; + d_seam = dist2(last_coord,first_coord_seam); + if(MYDEBUG) printf("dist_seam = %12.5E\n", d_seam); + if(d_seam < tol){ + coords.clear(); + coords = mesh1d_seam; + found = (GEdgeSigned(1,ge)); + unordered.erase(it); + goto Finalize; + } + d_seam_reversed = dist2(last_coord, first_coord_seam_reversed); + if(MYDEBUG) printf("dist_seam_reversed = %12.5E\n", d_seam_reversed); + if(d_seam_reversed < tol){ + coords.clear(); + coords = mesh1d_seam_reversed; + found = GEdgeSigned(-1, ge); + unordered.erase(it); + break; + goto Finalize; + } + } } ++it; } @@ -863,8 +863,8 @@ static bool buildConsecutiveListOfVertices(GFace *gf, GEdgeLoop &gel, // has to be taken with the other parametric coordinates (because it is // only present once in the closure of the domain). for(std::map<BDS_Point*, MVertex*>::iterator it = recoverMapLocal.begin(); - it != recoverMapLocal.end(); ++it){ - m->del_point(it->first); + it != recoverMapLocal.end(); ++it){ + m->del_point(it->first); } return false; } @@ -873,17 +873,17 @@ static bool buildConsecutiveListOfVertices(GFace *gf, GEdgeLoop &gel, if(found._sign == 1){ edgeLoop.push_back(found.ge->getBeginVertex()->mesh_vertices[0]); for(unsigned int i = 0; i <found.ge->mesh_vertices.size(); i++) - edgeLoop.push_back(found.ge->mesh_vertices[i]); + edgeLoop.push_back(found.ge->mesh_vertices[i]); } else{ edgeLoop.push_back(found.ge->getEndVertex()->mesh_vertices[0]); for(int i = found.ge->mesh_vertices.size() - 1; i >= 0; i--) - edgeLoop.push_back(found.ge->mesh_vertices[i]); + edgeLoop.push_back(found.ge->mesh_vertices[i]); } if(MYDEBUG) printf("edge %d size %d size %d\n", - found.ge->tag(), (int)edgeLoop.size(), (int)coords.size()); + found.ge->tag(), (int)edgeLoop.size(), (int)coords.size()); std::vector<BDS_Point*> edgeLoop_BDS; for(unsigned int i = 0; i < edgeLoop.size(); i++){ @@ -895,24 +895,24 @@ static bool buildConsecutiveListOfVertices(GFace *gf, GEdgeLoop &gel, V = param.y() / m->scalingV; BDS_Point *pp = m->add_point(count + countTot, U, V, gf); if(ge->dim() == 0){ - pp->lcBGM() = BGM_MeshSize(ge, 0, 0, here->x(), here->y(), here->z()); + pp->lcBGM() = BGM_MeshSize(ge, 0, 0, here->x(), here->y(), here->z()); } else if(ge->dim() == 1){ - double u; - here->getParameter(0, u); - pp->lcBGM() = BGM_MeshSize(ge, u, 0,here->x(), here->y(), here->z()); + double u; + here->getParameter(0, u); + pp->lcBGM() = BGM_MeshSize(ge, u, 0,here->x(), here->y(), here->z()); } else - pp->lcBGM() = MAX_LC; + pp->lcBGM() = MAX_LC; pp->lc() = pp->lcBGM(); m->add_geom (ge->tag(), ge->dim()); BDS_GeomEntity *g = m->get_geom(ge->tag(), ge->dim()); pp->g = g; if(MYDEBUG) - printf("point %3d (%8.5f %8.5f : %8.5f %8.5f) (%2d,%2d)\n", - count, pp->u, pp->v, param.x(), param.y(), pp->g->classif_tag, - pp->g->classif_degree); + printf("point %3d (%8.5f %8.5f : %8.5f %8.5f) (%2d,%2d)\n", + count, pp->u, pp->v, param.x(), param.y(), pp->g->classif_tag, + pp->g->classif_degree); bbox += SPoint3(U, V, 0); edgeLoop_BDS.push_back(pp); recoverMapLocal[pp] = here; @@ -1402,7 +1402,7 @@ void partitionAndRemesh(GFaceCompound *gf) f_compound.push_back(pf); Msg::Info("Parametrize Compound Surface (%d) = %d discrete face", num_gfc, pf->tag() ); GFaceCompound *gfc = new GFaceCompound(gf->model(), num_gfc, f_compound, - b[0], b[1], b[2], b[3], 0, gf->getTypeOfMapping() ); + b[0], b[1], b[2], b[3], 0, gf->getTypeOfMapping() ); gf->model()->add(gfc); gfc->parametrize(); @@ -1429,8 +1429,8 @@ void partitionAndRemesh(GFaceCompound *gf) MTriangle *t = gfc->triangles[j]; std::vector<MVertex *> v(3); for(int k = 0; k < 3; k++){ - v[k] = t->getVertex(k); - allNod.insert(v[k]); + v[k] = t->getVertex(k); + allNod.insert(v[k]); } gf->triangles.push_back(new MTriangle(v[0], v[1], v[2])); } @@ -1486,8 +1486,8 @@ void partitionAndRemesh(GFaceCompound *gf) std::vector<MVertex*> edge_vertices = gec->mesh_vertices; std::vector<MVertex*>::const_iterator itv = edge_vertices.begin(); for(; itv != edge_vertices.end(); itv++){ - std::vector<MVertex*>::iterator itve = std::find(gf->mesh_vertices.begin(), gf->mesh_vertices.end(), *itv); - if (itve != gf->mesh_vertices.end()) gf->mesh_vertices.erase(itve); + std::vector<MVertex*>::iterator itve = std::find(gf->mesh_vertices.begin(), gf->mesh_vertices.end(), *itv); + if (itve != gf->mesh_vertices.end()) gf->mesh_vertices.erase(itve); } MVertex *vB = (*it)->getBeginVertex()->mesh_vertices[0]; std::vector<MVertex*>::iterator itvB = std::find(gf->mesh_vertices.begin(), gf->mesh_vertices.end(), vB); diff --git a/Mesh/meshGFaceBDS.cpp b/Mesh/meshGFaceBDS.cpp index 85c4e196269e9090f880d6ee079cd1016d088923..9cd56ca934d26f855ab66c0bd13940783ba9d023 100644 --- a/Mesh/meshGFaceBDS.cpp +++ b/Mesh/meshGFaceBDS.cpp @@ -522,22 +522,22 @@ void splitEdgePass(GFace *gf, BDS_Mesh &m, double MAXE_, int &nb_split) mid = m.add_point(++m.MAXPOINTNUMBER, gpp.x(),gpp.y(),gpp.z()); mid->u = U; mid->v = V; - if (backgroundMesh::current()){ - mid->lc() = mid->lcBGM() = - backgroundMesh::current()->operator() ( - (coord * e->p1->u + (1 - coord) * e->p2->u)*m.scalingU, - (coord * e->p1->v + (1 - coord) * e->p2->v)*m.scalingV, - 0.0); - } - else { - mid->lcBGM() = BGM_MeshSize - (gf, - (coord * e->p1->u + (1 - coord) * e->p2->u)*m.scalingU, - (coord * e->p1->v + (1 - coord) * e->p2->v)*m.scalingV, - mid->X,mid->Y,mid->Z); - mid->lc() = 0.5 * (e->p1->lc() + e->p2->lc()); - } - if(!m.split_edge(e, mid)) m.del_point(mid); + if (backgroundMesh::current()){ + mid->lc() = mid->lcBGM() = + backgroundMesh::current()->operator() ( + (coord * e->p1->u + (1 - coord) * e->p2->u)*m.scalingU, + (coord * e->p1->v + (1 - coord) * e->p2->v)*m.scalingV, + 0.0); + } + else { + mid->lcBGM() = BGM_MeshSize + (gf, + (coord * e->p1->u + (1 - coord) * e->p2->u)*m.scalingU, + (coord * e->p1->v + (1 - coord) * e->p2->v)*m.scalingV, + mid->X,mid->Y,mid->Z); + mid->lc() = 0.5 * (e->p1->lc() + e->p2->lc()); + } + if(!m.split_edge(e, mid)) m.del_point(mid); else nb_split++; } } diff --git a/Mesh/meshGFaceLloyd.cpp b/Mesh/meshGFaceLloyd.cpp index 487f89ed1fb9797739a4ec988da8adcdf049f5ca..48fd0c8e1958675fb90379d90825667ab1786b0f 100644 --- a/Mesh/meshGFaceLloyd.cpp +++ b/Mesh/meshGFaceLloyd.cpp @@ -32,10 +32,10 @@ void lloydAlgorithm::operator () ( GFace * gf) { Range<double> dv = gf->parBounds(1) ; const double LC2D = sqrt ((du.high()-du.low())*(du.high()-du.low()) + - (dv.high()-dv.low())*(dv.high()-dv.low())); + (dv.high()-dv.low())*(dv.high()-dv.low())); printf("Lloyd on face %d %d elements %d nodes LC %g\n", gf->tag(), - gf->getNumMeshElements(), (int)all.size(), LC2D); + gf->getNumMeshElements(), (int)all.size(), LC2D); int i = 0; @@ -73,18 +73,18 @@ void lloydAlgorithm::operator () ( GFace * gf) { PointRecord &pt = triangulator.points[i]; MVertex *v = (MVertex*)pt.data; if (v->onWhat() == gf && !triangulator.onHull(i)){ - // get the voronoi corners - std::vector<SPoint2> pts; - triangulator.voronoiCell (i,pts); - double E; - SPoint2 p(pt.where.h,pt.where.v); - if (!infiniteNorm){ - centroidOfPolygon (p,pts, cgs(i,0),cgs(i,1),E,backgroundMesh::current()); - } - else { - centroidOfOrientedBox (pts, 0.0, cgs(i,0),cgs(i,1),E); - } - ENERGY += E; + // get the voronoi corners + std::vector<SPoint2> pts; + triangulator.voronoiCell (i,pts); + double E; + SPoint2 p(pt.where.h,pt.where.v); + if (!infiniteNorm){ + centroidOfPolygon (p,pts, cgs(i,0),cgs(i,1),E,backgroundMesh::current()); + } + else { + centroidOfOrientedBox (pts, 0.0, cgs(i,0),cgs(i,1),E); + } + ENERGY += E; }// if (v->onWhat() == gf) else { } @@ -99,8 +99,8 @@ void lloydAlgorithm::operator () ( GFace * gf) { for(PointNumero i = 0; i < triangulator.numPoints; i++) { MVertex *v = (MVertex*)triangulator.points[i].data; if (v->onWhat() == gf && !triangulator.onHull(i)){ - triangulator.points[i].where.h = cgs(i,0); - triangulator.points[i].where.v = cgs(i,1); + triangulator.points[i].where.h = cgs(i,0); + triangulator.points[i].where.v = cgs(i,1); } } @@ -135,8 +135,8 @@ void lloydAlgorithm::operator () ( GFace * gf) { mesher(gf); // assign thos vertices to the face internal vertices gf->mesh_vertices.insert(gf->mesh_vertices.begin(), - gf->_additional_vertices.begin(), - gf->_additional_vertices.end()); + gf->_additional_vertices.begin(), + gf->_additional_vertices.end()); // clear the list of additional vertices gf->_additional_vertices.clear(); } diff --git a/Mesh/meshPartition.cpp b/Mesh/meshPartition.cpp index aaf76311d1211118b6ea1c5341b94c3105cc0184..e50c3ad8981d5992dc3ac331841ef4046dba0f94 100644 --- a/Mesh/meshPartition.cpp +++ b/Mesh/meshPartition.cpp @@ -195,9 +195,9 @@ int RenumberMeshElements( std::vector<MElement*> &elements, meshPartitionOptions gf->mesh_vertices.push_back(*it); for (std::vector<MElement* >::iterator it = elements.begin(); it != elements.end(); it++){ if ((*it)->getType() == TYPE_TRI) - gf->triangles.push_back((MTriangle*)(*it)); + gf->triangles.push_back((MTriangle*)(*it)); else if ((*it)->getType() == TYPE_QUA) - gf->quadrangles.push_back((MQuadrangle*)(*it)); + gf->quadrangles.push_back((MQuadrangle*)(*it)); } tmp_model->add(gf); RenumberMesh(tmp_model,options,elements); @@ -209,9 +209,9 @@ int RenumberMeshElements( std::vector<MElement*> &elements, meshPartitionOptions gf->mesh_vertices.push_back(*it); for (std::vector<MElement* >::iterator it = elements.begin(); it != elements.end(); it++){ if ((*it)->getType() == TYPE_TRI) - gf->triangles.push_back((MTriangle*)(*it)); + gf->triangles.push_back((MTriangle*)(*it)); else if ((*it)->getType() == TYPE_QUA) - gf->quadrangles.push_back((MQuadrangle*)(*it)); + gf->quadrangles.push_back((MQuadrangle*)(*it)); } tmp_model->add(gf); } @@ -405,28 +405,28 @@ int PartitionGraph(Graph &graph, meshPartitionOptions &options) metisOptions[2] = 1; metisOptions[3] = options.refine_algorithm; metisOptions[4] = 0; - METIS_PartGraphKway + METIS_PartGraphKway (&n, &graph.xadj[graph.section[iSec]], &graph.adjncy[graph.section[iSec]], NULL, NULL, &wgtflag, &numflag, &options.num_partitions, metisOptions, &edgeCut, &graph.partition[graph.section[iSec]]); - break; - case 3: // Nodal weight - printf("METIS with weights\n"); + break; + case 3: // Nodal weight + printf("METIS with weights\n"); metisOptions[0] = 1; metisOptions[1] = options.edge_matching; metisOptions[2] = 1; metisOptions[3] = 1; metisOptions[4] = 0; - wgtflag = 2; - graph.fillWeights(options.nodalWeights); + wgtflag = 2; + graph.fillWeights(options.nodalWeights); METIS_PartGraphKway (&n, &graph.xadj[graph.section[iSec]], &graph.adjncy[graph.section[iSec]], &graph.vwgts[graph.section[iSec]], NULL, &wgtflag, &numflag, &options.num_partitions, metisOptions, &edgeCut, &graph.partition[graph.section[iSec]]); break; - } + } } catch(...) { Msg::Error("METIS threw an exception"); @@ -462,8 +462,8 @@ int RenumberGraph(Graph &graph, meshPartitionOptions &options) int options = 0; int *perm = new int[n]; METIS_NodeND(&n, - &graph.xadj[graph.section[iSec]], - &graph.adjncy[graph.section[iSec]], &numflag,&options,perm,&graph.partition[graph.section[iSec]]); + &graph.xadj[graph.section[iSec]], + &graph.adjncy[graph.section[iSec]], &numflag,&options,perm,&graph.partition[graph.section[iSec]]); delete [] perm; } catch(...) { @@ -868,7 +868,7 @@ struct MatchBoElemToGrVertex template <class ITERATOR> void fillit_(std::multimap<MFace, MElement*, Less_Face> &faceToElement, - ITERATOR it_beg, ITERATOR it_end) + ITERATOR it_beg, ITERATOR it_end) { for (ITERATOR IT = it_beg; IT != it_end ; ++IT){ MElement *el = *IT; @@ -881,7 +881,7 @@ void fillit_(std::multimap<MFace, MElement*, Less_Face> &faceToElement, template <class ITERATOR> void fillit_(std::multimap<MEdge, MElement*, Less_Edge> &edgeToElement, - ITERATOR it_beg, ITERATOR it_end) + ITERATOR it_beg, ITERATOR it_end) { for (ITERATOR IT = it_beg; IT != it_end; ++IT){ MElement *el = *IT; @@ -894,7 +894,7 @@ void fillit_(std::multimap<MEdge, MElement*, Less_Edge> &edgeToElement, template <class ITERATOR> void fillit_(std::multimap<MVertex*, MElement*> &vertexToElement, - ITERATOR it_beg, ITERATOR it_end) + ITERATOR it_beg, ITERATOR it_end) { for (ITERATOR IT = it_beg; IT != it_end ; ++IT){ MElement *el = *IT; @@ -906,8 +906,8 @@ void fillit_(std::multimap<MVertex*, MElement*> &vertexToElement, } void assignPartitionBoundary(GModel *model, MFace &me, - std::set<partitionFace*, Less_partitionFace> &pfaces, - std::vector<MElement*> &v) + std::set<partitionFace*, Less_partitionFace> &pfaces, + std::vector<MElement*> &v) { std::vector<int> v2; v2.push_back(v[0]->getPartition()); @@ -915,8 +915,8 @@ void assignPartitionBoundary(GModel *model, MFace &me, bool found = false; for (unsigned int j = 0; j < v2.size(); j++){ if (v[i]->getPartition() == v2[j]){ - found = true; - break; + found = true; + break; } } if (!found)v2.push_back(v[i]->getPartition()); @@ -937,14 +937,14 @@ void assignPartitionBoundary(GModel *model, MFace &me, else ppe = *it; // to finish !! ppe->triangles.push_back(new MTriangle (me.getVertex(0),me.getVertex(1), - me.getVertex(2))); + me.getVertex(2))); } void assignPartitionBoundary(GModel *model, - MEdge &me, - std::set<partitionEdge*, Less_partitionEdge> &pedges, - std::vector<MElement*> &v, - std::set<partitionFace*, Less_partitionFace> &pfaces) + MEdge &me, + std::set<partitionEdge*, Less_partitionEdge> &pedges, + std::vector<MElement*> &v, + std::set<partitionFace*, Less_partitionFace> &pfaces) { std::vector<int> v2; v2.push_back(v[0]->getPartition()); @@ -952,8 +952,8 @@ void assignPartitionBoundary(GModel *model, bool found = false; for (unsigned int j = 0; j < v2.size(); j++){ if (v[i]->getPartition() == v2[j]){ - found = true; - break; + found = true; + break; } } if (!found)v2.push_back(v[i]->getPartition()); @@ -997,33 +997,33 @@ void splitBoundaryEdges(GModel *model, std::set<partitionEdge*, Less_partition segments.erase(it); it++; for (int i=0; i<2; i++) { - for (std::list<MLine*>::iterator it = segments.begin() ; it != segments.end(); ++it){ - MVertex *v1 = (*it)->getVertex(0); - MVertex *v2 = (*it)->getVertex(1); - std::list<MLine*>::iterator itp; - if (v1 == vE){ - myLines.push_back(*it); - itp = it; - it++; - segments.erase(itp); - vE = v2; - i = -1; - } - else if (v2 == vE){ - myLines.push_back(*it); - itp = it; - it++; - segments.erase(itp); - vE = v1; - i=-1; - } - if (it == segments.end()) break; - } - if (vB == vE) break; - if (segments.empty()) break; - MVertex *temp = vB; - vB = vE; - vE = temp; + for (std::list<MLine*>::iterator it = segments.begin() ; it != segments.end(); ++it){ + MVertex *v1 = (*it)->getVertex(0); + MVertex *v2 = (*it)->getVertex(1); + std::list<MLine*>::iterator itp; + if (v1 == vE){ + myLines.push_back(*it); + itp = it; + it++; + segments.erase(itp); + vE = v2; + i = -1; + } + else if (v2 == vE){ + myLines.push_back(*it); + itp = it; + it++; + segments.erase(itp); + vE = v1; + i=-1; + } + if (it == segments.end()) break; + } + if (vB == vE) break; + if (segments.empty()) break; + MVertex *temp = vB; + vB = vE; + vE = temp; } if (nbSplit == 0 && segments.empty()) break; int numEdge = model->maxEdgeNum() + 1; @@ -1043,11 +1043,11 @@ void splitBoundaryEdges(GModel *model, std::set<partitionEdge*, Less_partition } void assignPartitionBoundary(GModel *model, - MVertex *ve, - std::set<partitionVertex*, Less_partitionVertex> &pvertices, - std::vector<MElement*> &v, - std::set<partitionEdge*, Less_partitionEdge> &pedges, - std::set<partitionFace*, Less_partitionFace> &pfaces) + MVertex *ve, + std::set<partitionVertex*, Less_partitionVertex> &pvertices, + std::vector<MElement*> &v, + std::set<partitionEdge*, Less_partitionEdge> &pedges, + std::set<partitionFace*, Less_partitionFace> &pfaces) { std::vector<int> v2; v2.push_back(v[0]->getPartition()); @@ -1055,8 +1055,8 @@ void assignPartitionBoundary(GModel *model, bool found = false; for (unsigned int j = 0; j < v2.size(); j++){ if (v[i]->getPartition() == v2[j]){ - found = true; - break; + found = true; + break; } } if (!found)v2.push_back(v[i]->getPartition()); @@ -1172,18 +1172,18 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells) if (meshDim > 1){ if (meshDim == 2){ for(GModel::fiter it = model->firstFace(); it != model->lastFace(); ++it){ - fillit_(edgeToElement, (*it)->triangles.begin(), (*it)->triangles.end()); - fillit_(edgeToElement, (*it)->quadrangles.begin(), (*it)->quadrangles.end()); - fillit_(edgeToElement, (*it)->polygons.begin(), (*it)->polygons.end()); + fillit_(edgeToElement, (*it)->triangles.begin(), (*it)->triangles.end()); + fillit_(edgeToElement, (*it)->quadrangles.begin(), (*it)->quadrangles.end()); + fillit_(edgeToElement, (*it)->polygons.begin(), (*it)->polygons.end()); } } else if (meshDim == 3){ for(GModel::riter it = model->firstRegion(); it != model->lastRegion(); ++it){ - fillit_(edgeToElement, (*it)->tetrahedra.begin(), (*it)->tetrahedra.end()); - fillit_(edgeToElement, (*it)->hexahedra.begin(), (*it)->hexahedra.end()); - fillit_(edgeToElement, (*it)->prisms.begin(), (*it)->prisms.end()); - fillit_(edgeToElement, (*it)->pyramids.begin(), (*it)->pyramids.end()); - fillit_(edgeToElement, (*it)->polyhedra.begin(), (*it)->polyhedra.end()); + fillit_(edgeToElement, (*it)->tetrahedra.begin(), (*it)->tetrahedra.end()); + fillit_(edgeToElement, (*it)->hexahedra.begin(), (*it)->hexahedra.end()); + fillit_(edgeToElement, (*it)->prisms.begin(), (*it)->prisms.end()); + fillit_(edgeToElement, (*it)->pyramids.begin(), (*it)->pyramids.end()); + fillit_(edgeToElement, (*it)->polyhedra.begin(), (*it)->polyhedra.end()); } } std::multimap<MEdge, MElement*, Less_Edge>::iterator it = edgeToElement.begin(); @@ -1205,18 +1205,18 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells) if (meshDim > 1){ if (meshDim == 2){ for(GModel::fiter it = model->firstFace(); it != model->lastFace(); ++it){ - fillit_(vertexToElement, (*it)->triangles.begin(), (*it)->triangles.end()); - fillit_(vertexToElement, (*it)->quadrangles.begin(), (*it)->quadrangles.end()); - fillit_(vertexToElement, (*it)->polygons.begin(), (*it)->polygons.end()); + fillit_(vertexToElement, (*it)->triangles.begin(), (*it)->triangles.end()); + fillit_(vertexToElement, (*it)->quadrangles.begin(), (*it)->quadrangles.end()); + fillit_(vertexToElement, (*it)->polygons.begin(), (*it)->polygons.end()); } } else if (meshDim == 3){ for(GModel::riter it = model->firstRegion(); it != model->lastRegion(); ++it){ - fillit_(vertexToElement, (*it)->tetrahedra.begin(), (*it)->tetrahedra.end()); - fillit_(vertexToElement, (*it)->hexahedra.begin(), (*it)->hexahedra.end()); - fillit_(vertexToElement, (*it)->prisms.begin(), (*it)->prisms.end()); - fillit_(vertexToElement, (*it)->pyramids.begin(), (*it)->pyramids.end()); - fillit_(vertexToElement, (*it)->polyhedra.begin(), (*it)->polyhedra.end()); + fillit_(vertexToElement, (*it)->tetrahedra.begin(), (*it)->tetrahedra.end()); + fillit_(vertexToElement, (*it)->hexahedra.begin(), (*it)->hexahedra.end()); + fillit_(vertexToElement, (*it)->prisms.begin(), (*it)->prisms.end()); + fillit_(vertexToElement, (*it)->pyramids.begin(), (*it)->pyramids.end()); + fillit_(vertexToElement, (*it)->polyhedra.begin(), (*it)->polyhedra.end()); } } std::multimap<MVertex*, MElement*>::iterator it = vertexToElement.begin(); @@ -1251,7 +1251,7 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells) } void createPartitionFaces(GModel *model, GFaceCompound *gf, int N, - std::vector<discreteFace*> &discreteFaces) + std::vector<discreteFace*> &discreteFaces) { #if defined(HAVE_SOLVER) // Compound is partitioned in N discrete faces @@ -1276,9 +1276,9 @@ void createPartitionFaces(GModel *model, GFaceCompound *gf, int N, MTriangle *e = (*it)->triangles[i]; int part = e->getPartition(); for(int j = 0; j < 3; j++){ - MVertex *v0 = e->getVertex(j); - //printf("v0=%d part=%d\n", v0->getNum(), part); //returns part 0 ??? - allNodes[part-1].insert(v0); + MVertex *v0 = e->getVertex(j); + //printf("v0=%d part=%d\n", v0->getNum(), part); //returns part 0 ??? + allNodes[part-1].insert(v0); } discreteFaces[part-1]->triangles.push_back(new MTriangle(e->getVertex(0),e->getVertex(1),e->getVertex(2))); } diff --git a/Mesh/meshPartition.h b/Mesh/meshPartition.h index 64cba3c6cb3d31a44c7dc080517d0b2a10daaf84..787d6218e329e5fb17fdd426187b6ef76c050970 100644 --- a/Mesh/meshPartition.h +++ b/Mesh/meshPartition.h @@ -33,6 +33,6 @@ int CreatePartitionBoundaries(GModel *model, bool createGhostCells); void splitBoundaryEdges(GModel *model, std::set<partitionEdge*, Less_partitionEdge> &newEdges); void createPartitionFaces(GModel *model, GFaceCompound * gf, int num_parts, - std::vector<discreteFace*> &pFaces); + std::vector<discreteFace*> &pFaces); #endif diff --git a/Mesh/multiscalePartition.cpp b/Mesh/multiscalePartition.cpp index 610dde401f114bb8d8e8862efed066e912b3125a..5fded42d846ab0938223312e35aeec4648ea6ace 100644 --- a/Mesh/multiscalePartition.cpp +++ b/Mesh/multiscalePartition.cpp @@ -29,13 +29,13 @@ static void recur_connect(MVertex *v, // starting form a list of elements, returns // lists of lists that are all simply connected static void recur_connect_e (const MEdge &e, - std::multimap<MEdge,MElement*,Less_Edge> &e2e, - std::set<MElement*> &group, - std::set<MEdge,Less_Edge> &touched){ + std::multimap<MEdge,MElement*,Less_Edge> &e2e, + std::set<MElement*> &group, + std::set<MEdge,Less_Edge> &touched){ if (touched.find(e) != touched.end())return; touched.insert(e); for (std::multimap <MEdge,MElement*,Less_Edge>::iterator it = e2e.lower_bound(e); - it != e2e.upper_bound(e) ; ++it){ + it != e2e.upper_bound(e) ; ++it){ group.insert(it->second); for (int i=0;i<it->second->getNumEdges();++i){ recur_connect_e (it->second->getEdge(i),e2e,group,touched); @@ -68,7 +68,7 @@ static int connected_bounds (std::vector<MEdge> &edges, std::vector<std::vector //-------------------------------------------------------------- static void connectedRegions (std::vector<MElement*> &elements, - std::vector<std::vector<MElement*> > ®ions) + std::vector<std::vector<MElement*> > ®ions) { std::multimap<MEdge,MElement*,Less_Edge> e2e; for (unsigned int i = 0; i < elements.size(); ++i){ @@ -89,7 +89,7 @@ static void connectedRegions (std::vector<MElement*> &elements, } static int getGenus (std::vector<MElement *> &elements, - std::vector<std::vector<MEdge> > &boundaries) + std::vector<std::vector<MEdge> > &boundaries) { //We suppose MElements are simply connected @@ -117,9 +117,9 @@ static int getGenus (std::vector<MElement *> &elements, for(int j = 0; j < elements[i]->getNumEdges(); j++){ MEdge me = elements[i]->getEdge(j); if(std::find(bEdges.begin(), bEdges.end(), me) == bEdges.end()) - bEdges.push_back(me); + bEdges.push_back(me); else - bEdges.erase(std::find(bEdges.begin(), bEdges.end(),me)); + bEdges.erase(std::find(bEdges.begin(), bEdges.end(),me)); } } nbBounds = connected_bounds(bEdges, boundaries); @@ -155,8 +155,8 @@ static int getAspectRatio(std::vector<MElement *> &elements, MVertex *v0 = iBound[j].getVertex(0); MVertex *v1 = iBound[j].getVertex(1); const double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + - (v0->y() - v1->y()) * (v0->y() - v1->y()) + - (v0->z() - v1->z()) * (v0->z() - v1->z())); + (v0->y() - v1->y()) * (v0->y() - v1->y()) + + (v0->z() - v1->z()) * (v0->z() - v1->z())); iLength += length; } tot_length += iLength; @@ -274,7 +274,7 @@ static void printLevel(std::vector<MElement *> &elements, int recur, int region) for (; it != vs.end() ; ++it){ (*it)->setIndex(index++); fprintf(fp,"%d %g %g %g\n",(*it)->getIndex(), - (*it)->x(),(*it)->y(),(*it)->z()); + (*it)->x(),(*it)->y(),(*it)->z()); } fprintf(fp,"$EndNodes\n",elements.size()); @@ -357,19 +357,19 @@ void multiscalePartition::partition(partitionLevel & level, int nbParts, if (genus != 0 ){ int nbParts = 2; //std::max(genus+2,2); Msg::Info("Mesh partition: level (%d-%d) is %d-GENUS (AR=%d) ---> MULTILEVEL partition %d parts", - nextLevel->recur,nextLevel->region, genus, AR, nbParts); + nextLevel->recur,nextLevel->region, genus, AR, nbParts); partition(*nextLevel, nbParts, MULTILEVEL); } else if (genus == 0 && AR > 5 ){// || genus == 0 && NB > 1){ int nbParts = 2; Msg::Info("Mesh partition: level (%d-%d) is ZERO-GENUS (AR=%d NB=%d) ---> LAPLACIAN partition %d parts", - nextLevel->recur,nextLevel->region, AR, NB, nbParts); + nextLevel->recur,nextLevel->region, AR, NB, nbParts); //partition(*nextLevel, nbParts, MULTILEVEL); partition(*nextLevel, nbParts, LAPLACIAN); } else { Msg::Info("*** Mesh partition: level (%d-%d) is ZERO-GENUS (AR=%d, NB=%d)", - nextLevel->recur,nextLevel->region, AR, NB); + nextLevel->recur,nextLevel->region, AR, NB); } } @@ -385,9 +385,9 @@ int multiscalePartition::assembleAllPartitions() partitionLevel *iLevel = levels[i]; if(iLevel->elements.size() > 0){ for (unsigned j = 0; j < iLevel->elements.size(); j++){ - MElement *e = iLevel->elements[j]; - int part = e->getPartition(); - e->setPartition(iPart); + MElement *e = iLevel->elements[j]; + int part = e->getPartition(); + e->setPartition(iPart); } iPart++; } diff --git a/Numeric/DivideAndConquer.cpp b/Numeric/DivideAndConquer.cpp index 11fae3321bf6ed31b37c20abc7c666422a329865..0b19d30d291f270bf248ebebbafbfb082a89f4c3 100644 --- a/Numeric/DivideAndConquer.cpp +++ b/Numeric/DivideAndConquer.cpp @@ -510,7 +510,7 @@ void DocRecord::ConvertDListToVoronoiData() if (_adjacencies){ for(int i = 0; i < numPoints; i++) if (_adjacencies[i].t) - delete [] _adjacencies[i].t; + delete [] _adjacencies[i].t; delete [] _adjacencies; } if (_hull)delete [] _hull; @@ -522,7 +522,7 @@ void DocRecord::ConvertDListToVoronoiData() for(PointNumero i = 0; i < numPoints; i++) _adjacencies[i].t = ConvertDlistToArray(&points[i].adjacent, - &_adjacencies[i].t_length); + &_adjacencies[i].t_length); } void DocRecord::voronoiCell(PointNumero pt, std::vector<SPoint2> &pts) const @@ -573,17 +573,17 @@ void DocRecord::makePosView(std::string fileName) std::vector<SPoint2> pts; double pc[2] = {(double)points[i].where.h, (double)points[i].where.v}; if (!onHull(i)){ - fprintf(f,"SP(%g,%g,%g) {%g};\n",pc[0],pc[1],0.0,(double)i); - voronoiCell (i,pts); - for (unsigned int j = 0; j < pts.size(); j++){ - fprintf(f,"SL(%g,%g,%g,%g,%g,%g) {%g,%g};\n", - pts[j].x(),pts[j].y(),0.0, - pts[(j+1)%pts.size()].x(),pts[(j+1)%pts.size()].y(),0.0, - (double)i,(double)i); - } + fprintf(f,"SP(%g,%g,%g) {%g};\n",pc[0],pc[1],0.0,(double)i); + voronoiCell (i,pts); + for (unsigned int j = 0; j < pts.size(); j++){ + fprintf(f,"SL(%g,%g,%g,%g,%g,%g) {%g,%g};\n", + pts[j].x(),pts[j].y(),0.0, + pts[(j+1)%pts.size()].x(),pts[(j+1)%pts.size()].y(),0.0, + (double)i,(double)i); + } } else { - fprintf(f,"SP(%g,%g,%g) {%g};\n",pc[0],pc[1],0.0,-(double)i); + fprintf(f,"SP(%g,%g,%g) {%g};\n",pc[0],pc[1],0.0,-(double)i); } } fprintf(f,"};\n"); @@ -592,7 +592,7 @@ void DocRecord::makePosView(std::string fileName) } void centroidOfOrientedBox(std::vector<SPoint2> &pts, const double &angle, - double &xc, double &yc, double &inertia) + double &xc, double &yc, double &inertia) { const int N = pts.size(); @@ -617,8 +617,8 @@ void centroidOfOrientedBox(std::vector<SPoint2> &pts, const double &angle, } void centroidOfPolygon(SPoint2 &pc, std::vector<SPoint2> &pts, - double &xc, double &yc, double &inertia, - simpleFunction<double> *bgm) + double &xc, double &yc, double &inertia, + simpleFunction<double> *bgm) { double area_tot = 0; SPoint2 center(0,0); @@ -627,8 +627,8 @@ void centroidOfPolygon(SPoint2 &pc, std::vector<SPoint2> &pts, SPoint2 &pb = pts[(j+1)%pts.size()]; const double area = triangle_area2d(pa,pb,pc); const double lc = bgm ? (*bgm)((pa.x()+pb.x()+pc.x())/3.0, - (pa.y()+pb.y()+pc.y())/3.0, - 0.0) : 1.0; + (pa.y()+pb.y()+pc.y())/3.0, + 0.0) : 1.0; const double fact = 1./(lc*lc); area_tot += area*fact; center += ((pa+pb+pc) * (area*fact/3.0)); @@ -641,10 +641,10 @@ void centroidOfPolygon(SPoint2 &pc, std::vector<SPoint2> &pts, const double area = triangle_area2d(pa,pb,pc); const double b = sqrt ( (pa.x()-pb.x())*(pa.x()-pb.x()) + - (pa.y()-pb.y())*(pa.y()-pb.y()) ); + (pa.y()-pb.y())*(pa.y()-pb.y()) ); const double h = 2.0 * area / b; const double a = fabs((pb.x()-pa.x())*(pc.x()-pa.x())* - (pb.y()-pa.y())*(pc.y()-pa.y()))/b; + (pb.y()-pa.y())*(pc.y()-pa.y()))/b; const double j2 = (h*b*b*b + h*a*b*b + h*a*a*b + b*h*h*h) / 12.0; @@ -668,10 +668,10 @@ double DocRecord::Lloyd(int type) if (!points[i].data){ SPoint2 p (pt.where.h,pt.where.v); - if (type == 0) - centroidOfPolygon (p,pts, cgs(i,0), cgs(i,1),E); + if (type == 0) + centroidOfPolygon (p,pts, cgs(i,0), cgs(i,1),E); else - centroidOfOrientedBox (pts, 0.0, cgs(i,0),cgs(i,1),E); + centroidOfOrientedBox (pts, 0.0, cgs(i,0),cgs(i,1),E); } inertia_tot += E; } diff --git a/Numeric/DivideAndConquer.h b/Numeric/DivideAndConquer.h index 92c58b47a3854c5a5b0c42395f0bdfdeb487ab3a..e44784dcf98c21226b24ad5da2c596c055e3ce51 100644 --- a/Numeric/DivideAndConquer.h +++ b/Numeric/DivideAndConquer.h @@ -101,16 +101,16 @@ class DocRecord{ }; void centroidOfOrientedBox(std::vector<SPoint2> &pts, - const double &angle, - double &xc, - double &yc, - double &inertia); + const double &angle, + double &xc, + double &yc, + double &inertia); void centroidOfPolygon(SPoint2 &pc, - std::vector<SPoint2> &pts, - double &xc, - double &yc, - double &inertia, - simpleFunction<double> *bgm = 0); + std::vector<SPoint2> &pts, + double &xc, + double &yc, + double &inertia, + simpleFunction<double> *bgm = 0); #endif diff --git a/Numeric/Numeric.cpp b/Numeric/Numeric.cpp index 3d3f6b887c9440ebc1ca1b2666e6ffbf0b7dc899..8b3f01f6a63e2c915160de3686935d300a80c3e2 100644 --- a/Numeric/Numeric.cpp +++ b/Numeric/Numeric.cpp @@ -351,76 +351,76 @@ void circumCenterXYZ(double *p1, double *p2, double *p3, double *res, double *uv void planarQuad_xyz2xy(double *x, double *y, double *z, double *xn, double *yn) { - double v1[3] = {x[1] - x[0], y[1] - y[0], z[1] - z[0]}; - double v2[3] = {x[2] - x[0], y[2] - y[0], z[2] - z[0]}; - double v3[3] = {x[3] - x[0], y[3] - y[0], z[3] - z[0]}; - - double vx[3] = {x[1] - x[0], y[1] - y[0], z[1] - z[0]}; - double vy[3] = {x[2] - x[0], y[2] - y[0], z[2] - z[0]}; - double vz[3]; prodve(vx, vy, vz); prodve(vz, vx, vy); - - norme(vx); norme(vy); norme(vz); - - double p1P[2] = {0.0, 0.0}; - double p2P[2]; prosca(v1, vx, &p2P[0]); prosca(v1, vy, &p2P[1]); - double p3P[2]; prosca(v2, vx, &p3P[0]); prosca(v2, vy, &p3P[1]); - double p4P[2]; prosca(v3, vx, &p4P[0]); prosca(v3, vy, &p4P[1]); - - xn[0] = p1P[0]; - xn[1] = p2P[0]; - xn[2] = p3P[0]; - xn[3] = p4P[0]; - yn[0] = p1P[1]; - yn[1] = p2P[1]; - yn[2] = p3P[1]; - yn[3] = p4P[1]; + double v1[3] = {x[1] - x[0], y[1] - y[0], z[1] - z[0]}; + double v2[3] = {x[2] - x[0], y[2] - y[0], z[2] - z[0]}; + double v3[3] = {x[3] - x[0], y[3] - y[0], z[3] - z[0]}; + + double vx[3] = {x[1] - x[0], y[1] - y[0], z[1] - z[0]}; + double vy[3] = {x[2] - x[0], y[2] - y[0], z[2] - z[0]}; + double vz[3]; prodve(vx, vy, vz); prodve(vz, vx, vy); + + norme(vx); norme(vy); norme(vz); + + double p1P[2] = {0.0, 0.0}; + double p2P[2]; prosca(v1, vx, &p2P[0]); prosca(v1, vy, &p2P[1]); + double p3P[2]; prosca(v2, vx, &p3P[0]); prosca(v2, vy, &p3P[1]); + double p4P[2]; prosca(v3, vx, &p4P[0]); prosca(v3, vy, &p4P[1]); + + xn[0] = p1P[0]; + xn[1] = p2P[0]; + xn[2] = p3P[0]; + xn[3] = p4P[0]; + yn[0] = p1P[1]; + yn[1] = p2P[1]; + yn[2] = p3P[1]; + yn[3] = p4P[1]; } double computeInnerRadiusForQuad(double *x, double *y, int i){ - - // parameters of the equations of the 3 edges - double a1 = y[(4+i)%4]-y[(5+i)%4]; - double a2 = y[(5+i)%4]-y[(6+i)%4]; - double a3 = y[(6+i)%4]-y[(7+i)%4]; - - double b1 = x[(5+i)%4]-x[(4+i)%4]; - double b2 = x[(6+i)%4]-x[(5+i)%4]; - double b3 = x[(7+i)%4]-x[(6+i)%4]; - - double c1 = y[(5+i)%4]*x[(4+i)%4]-y[(4+i)%4]*x[(5+i)%4]; - double c2 = y[(6+i)%4]*x[(5+i)%4]-y[(5+i)%4]*x[(6+i)%4]; - double c3 = y[(7+i)%4]*x[(6+i)%4]-y[(6+i)%4]*x[(7+i)%4]; - - // length of the 3 edges - double l1 = sqrt(a1*a1+b1*b1); - double l2 = sqrt(a2*a2+b2*b2); - double l3 = sqrt(a3*a3+b3*b3); - - // parameters of the 2 bisectors - double a12 = a1/l1-a2/l2; - double a23 = a2/l2-a3/l3; - - double b12 = b1/l1-b2/l2; - double b23 = b2/l2-b3/l3; - - double c12 = c1/l1-c2/l2; - double c23 = c2/l2-c3/l3; - - // compute the coordinates of the center of the incircle, - // that is the point where the 2 bisectors meet - double x_s = (c12*b23-c23*b12)/(a23*b12-a12*b23); - double y_s = 0.; - if (b12 != 0) { - y_s = -a12/b12*x_s-c12/b12; - } - else { - y_s = -a23/b23*x_s-c23/b23; - } + + // parameters of the equations of the 3 edges + double a1 = y[(4+i)%4]-y[(5+i)%4]; + double a2 = y[(5+i)%4]-y[(6+i)%4]; + double a3 = y[(6+i)%4]-y[(7+i)%4]; + + double b1 = x[(5+i)%4]-x[(4+i)%4]; + double b2 = x[(6+i)%4]-x[(5+i)%4]; + double b3 = x[(7+i)%4]-x[(6+i)%4]; + + double c1 = y[(5+i)%4]*x[(4+i)%4]-y[(4+i)%4]*x[(5+i)%4]; + double c2 = y[(6+i)%4]*x[(5+i)%4]-y[(5+i)%4]*x[(6+i)%4]; + double c3 = y[(7+i)%4]*x[(6+i)%4]-y[(6+i)%4]*x[(7+i)%4]; + + // length of the 3 edges + double l1 = sqrt(a1*a1+b1*b1); + double l2 = sqrt(a2*a2+b2*b2); + double l3 = sqrt(a3*a3+b3*b3); + + // parameters of the 2 bisectors + double a12 = a1/l1-a2/l2; + double a23 = a2/l2-a3/l3; + + double b12 = b1/l1-b2/l2; + double b23 = b2/l2-b3/l3; + + double c12 = c1/l1-c2/l2; + double c23 = c2/l2-c3/l3; + + // compute the coordinates of the center of the incircle, + // that is the point where the 2 bisectors meet + double x_s = (c12*b23-c23*b12)/(a23*b12-a12*b23); + double y_s = 0.; + if (b12 != 0) { + y_s = -a12/b12*x_s-c12/b12; + } + else { + y_s = -a23/b23*x_s-c23/b23; + } - // finally get the radius of the circle - double r = (a1*x_s+b1*y_s+c1)/l1; + // finally get the radius of the circle + double r = (a1*x_s+b1*y_s+c1)/l1; - return r; + return r; } @@ -814,7 +814,7 @@ distance to segment */ void signedDistancesPointsTriangle(std::vector<double>&distances, - std::vector<SPoint3>&closePts, + std::vector<SPoint3>&closePts, const std::vector<SPoint3> &pts, const SPoint3 &p1, const SPoint3 &p2, @@ -827,8 +827,8 @@ void signedDistancesPointsTriangle(std::vector<double>&distances, n.normalize(); double mat[3][3] = {{t1.x(), t2.x(), -n.x()}, - {t1.y(), t2.y(), -n.y()}, - {t1.z(), t2.z(), -n.z()}}; + {t1.y(), t2.y(), -n.y()}, + {t1.z(), t2.z(), -n.z()}}; double inv[3][3]; double det = inv3x3(mat, inv); @@ -868,44 +868,44 @@ void signedDistancesPointsTriangle(std::vector<double>&distances, bool found = false; SPoint3 closePt; if (t12 >= 0 && t12 <= 1.){ - d = sign * std::min(fabs(d), p.distance(p1 + (p2 - p1) * t12)); + d = sign * std::min(fabs(d), p.distance(p1 + (p2 - p1) * t12)); closePt = p1 + (p2 - p1) * t12; - found = true; + found = true; } if (t13 >= 0 && t13 <= 1.){ - if (p.distance(p1 + (p3 - p1) * t13) < fabs(d)) closePt = p1 + (p3 - p1) * t13; - d = sign * std::min(fabs(d), p.distance(p1 + (p3 - p1) * t13)); - found = true; + if (p.distance(p1 + (p3 - p1) * t13) < fabs(d)) closePt = p1 + (p3 - p1) * t13; + d = sign * std::min(fabs(d), p.distance(p1 + (p3 - p1) * t13)); + found = true; } if (t23 >= 0 && t23 <= 1.){ - if (p.distance(p2 + (p3 - p2) * t23) < fabs(d)) closePt = p2 + (p3 - p2) * t23; - d = sign * std::min(fabs(d), p.distance(p2 + (p3 - p2) * t23)); - found = true; + if (p.distance(p2 + (p3 - p2) * t23) < fabs(d)) closePt = p2 + (p3 - p2) * t23; + d = sign * std::min(fabs(d), p.distance(p2 + (p3 - p2) * t23)); + found = true; } if (p.distance(p1) < fabs(d)){ - closePt = p1; - d = sign * std::min(fabs(d), p.distance(p1)); + closePt = p1; + d = sign * std::min(fabs(d), p.distance(p1)); } if (p.distance(p2) < fabs(d)){ - closePt = p2; - d = sign * std::min(fabs(d), p.distance(p2)); + closePt = p2; + d = sign * std::min(fabs(d), p.distance(p2)); } if (p.distance(p3) < fabs(d)){ - closePt = p3; - d = sign * std::min(fabs(d), p.distance(p3)); + closePt = p3; + d = sign * std::min(fabs(d), p.distance(p3)); } //d = sign * std::min(fabs(d), std::min(std::min(p.distance(p1), p.distance(p2)),p.distance(p3))); distances[i] = d; closePts[i] = closePt; } - } + } } void signedDistancesPointsLine (std::vector<double>&distances, - std::vector<SPoint3>&closePts, - const std::vector<SPoint3> &pts, - const SPoint3 &p1, - const SPoint3 &p2){ + std::vector<SPoint3>&closePts, + const std::vector<SPoint3> &pts, + const SPoint3 &p1, + const SPoint3 &p2){ SVector3 t1 = p2 - p1; const double n2t1 = dot(t1, t1); diff --git a/Numeric/cartesian.h b/Numeric/cartesian.h index 2241ae44661ea5f243ac04c6a29386bf02b8b6f4..3045c0e3710cd0c8d28fec53c4a726a072fba0bd 100644 --- a/Numeric/cartesian.h +++ b/Numeric/cartesian.h @@ -40,10 +40,10 @@ class cartesianBox { std::vector<SPoint3> & points() { return _points; } std::vector<SVector3> & normals() { return _normals; } cartesianBox (double X, double Y, double Z, - const SVector3 &DXI, - const SVector3 &DETA, - const SVector3 &DZETA, - int NXI, int NETA, int NZETA) + const SVector3 &DXI, + const SVector3 &DETA, + const SVector3 &DZETA, + int NXI, int NETA, int NZETA) : _ann(0), _X(X), _Y(Y), _Z(Z), _dxi(norm(DXI)), _deta(norm(DETA)), @@ -105,7 +105,7 @@ class cartesianBox { const double zeta = k*_dzeta/_Nzeta; // printf("index %d -> %d %d %d xi %g %g %g X %g %g %g N %d %d %d D %g %g %g\n", - // t,i,j,k,xi,eta,zeta,_X,_Y,_Z,_Nxi,_Neta,_Nzeta,_dxi,_deta,_dzeta); + // t,i,j,k,xi,eta,zeta,_X,_Y,_Z,_Nxi,_Neta,_Nzeta,_dxi,_deta,_dzeta); SVector3 D = xi * _xiAxis + eta * _etaAxis + zeta * _zetaAxis; @@ -143,9 +143,9 @@ class cartesianBox { int i,j,k; element_ijk(t,i,j,k); for (int I=0;I<2;I++) - for (int J=0;J<2;J++) - for (int K=0;K<2;K++) - _nodalValues[node_index(i+I,j+J,k+K)] = 0.0; + for (int J=0;J<2;J++) + for (int K=0;K<2;K++) + _nodalValues[node_index(i+I,j+J,k+K)] = 0.0; } } void writeMSH (const std::string &filename) const @@ -156,8 +156,8 @@ class cartesianBox { fprintf(f,"$Nodes\n%d\n",_nodalValues.size()); typename std::map<int, scalar>::const_iterator it = _nodalValues.begin(); for ( ; it!=_nodalValues.end();++it){ - SPoint3 p = coordinates_of_node(it->first); - fprintf(f,"%d %g %g %g\n",it->first,p.x(),p.y(),p.z()); + SPoint3 p = coordinates_of_node(it->first); + fprintf(f,"%d %g %g %g\n",it->first,p.x(),p.y(),p.z()); } fprintf(f,"$EndNodes\n"); } @@ -165,18 +165,18 @@ class cartesianBox { fprintf(f,"$Elements\n%d\n",_active.size()); std::set<int>::const_iterator it = _active.begin(); for ( ; it!=_active.end();++it){ - fprintf(f,"%d 5 3 1 1 1",*it); - int i,j,k; - element_ijk(*it,i,j,k); - fprintf(f," %d",node_index(i,j,k)); - fprintf(f," %d",node_index(i+1,j,k)); - fprintf(f," %d",node_index(i+1,j+1,k)); - fprintf(f," %d",node_index(i,j+1,k)); - fprintf(f," %d",node_index(i,j,k+1)); - fprintf(f," %d",node_index(i+1,j,k+1)); - fprintf(f," %d",node_index(i+1,j+1,k+1)); - fprintf(f," %d",node_index(i,j+1,k+1)); - fprintf(f,"\n"); + fprintf(f,"%d 5 3 1 1 1",*it); + int i,j,k; + element_ijk(*it,i,j,k); + fprintf(f," %d",node_index(i,j,k)); + fprintf(f," %d",node_index(i+1,j,k)); + fprintf(f," %d",node_index(i+1,j+1,k)); + fprintf(f," %d",node_index(i,j+1,k)); + fprintf(f," %d",node_index(i,j,k+1)); + fprintf(f," %d",node_index(i+1,j,k+1)); + fprintf(f," %d",node_index(i+1,j+1,k+1)); + fprintf(f," %d",node_index(i,j+1,k+1)); + fprintf(f,"\n"); } fprintf(f,"$EndElements\n"); } @@ -184,9 +184,9 @@ class cartesianBox { fprintf(f,"$NodeData\n1\n\"distance\"\n 1\n 0.0\n3\n0\n 1\n %d\n",_nodalValues.size()); typename std::map<int, scalar>::const_iterator it = _nodalValues.begin(); for ( ; it!=_nodalValues.end();++it){ - SPoint3 p = coordinates_of_node(it->first); - // fprintf(f,"%d %g\n",it->first,distance(p.x(),p.y(),p.z())); - fprintf(f,"%d %g\n",it->first,it->second); + SPoint3 p = coordinates_of_node(it->first); + // fprintf(f,"%d %g\n",it->first,distance(p.x(),p.y(),p.z())); + fprintf(f,"%d %g\n",it->first,it->second); } fprintf(f,"$EndNodeData\n"); } diff --git a/Numeric/fullMatrix.h b/Numeric/fullMatrix.h index 7d3d7d1725d0bead863bbe28f972f9161ce1c5b0..80addf83f6625d9330b4fc87aad8a83e869a90e6 100644 --- a/Numeric/fullMatrix.h +++ b/Numeric/fullMatrix.h @@ -214,7 +214,7 @@ class fullMatrix #endif ; void gemm_naive(const fullMatrix<scalar> &a, const fullMatrix<scalar> &b, - scalar alpha=1., scalar beta=1.) + scalar alpha=1., scalar beta=1.) { fullMatrix<scalar> temp(a.size1(), b.size2()); a.mult_naive(b, temp); diff --git a/Numeric/polynomialBasis.cpp b/Numeric/polynomialBasis.cpp index d9d5fc0e28f32a645f2d2b43c15346c401b434a7..3705ace1f3c5d9d64fe5e6faaaba7977417acea4 100644 --- a/Numeric/polynomialBasis.cpp +++ b/Numeric/polynomialBasis.cpp @@ -751,18 +751,18 @@ static void getFaceClosure(int iFace, int iSign, int iRotate, std::vector<int> & int face[4][3] = {{-3, -2, -1}, {1, -6, 4}, {-4, 5, 3}, {6, 2, -5}}; int order1node[4][3] = {{0, 2, 1}, {0, 1, 3}, {0, 3, 2}, {3, 1, 2}}; for (int i = 0; i < 3; ++i){ - int k = (3 + (iSign * i) + iRotate) % 3; //- iSign * iRotate + int k = (3 + (iSign * i) + iRotate) % 3; //- iSign * iRotate closure[i] = order1node[iFace][k]; } for (int i = 0;i < 3; ++i){ int edgenumber = iSign * - face[iFace][(6 + i * iSign + (-1 + iSign) / 2 + iRotate) % 3]; //- iSign * iRotate + face[iFace][(6 + i * iSign + (-1 + iSign) / 2 + iRotate) % 3]; //- iSign * iRotate for (int k = 0; k < (order - 1); k++){ - if (edgenumber > 0) - closure[3 + i * (order - 1) + k] = + if (edgenumber > 0) + closure[3 + i * (order - 1) + k] = 4 + (edgenumber - 1) * (order - 1) + k; - else - closure[3 + i * (order - 1) + k] = + else + closure[3 + i * (order - 1) + k] = 4 + (-edgenumber) * (order - 1) - 1 - k; } } @@ -773,14 +773,14 @@ static void getFaceClosure(int iFace, int iSign, int iRotate, std::vector<int> & for (int k = 0; k < order / 3; k++){ int orderint = order - 3 - k * 3; if (orderint > 0){ - for (int ci = 0; ci < 3 ; ci++){ - int shift = (3 + iSign * ci + iRotate) % 3; //- iSign * iRotate - closure[fi + ci] = ti + shift; - } - fi = fi + 3; ti = ti + 3; - for (int l = 0; l < orderint - 1; l++){ - for (int ei = 0; ei < 3; ei++){ - int edgenumber = (6 + ei * iSign + (-1 + iSign) / 2 + iRotate) % 3; //- iSign * iRotate + for (int ci = 0; ci < 3 ; ci++){ + int shift = (3 + iSign * ci + iRotate) % 3; //- iSign * iRotate + closure[fi + ci] = ti + shift; + } + fi = fi + 3; ti = ti + 3; + for (int l = 0; l < orderint - 1; l++){ + for (int ei = 0; ei < 3; ei++){ + int edgenumber = (6 + ei * iSign + (-1 + iSign) / 2 + iRotate) % 3; //- iSign * iRotate if (iSign > 0) closure[fi + ei * (orderint - 1) + l] = ti + edgenumber * (orderint - 1) + l; @@ -788,13 +788,13 @@ static void getFaceClosure(int iFace, int iSign, int iRotate, std::vector<int> & closure[fi + ei * (orderint - 1) + l] = ti + (1 + edgenumber) * (orderint - 1) - 1 - l; } - } - fi = fi + 3 * (orderint - 1); ti = ti + 3 * (orderint - 1); + } + fi = fi + 3 * (orderint - 1); ti = ti + 3 * (orderint - 1); } else { - closure[fi] = ti; - ti++; - fi++; + closure[fi] = ti; + ti++; + fi++; } } break; @@ -809,9 +809,9 @@ static void generate3dFaceClosure(polynomialBasis::clCont &closure, int order) for (int iRotate = 0; iRotate < 3; iRotate++){ for (int iSign = 1; iSign >= -1; iSign -= 2){ for (int iFace = 0; iFace < 4; iFace++){ - std::vector<int> closure_face; - getFaceClosure(iFace, iSign, iRotate, closure_face, order); - closure.push_back(closure_face); + std::vector<int> closure_face; + getFaceClosure(iFace, iSign, iRotate, closure_face, order); + closure.push_back(closure_face); } } } diff --git a/Numeric/simpleFunction.h b/Numeric/simpleFunction.h index 71df5b7afb35a0a31934104848a323be4ae7a3de..6cadc0eb27b007a9b74a9bc14b73abc57cbef424 100644 --- a/Numeric/simpleFunction.h +++ b/Numeric/simpleFunction.h @@ -14,7 +14,7 @@ class simpleFunction { virtual ~simpleFunction(){} virtual scalar operator () (double x, double y, double z) const { return _val; } virtual void gradient (double x, double y, double z, - scalar & dfdx, scalar & dfdy, scalar & dfdz) const + scalar & dfdx, scalar & dfdy, scalar & dfdz) const { dfdx = dfdy = dfdz = 0.0; } }; diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 0665d3ba5f0bb8a8fd9de737a7baa83c82ca96fa..292ea7b38fa5a2adb0126c95b2862bbf8037c0c2 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -455,7 +455,7 @@ typedef union YYSTYPE } /* Line 193 of yacc.c. */ #line 458 "Gmsh.tab.cpp" - YYSTYPE; + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -599,7 +599,7 @@ YYID (i) # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 @@ -625,7 +625,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -650,13 +650,13 @@ union yyalloc # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ while (YYID (0)) # endif # endif @@ -666,15 +666,15 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ while (YYID (0)) #endif @@ -697,7 +697,7 @@ union yyalloc #define YYUNDEFTOK 2 #define YYMAXUTOK 385 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ @@ -3052,44 +3052,44 @@ static const yytype_uint8 yystos[] = 6, 230, 6 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab +#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ + YYERROR; \ + } \ while (YYID (0)) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. @@ -3098,22 +3098,22 @@ while (YYID (0)) #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ while (YYID (0)) #endif @@ -3124,10 +3124,10 @@ while (YYID (0)) #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -3150,21 +3150,21 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ } while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ } while (YYID (0)) @@ -3196,7 +3196,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) switch (yytype) { default: - break; + break; } } @@ -3248,10 +3248,10 @@ yy_stack_print (bottom, top) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) @@ -3274,21 +3274,21 @@ yy_reduce_print (yyvsp, yyrule) int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); fprintf (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) @@ -3304,7 +3304,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -3391,27 +3391,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -3449,7 +3449,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) # if 0 /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ + constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); @@ -3462,13 +3462,13 @@ yysyntax_error (char *yyresult, int yystate, int yychar) static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ + YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ @@ -3480,22 +3480,22 @@ yysyntax_error (char *yyresult, int yystate, int yychar) yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); @@ -3503,29 +3503,29 @@ yysyntax_error (char *yyresult, int yystate, int yychar) yysize = yysize1; if (yysize_overflow) - return YYSIZE_MAXIMUM; + return YYSIZE_MAXIMUM; if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } return yysize; } } @@ -3559,7 +3559,7 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } @@ -3672,7 +3672,7 @@ yyparse () yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack @@ -3702,25 +3702,25 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); + &yystacksize); - yyss = yyss1; - yyvs = yyvs1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -3728,23 +3728,23 @@ yyparse () # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -3754,10 +3754,10 @@ yyparse () YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -3806,7 +3806,7 @@ yybackup: if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -3976,11 +3976,11 @@ yyreduce: std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(6) - (7)].c)); FILE *fp = fopen(tmp.c_str(), (yyvsp[(5) - (7)].c)); if(!fp){ - yymsg(0, "Unable to open file '%s'", tmp.c_str()); + yymsg(0, "Unable to open file '%s'", tmp.c_str()); } else{ - fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c)); - fclose(fp); + fprintf(fp, "%s\n", (yyvsp[(3) - (7)].c)); + fclose(fp); } Free((yyvsp[(3) - (7)].c)); Free((yyvsp[(6) - (7)].c)); @@ -3993,11 +3993,11 @@ yyreduce: char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (7)].c), (yyvsp[(5) - (7)].l), tmpstring); if(i < 0) - yymsg(0, "Too few arguments in Printf"); + yymsg(0, "Too few arguments in Printf"); else if(i > 0) - yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); + yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); else - Msg::Direct(tmpstring); + Msg::Direct(tmpstring); Free((yyvsp[(3) - (7)].c)); List_Delete((yyvsp[(5) - (7)].l)); ;} @@ -4009,19 +4009,19 @@ yyreduce: char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (9)].c), (yyvsp[(5) - (9)].l), tmpstring); if(i < 0) - yymsg(0, "Too few arguments in Printf"); + yymsg(0, "Too few arguments in Printf"); else if(i > 0) - yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); + yymsg(0, "%d extra argument%s in Printf", i, (i > 1) ? "s" : ""); else{ std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(8) - (9)].c)); - FILE *fp = fopen(tmp.c_str(), (yyvsp[(7) - (9)].c)); - if(!fp){ - yymsg(0, "Unable to open file '%s'", tmp.c_str()); - } - else{ - fprintf(fp, "%s\n", tmpstring); - fclose(fp); - } + FILE *fp = fopen(tmp.c_str(), (yyvsp[(7) - (9)].c)); + if(!fp){ + yymsg(0, "Unable to open file '%s'", tmp.c_str()); + } + else{ + fprintf(fp, "%s\n", tmpstring); + fclose(fp); + } } Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(8) - (9)].c)); @@ -4034,13 +4034,13 @@ yyreduce: { #if defined(HAVE_POST) if(!strcmp((yyvsp[(1) - (6)].c), "View") && ViewData->finalize()){ - ViewData->setName((yyvsp[(2) - (6)].c)); - ViewData->setFileName(gmsh_yyname); - ViewData->setFileIndex(gmsh_yyviewindex++); - new PView(ViewData); + ViewData->setName((yyvsp[(2) - (6)].c)); + ViewData->setFileName(gmsh_yyname); + ViewData->setFileIndex(gmsh_yyviewindex++); + new PView(ViewData); } else - delete ViewData; + delete ViewData; #endif Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(2) - (6)].c)); ;} @@ -4051,9 +4051,9 @@ yyreduce: { #if defined(HAVE_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - int index = (int)(yyvsp[(4) - (6)].d); - if(index >= 0 && index < (int)PView::list.size()) - new PView(PView::list[index], false); + int index = (int)(yyvsp[(4) - (6)].d); + if(index >= 0 && index < (int)PView::list.size()) + new PView(PView::list[index], false); } #endif Free((yyvsp[(2) - (6)].c)); @@ -4065,9 +4065,9 @@ yyreduce: { #if defined(HAVE_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - int index = (int)(yyvsp[(4) - (6)].d); - if(index >= 0 && index < (int)PView::list.size()) - new PView(PView::list[index], true); + int index = (int)(yyvsp[(4) - (6)].d); + if(index >= 0 && index < (int)PView::list.size()) + new PView(PView::list[index], true); } #endif Free((yyvsp[(2) - (6)].c)); @@ -4108,101 +4108,101 @@ yyreduce: { #if defined(HAVE_POST) if(!strncmp((yyvsp[(1) - (1)].c), "SP", 2)){ - ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP; + ViewValueList = &ViewData->SP; ViewNumList = &ViewData->NbSP; } else if(!strncmp((yyvsp[(1) - (1)].c), "VP", 2)){ - ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP; + ViewValueList = &ViewData->VP; ViewNumList = &ViewData->NbVP; } else if(!strncmp((yyvsp[(1) - (1)].c), "TP", 2)){ - ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP; + ViewValueList = &ViewData->TP; ViewNumList = &ViewData->NbTP; } else if(!strncmp((yyvsp[(1) - (1)].c), "SL", 2)){ - ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL; + ViewValueList = &ViewData->SL; ViewNumList = &ViewData->NbSL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "VL", 2)){ - ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL; + ViewValueList = &ViewData->VL; ViewNumList = &ViewData->NbVL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "TL", 2)){ - ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL; + ViewValueList = &ViewData->TL; ViewNumList = &ViewData->NbTL; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_LIN); } else if(!strncmp((yyvsp[(1) - (1)].c), "ST", 2)){ - ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST; + ViewValueList = &ViewData->ST; ViewNumList = &ViewData->NbST; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "VT", 2)){ - ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT; + ViewValueList = &ViewData->VT; ViewNumList = &ViewData->NbVT; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "TT", 2)){ - ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT; + ViewValueList = &ViewData->TT; ViewNumList = &ViewData->NbTT; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "SQ", 2)){ - ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ; + ViewValueList = &ViewData->SQ; ViewNumList = &ViewData->NbSQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "VQ", 2)){ - ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ; + ViewValueList = &ViewData->VQ; ViewNumList = &ViewData->NbVQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "TQ", 2)){ - ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ; + ViewValueList = &ViewData->TQ; ViewNumList = &ViewData->NbTQ; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_QUA); } else if(!strncmp((yyvsp[(1) - (1)].c), "SS", 2)){ - ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS; + ViewValueList = &ViewData->SS; ViewNumList = &ViewData->NbSS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "VS", 2)){ - ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS; + ViewValueList = &ViewData->VS; ViewNumList = &ViewData->NbVS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "TS", 2)){ - ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS; + ViewValueList = &ViewData->TS; ViewNumList = &ViewData->NbTS; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_TET); } else if(!strncmp((yyvsp[(1) - (1)].c), "SH", 2)){ - ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH; + ViewValueList = &ViewData->SH; ViewNumList = &ViewData->NbSH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "VH", 2)){ - ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH; + ViewValueList = &ViewData->VH; ViewNumList = &ViewData->NbVH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "TH", 2)){ - ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH; + ViewValueList = &ViewData->TH; ViewNumList = &ViewData->NbTH; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_HEX); } else if(!strncmp((yyvsp[(1) - (1)].c), "SI", 2)){ - ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI; + ViewValueList = &ViewData->SI; ViewNumList = &ViewData->NbSI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "VI", 2)){ - ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI; + ViewValueList = &ViewData->VI; ViewNumList = &ViewData->NbVI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "TI", 2)){ - ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI; + ViewValueList = &ViewData->TI; ViewNumList = &ViewData->NbTI; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PRI); } else if(!strncmp((yyvsp[(1) - (1)].c), "SY", 2)){ - ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY; + ViewValueList = &ViewData->SY; ViewNumList = &ViewData->NbSY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else if(!strncmp((yyvsp[(1) - (1)].c), "VY", 2)){ - ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY; + ViewValueList = &ViewData->VY; ViewNumList = &ViewData->NbVY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else if(!strncmp((yyvsp[(1) - (1)].c), "TY", 2)){ - ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY; + ViewValueList = &ViewData->TY; ViewNumList = &ViewData->NbTY; if(strlen((yyvsp[(1) - (1)].c)) > 2) ViewData->setOrder2(TYPE_PYR); } else{ - yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c)); - ViewValueList = 0; ViewNumList = 0; + yymsg(0, "Unknown element type '%s'", (yyvsp[(1) - (1)].c)); + ViewValueList = 0; ViewNumList = 0; } #endif ViewCoord.clear(); @@ -4215,9 +4215,9 @@ yyreduce: { #if defined(HAVE_POST) if(ViewValueList){ - for(int i = 0; i < 3; i++) - for(unsigned int j = 0; j < ViewCoord.size() / 3; j++) - ViewValueList->push_back(ViewCoord[3 * j + i]); + for(int i = 0; i < 3; i++) + for(unsigned int j = 0; j < ViewCoord.size() / 3; j++) + ViewValueList->push_back(ViewCoord[3 * j + i]); } #endif ;} @@ -4318,14 +4318,14 @@ yyreduce: { #if defined(HAVE_POST) int type = - (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : - (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : - (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : - (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : - (ViewData->NbSY || ViewData->NbVY) ? TYPE_PYR : - (ViewData->NbSI || ViewData->NbVI) ? TYPE_PRI : - (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : - 0; + (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : + (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : + (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : + (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : + (ViewData->NbSY || ViewData->NbVY) ? TYPE_PYR : + (ViewData->NbSI || ViewData->NbVI) ? TYPE_PRI : + (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : + 0; ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (8)].l)), ListOfListOfDouble2Matrix((yyvsp[(6) - (8)].l))); #endif @@ -4337,12 +4337,12 @@ yyreduce: { #if defined(HAVE_POST) int type = - (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : - (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : - (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : - (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : - (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : - 0; + (ViewData->NbSL || ViewData->NbVL) ? TYPE_LIN : + (ViewData->NbST || ViewData->NbVT) ? TYPE_TRI : + (ViewData->NbSQ || ViewData->NbVQ) ? TYPE_QUA : + (ViewData->NbSS || ViewData->NbVS) ? TYPE_TET : + (ViewData->NbSH || ViewData->NbVH) ? TYPE_HEX : + 0; ViewData->setInterpolationMatrices(type, ListOfListOfDouble2Matrix((yyvsp[(3) - (14)].l)), ListOfListOfDouble2Matrix((yyvsp[(6) - (14)].l)), ListOfListOfDouble2Matrix((yyvsp[(9) - (14)].l)), @@ -4405,22 +4405,22 @@ yyreduce: #line 587 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){ - if(!(yyvsp[(2) - (4)].i)) - gmsh_yysymbols[(yyvsp[(1) - (4)].c)].push_back((yyvsp[(3) - (4)].d)); - else - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); + if(!(yyvsp[(2) - (4)].i)) + gmsh_yysymbols[(yyvsp[(1) - (4)].c)].push_back((yyvsp[(3) - (4)].d)); + else + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); } else{ - switch((yyvsp[(2) - (4)].i)){ - case 0 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] = (yyvsp[(3) - (4)].d); break; - case 1 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] += (yyvsp[(3) - (4)].d); break; - case 2 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] -= (yyvsp[(3) - (4)].d); break; - case 3 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] *= (yyvsp[(3) - (4)].d); break; - case 4 : - if((yyvsp[(3) - (4)].d)) gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] /= (yyvsp[(3) - (4)].d); - else yymsg(0, "Division by zero in '%s /= %g'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].d)); - break; - } + switch((yyvsp[(2) - (4)].i)){ + case 0 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] = (yyvsp[(3) - (4)].d); break; + case 1 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] += (yyvsp[(3) - (4)].d); break; + case 2 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] -= (yyvsp[(3) - (4)].d); break; + case 3 : gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] *= (yyvsp[(3) - (4)].d); break; + case 4 : + if((yyvsp[(3) - (4)].d)) gmsh_yysymbols[(yyvsp[(1) - (4)].c)][0] /= (yyvsp[(3) - (4)].d); + else yymsg(0, "Division by zero in '%s /= %g'", (yyvsp[(1) - (4)].c), (yyvsp[(3) - (4)].d)); + break; + } } Free((yyvsp[(1) - (4)].c)); ;} @@ -4431,26 +4431,26 @@ yyreduce: { int index = (int)(yyvsp[(3) - (7)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (7)].c))){ - if(!(yyvsp[(5) - (7)].i)){ - gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.); - gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); - } - else - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (7)].c)); + if(!(yyvsp[(5) - (7)].i)){ + gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.); + gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); + } + else + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (7)].c)); } else{ - if((int)gmsh_yysymbols[(yyvsp[(1) - (7)].c)].size() < index + 1) - gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.); - switch((yyvsp[(5) - (7)].i)){ - case 0 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); break; - case 1 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] += (yyvsp[(6) - (7)].d); break; - case 2 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] -= (yyvsp[(6) - (7)].d); break; - case 3 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] *= (yyvsp[(6) - (7)].d); break; - case 4 : - if((yyvsp[(6) - (7)].d)) gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] /= (yyvsp[(6) - (7)].d); - else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (7)].c), index, (yyvsp[(6) - (7)].d)); - break; - } + if((int)gmsh_yysymbols[(yyvsp[(1) - (7)].c)].size() < index + 1) + gmsh_yysymbols[(yyvsp[(1) - (7)].c)].resize(index + 1, 0.); + switch((yyvsp[(5) - (7)].i)){ + case 0 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] = (yyvsp[(6) - (7)].d); break; + case 1 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] += (yyvsp[(6) - (7)].d); break; + case 2 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] -= (yyvsp[(6) - (7)].d); break; + case 3 : gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] *= (yyvsp[(6) - (7)].d); break; + case 4 : + if((yyvsp[(6) - (7)].d)) gmsh_yysymbols[(yyvsp[(1) - (7)].c)][index] /= (yyvsp[(6) - (7)].d); + else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (7)].c), index, (yyvsp[(6) - (7)].d)); + break; + } } Free((yyvsp[(1) - (7)].c)); ;} @@ -4460,38 +4460,38 @@ yyreduce: #line 636 "Gmsh.y" { if(List_Nbr((yyvsp[(4) - (9)].l)) != List_Nbr((yyvsp[(8) - (9)].l))){ - yymsg(0, "Incompatible array dimensions in affectation"); + yymsg(0, "Incompatible array dimensions in affectation"); } else{ - if(!gmsh_yysymbols.count((yyvsp[(1) - (9)].c))){ - if(!(yyvsp[(7) - (9)].i)){ - for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){ - int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i)); - gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.); - gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i); - } - } - else - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (9)].c)); - } - else{ - for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){ - int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i)); - double d = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i); - if((int)gmsh_yysymbols[(yyvsp[(1) - (9)].c)].size() < index + 1) - gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.); - switch((yyvsp[(7) - (9)].i)){ - case 0 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = d; break; - case 1 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] += d; break; - case 2 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] -= d; break; - case 3 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] *= d; break; - case 4 : - if((yyvsp[(8) - (9)].l)) gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] /= d; - else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (9)].c), index, d); - break; - } - } - } + if(!gmsh_yysymbols.count((yyvsp[(1) - (9)].c))){ + if(!(yyvsp[(7) - (9)].i)){ + for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){ + int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i)); + gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.); + gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i); + } + } + else + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (9)].c)); + } + else{ + for(int i = 0; i < List_Nbr((yyvsp[(4) - (9)].l)); i++){ + int index = (int)(*(double*)List_Pointer((yyvsp[(4) - (9)].l), i)); + double d = *(double*)List_Pointer((yyvsp[(8) - (9)].l), i); + if((int)gmsh_yysymbols[(yyvsp[(1) - (9)].c)].size() < index + 1) + gmsh_yysymbols[(yyvsp[(1) - (9)].c)].resize(index + 1, 0.); + switch((yyvsp[(7) - (9)].i)){ + case 0 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] = d; break; + case 1 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] += d; break; + case 2 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] -= d; break; + case 3 : gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] *= d; break; + case 4 : + if((yyvsp[(8) - (9)].l)) gmsh_yysymbols[(yyvsp[(1) - (9)].c)][index] /= d; + else yymsg(0, "Division by zero in '%s[%d] /= %g'", (yyvsp[(1) - (9)].c), index, d); + break; + } + } + } } Free((yyvsp[(1) - (9)].c)); List_Delete((yyvsp[(4) - (9)].l)); @@ -4503,7 +4503,7 @@ yyreduce: #line 676 "Gmsh.y" { if(gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - gmsh_yysymbols[(yyvsp[(1) - (6)].c)].clear(); + gmsh_yysymbols[(yyvsp[(1) - (6)].c)].clear(); gmsh_yysymbols[(yyvsp[(1) - (6)].c)] = std::vector<double>(); for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++) gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i)); @@ -4517,7 +4517,7 @@ yyreduce: { // appends to the list for(int i = 0; i < List_Nbr((yyvsp[(5) - (6)].l)); i++) - gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i)); + gmsh_yysymbols[(yyvsp[(1) - (6)].c)].push_back(*(double*)List_Pointer((yyvsp[(5) - (6)].l), i)); Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(5) - (6)].l)); ;} @@ -4527,9 +4527,9 @@ yyreduce: #line 694 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); else - gmsh_yysymbols[(yyvsp[(1) - (3)].c)][0] += (yyvsp[(2) - (3)].i); + gmsh_yysymbols[(yyvsp[(1) - (3)].c)][0] += (yyvsp[(2) - (3)].i); Free((yyvsp[(1) - (3)].c)); ;} break; @@ -4538,12 +4538,12 @@ yyreduce: #line 702 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); else{ - int index = (int)(yyvsp[(3) - (6)].d); - if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) - gmsh_yysymbols[(yyvsp[(1) - (6)].c)].resize(index + 1, 0.); - gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index] += (yyvsp[(5) - (6)].i); + int index = (int)(yyvsp[(3) - (6)].d); + if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) + gmsh_yysymbols[(yyvsp[(1) - (6)].c)].resize(index + 1, 0.); + gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index] += (yyvsp[(5) - (6)].i); } Free((yyvsp[(1) - (6)].c)); ;} @@ -4581,17 +4581,17 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d)){ - switch((yyvsp[(4) - (6)].i)){ - case 0 : d = (yyvsp[(5) - (6)].d); break; - case 1 : d += (yyvsp[(5) - (6)].d); break; - case 2 : d -= (yyvsp[(5) - (6)].d); break; - case 3 : d *= (yyvsp[(5) - (6)].d); break; - case 4 : - if((yyvsp[(5) - (6)].d)) d /= (yyvsp[(5) - (6)].d); - else yymsg(0, "Division by zero in '%s.%s /= %g'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d)); - break; - } - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d); + switch((yyvsp[(4) - (6)].i)){ + case 0 : d = (yyvsp[(5) - (6)].d); break; + case 1 : d += (yyvsp[(5) - (6)].d); break; + case 2 : d -= (yyvsp[(5) - (6)].d); break; + case 3 : d *= (yyvsp[(5) - (6)].d); break; + case 4 : + if((yyvsp[(5) - (6)].d)) d /= (yyvsp[(5) - (6)].d); + else yymsg(0, "Division by zero in '%s.%s /= %g'", (yyvsp[(1) - (6)].c), (yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d)); + break; + } + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (6)].c), 0, (yyvsp[(3) - (6)].c), d); } Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(3) - (6)].c)); ;} @@ -4602,17 +4602,17 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d)){ - switch((yyvsp[(7) - (9)].i)){ - case 0 : d = (yyvsp[(8) - (9)].d); break; - case 1 : d += (yyvsp[(8) - (9)].d); break; - case 2 : d -= (yyvsp[(8) - (9)].d); break; - case 3 : d *= (yyvsp[(8) - (9)].d); break; - case 4 : - if((yyvsp[(8) - (9)].d)) d /= (yyvsp[(8) - (9)].d); - else yymsg(0, "Division by zero in '%s[%d].%s /= %g'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); - break; - } - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d); + switch((yyvsp[(7) - (9)].i)){ + case 0 : d = (yyvsp[(8) - (9)].d); break; + case 1 : d += (yyvsp[(8) - (9)].d); break; + case 2 : d -= (yyvsp[(8) - (9)].d); break; + case 3 : d *= (yyvsp[(8) - (9)].d); break; + case 4 : + if((yyvsp[(8) - (9)].d)) d /= (yyvsp[(8) - (9)].d); + else yymsg(0, "Division by zero in '%s[%d].%s /= %g'", (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); + break; + } + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (9)].c), (int)(yyvsp[(3) - (9)].d), (yyvsp[(6) - (9)].c), d); } Free((yyvsp[(1) - (9)].c)); Free((yyvsp[(6) - (9)].c)); ;} @@ -4623,8 +4623,8 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d)){ - d += (yyvsp[(4) - (5)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d); + d += (yyvsp[(4) - (5)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (5)].c), 0, (yyvsp[(3) - (5)].c), d); } Free((yyvsp[(1) - (5)].c)); Free((yyvsp[(3) - (5)].c)); ;} @@ -4635,8 +4635,8 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d)){ - d += (yyvsp[(7) - (8)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d); + d += (yyvsp[(7) - (8)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (8)].c), (int)(yyvsp[(3) - (8)].d), (yyvsp[(6) - (8)].c), d); } Free((yyvsp[(1) - (8)].c)); Free((yyvsp[(6) - (8)].c)); ;} @@ -4663,18 +4663,18 @@ yyreduce: { GmshColorTable *ct = GetColorTable(0); if(!ct) - yymsg(0, "View[%d] does not exist", 0); + yymsg(0, "View[%d] does not exist", 0); else{ - ct->size = List_Nbr((yyvsp[(5) - (6)].l)); - if(ct->size > COLORTABLE_NBMAX_COLOR) - yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", - ct->size, COLORTABLE_NBMAX_COLOR, 0); - else - for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(5) - (6)].l), i, &ct->table[i]); - if(ct->size == 1){ - ct->size = 2; - ct->table[1] = ct->table[0]; - } + ct->size = List_Nbr((yyvsp[(5) - (6)].l)); + if(ct->size > COLORTABLE_NBMAX_COLOR) + yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", + ct->size, COLORTABLE_NBMAX_COLOR, 0); + else + for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(5) - (6)].l), i, &ct->table[i]); + if(ct->size == 1){ + ct->size = 2; + ct->table[1] = ct->table[0]; + } } Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(5) - (6)].l)); @@ -4686,18 +4686,18 @@ yyreduce: { GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (9)].d)); if(!ct) - yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (9)].d)); else{ - ct->size = List_Nbr((yyvsp[(8) - (9)].l)); - if(ct->size > COLORTABLE_NBMAX_COLOR) - yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", - ct->size, COLORTABLE_NBMAX_COLOR, (int)(yyvsp[(3) - (9)].d)); - else - for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(8) - (9)].l), i, &ct->table[i]); - if(ct->size == 1){ - ct->size = 2; - ct->table[1] = ct->table[0]; - } + ct->size = List_Nbr((yyvsp[(8) - (9)].l)); + if(ct->size > COLORTABLE_NBMAX_COLOR) + yymsg(0, "Too many (%d>%d) colors in View[%d].ColorTable", + ct->size, COLORTABLE_NBMAX_COLOR, (int)(yyvsp[(3) - (9)].d)); + else + for(int i = 0; i < ct->size; i++) List_Read((yyvsp[(8) - (9)].l), i, &ct->table[i]); + if(ct->size == 1){ + ct->size = 2; + ct->table[1] = ct->table[0]; + } } Free((yyvsp[(1) - (9)].c)); List_Delete((yyvsp[(8) - (9)].l)); @@ -4709,9 +4709,9 @@ yyreduce: { #if defined(HAVE_MESH) if(!strcmp((yyvsp[(1) - (5)].c),"Background")) - GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d); + GModel::current()->getFields()->background_field = (int)(yyvsp[(4) - (5)].d); else - yymsg(0, "Unknown command %s Field", (yyvsp[(1) - (5)].c)); + yymsg(0, "Unknown command %s Field", (yyvsp[(1) - (5)].c)); #endif ;} break; @@ -4721,7 +4721,7 @@ yyreduce: { #if defined(HAVE_MESH) if(!GModel::current()->getFields()->newField((int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c))) - yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)); + yymsg(0, "Cannot create field %i of type '%s'", (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c)); #endif Free((yyvsp[(6) - (7)].c)); ;} @@ -4733,20 +4733,20 @@ yyreduce: #if defined(HAVE_MESH) Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d)); if(field){ - FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; - if(option){ - try { option->numericalValue((yyvsp[(8) - (9)].d)); } - catch(...){ - yymsg(0, "Cannot assign a numerical value to option '%s' " - "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); - } - } - else - yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); + FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; + if(option){ + try { option->numericalValue((yyvsp[(8) - (9)].d)); } + catch(...){ + yymsg(0, "Cannot assign a numerical value to option '%s' " + "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); + } + } + else + yymsg(0, "Unknown option '%s' in field %i of type '%s'", + (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); #endif Free((yyvsp[(6) - (9)].c)); ;} @@ -4758,20 +4758,20 @@ yyreduce: #if defined(HAVE_MESH) Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (9)].d)); if(field){ - FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; - if(option){ - try { option->string() = (yyvsp[(8) - (9)].c); } - catch (...){ - yymsg(0, "Cannot assign a string value to option '%s' " - "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); - } - } - else - yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); + FieldOption *option = field->options[(yyvsp[(6) - (9)].c)]; + if(option){ + try { option->string() = (yyvsp[(8) - (9)].c); } + catch (...){ + yymsg(0, "Cannot assign a string value to option '%s' " + "in field %i of type '%s'", (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); + } + } + else + yymsg(0, "Unknown option '%s' in field %i of type '%s'", + (yyvsp[(6) - (9)].c), (int)(yyvsp[(3) - (9)].d), field->getName()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (9)].d)); #endif Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c)); @@ -4784,22 +4784,22 @@ yyreduce: #if defined(HAVE_MESH) Field *field = GModel::current()->getFields()->get((int)(yyvsp[(3) - (11)].d)); if(field){ - FieldOption *option = field->options[(yyvsp[(6) - (11)].c)]; - if(option){ - std::list<int> &vl = option->list(); - vl.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(9) - (11)].l)); i++){ - double id; - List_Read((yyvsp[(9) - (11)].l), i, &id); - vl.push_back((int)id); - } - } - else - yymsg(0, "Unknown option '%s' in field %i of type '%s'", - (yyvsp[(6) - (11)].c), (int)(yyvsp[(3) - (11)].d), field->getName()); + FieldOption *option = field->options[(yyvsp[(6) - (11)].c)]; + if(option){ + std::list<int> &vl = option->list(); + vl.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(9) - (11)].l)); i++){ + double id; + List_Read((yyvsp[(9) - (11)].l), i, &id); + vl.push_back((int)id); + } + } + else + yymsg(0, "Unknown option '%s' in field %i of type '%s'", + (yyvsp[(6) - (11)].c), (int)(yyvsp[(3) - (11)].d), field->getName()); } else - yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d)); + yymsg(0, "No field with id %i", (int)(yyvsp[(3) - (11)].d)); #endif Free((yyvsp[(6) - (11)].c)); List_Delete((yyvsp[(9) - (11)].l)); @@ -4811,10 +4811,10 @@ yyreduce: { #if defined(HAVE_POST) try { - PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); + PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].d)); } catch (...) { - yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); + yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); } #endif Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); @@ -4826,10 +4826,10 @@ yyreduce: { #if defined(HAVE_POST) try { - PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].c)); + PluginManager::instance()->setPluginOption((yyvsp[(3) - (9)].c), (yyvsp[(6) - (9)].c), (yyvsp[(8) - (9)].c)); } catch (...) { - yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); + yymsg(0, "Unknown option '%s' or plugin '%s'", (yyvsp[(6) - (9)].c), (yyvsp[(3) - (9)].c)); } #endif Free((yyvsp[(3) - (9)].c)); Free((yyvsp[(6) - (9)].c)); Free((yyvsp[(8) - (9)].c)); @@ -4866,9 +4866,9 @@ yyreduce: (yyval.l) = List_Create(1, 1, sizeof(Vertex*)); Vertex *v = FindPoint((int)(yyvsp[(4) - (5)].d)); if(!v) - yymsg(0, "Unknown point %d", (int)(yyvsp[(4) - (5)].d)); + yymsg(0, "Unknown point %d", (int)(yyvsp[(4) - (5)].d)); else{ - List_Add((yyval.l), &v); + List_Add((yyval.l), &v); } ;} break; @@ -4892,21 +4892,21 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindPoint(num)){ - yymsg(0, "Point %d already exists", num); + yymsg(0, "Point %d already exists", num); } else{ - double x = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[0]; - double y = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[1]; - double z = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[2]; - double lc = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[3]; - if(lc == 0.) lc = MAX_LC; // no mesh size given at the point - Vertex *v; - if(!myGmshSurface) - v = Create_Vertex(num, x, y, z, lc, 1.0); - else - v = Create_Vertex(num, x, y, myGmshSurface, lc); - Tree_Add(GModel::current()->getGEOInternals()->Points, &v); - AddToTemporaryBoundingBox(v->Pos.X, v->Pos.Y, v->Pos.Z); + double x = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[0]; + double y = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[1]; + double z = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[2]; + double lc = CTX::instance()->geom.scalingFactor * (yyvsp[(6) - (7)].v)[3]; + if(lc == 0.) lc = MAX_LC; // no mesh size given at the point + Vertex *v; + if(!myGmshSurface) + v = Create_Vertex(num, x, y, z, lc, 1.0); + else + v = Create_Vertex(num, x, y, myGmshSurface, lc); + Tree_Add(GModel::current()->getGEOInternals()->Points, &v); + AddToTemporaryBoundingBox(v->Pos.X, v->Pos.Y, v->Pos.Z); } (yyval.s).Type = MSH_POINT; (yyval.s).Num = num; @@ -4925,13 +4925,13 @@ yyreduce: { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_POINT)){ - yymsg(0, "Physical point %d already exists", num); + yymsg(0, "Physical point %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_POINT, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_POINT, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_POINT; @@ -4943,16 +4943,16 @@ yyreduce: #line 1057 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (6)].l), i, &d); - Vertex *v = FindPoint((int)d); - if(v) - v->lc = (yyvsp[(5) - (6)].d); - else{ - GVertex *gv = GModel::current()->getVertexByTag((int)d); - if(gv) - gv->setPrescribedMeshSizeAtVertex((yyvsp[(5) - (6)].d)); - } + double d; + List_Read((yyvsp[(3) - (6)].l), i, &d); + Vertex *v = FindPoint((int)d); + if(v) + v->lc = (yyvsp[(5) - (6)].d); + else{ + GVertex *gv = GModel::current()->getVertexByTag((int)d); + if(gv) + gv->setPrescribedMeshSizeAtVertex((yyvsp[(5) - (6)].d)); + } } List_Delete((yyvsp[(3) - (6)].l)); // dummy values @@ -4966,15 +4966,15 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_LINE, 1, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_LINE, 1, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_LINE; @@ -4986,22 +4986,22 @@ yyreduce: #line 1097 "Gmsh.y" { for (int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - double dnum; - List_Read((yyvsp[(3) - (4)].l), i, &dnum); - int num = (int) fabs(dnum); - Curve *c = FindCurve(num); - if (c){ - c->degenerated = true; - } - else{ - GEdge *ge = GModel::current()->getEdgeByTag(num); - if (!ge){ - yymsg(0, "Curve %d does not exist", num); - } - else{ - ge->setTooSmall(true); - } - } + double dnum; + List_Read((yyvsp[(3) - (4)].l), i, &dnum); + int num = (int) fabs(dnum); + Curve *c = FindCurve(num); + if (c){ + c->degenerated = true; + } + else{ + GEdge *ge = GModel::current()->getEdgeByTag(num); + if (!ge){ + yymsg(0, "Curve %d does not exist", num); + } + else{ + ge->setTooSmall(true); + } + } } ;} break; @@ -5011,15 +5011,15 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_SPLN, 3, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_SPLN, 3, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_SPLN; @@ -5032,27 +5032,27 @@ yyreduce: { int num = (int)(yyvsp[(3) - (8)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL, - -1, -1, 0., 1.); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_CIRC, 2, temp, NULL, + -1, -1, 0., 1.); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ c->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; c->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; c->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(c); } - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - Curve *rc = CreateReversedCurve(c); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + Curve *rc = CreateReversedCurve(c); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ rc->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; rc->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; rc->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(rc); } - List_Delete(temp); + List_Delete(temp); } List_Delete((yyvsp[(6) - (8)].l)); (yyval.s).Type = MSH_SEGM_CIRC; @@ -5065,27 +5065,27 @@ yyreduce: { int num = (int)(yyvsp[(3) - (8)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL, - -1, -1, 0., 1.); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (8)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_ELLI, 2, temp, NULL, + -1, -1, 0., 1.); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ c->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; c->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; c->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(c); } - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - Curve *rc = CreateReversedCurve(c); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + Curve *rc = CreateReversedCurve(c); if((yyvsp[(7) - (8)].v)[0] || (yyvsp[(7) - (8)].v)[1] || (yyvsp[(7) - (8)].v)[2]){ rc->Circle.n[0] = (yyvsp[(7) - (8)].v)[0]; rc->Circle.n[1] = (yyvsp[(7) - (8)].v)[1]; rc->Circle.n[2] = (yyvsp[(7) - (8)].v)[2]; End_Curve(rc); } - List_Delete(temp); + List_Delete(temp); } List_Delete((yyvsp[(6) - (8)].l)); (yyval.s).Type = MSH_SEGM_ELLI; @@ -5098,15 +5098,15 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_BSPLN, 2, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_BSPLN, 2, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_BSPLN; @@ -5119,15 +5119,15 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_BEZIER, 2, temp, NULL, - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_BEZIER, 2, temp, NULL, + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_SEGM_BEZIER; @@ -5140,22 +5140,22 @@ yyreduce: { int num = (int)(yyvsp[(3) - (11)].d); if(List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1 != List_Nbr((yyvsp[(8) - (11)].l))){ - yymsg(0, "Wrong definition of Nurbs Curve %d: " - "got %d knots, need N + D + 1 = %d + %d + 1 = %d", - (int)(yyvsp[(3) - (11)].d), List_Nbr((yyvsp[(8) - (11)].l)), List_Nbr((yyvsp[(6) - (11)].l)), (int)(yyvsp[(10) - (11)].d), List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1); + yymsg(0, "Wrong definition of Nurbs Curve %d: " + "got %d knots, need N + D + 1 = %d + %d + 1 = %d", + (int)(yyvsp[(3) - (11)].d), List_Nbr((yyvsp[(8) - (11)].l)), List_Nbr((yyvsp[(6) - (11)].l)), (int)(yyvsp[(10) - (11)].d), List_Nbr((yyvsp[(6) - (11)].l)) + (int)(yyvsp[(10) - (11)].d) + 1); } else{ - if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); - } - else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (11)].l)); - Curve *c = Create_Curve(num, MSH_SEGM_NURBS, (int)(yyvsp[(10) - (11)].d), temp, (yyvsp[(8) - (11)].l), - -1, -1, 0., 1.); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); - CreateReversedCurve(c); - List_Delete(temp); - } + if(FindCurve(num)){ + yymsg(0, "Curve %d already exists", num); + } + else{ + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (11)].l)); + Curve *c = Create_Curve(num, MSH_SEGM_NURBS, (int)(yyvsp[(10) - (11)].d), temp, (yyvsp[(8) - (11)].l), + -1, -1, 0., 1.); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + CreateReversedCurve(c); + List_Delete(temp); + } } List_Delete((yyvsp[(6) - (11)].l)); List_Delete((yyvsp[(8) - (11)].l)); @@ -5169,14 +5169,14 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindEdgeLoop(num)){ - yymsg(0, "Line loop %d already exists", num); + yymsg(0, "Line loop %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - sortEdgesInLoop(num, temp); - EdgeLoop *l = Create_EdgeLoop(num, temp); - Tree_Add(GModel::current()->getGEOInternals()->EdgeLoops, &l); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + sortEdgesInLoop(num, temp); + EdgeLoop *l = Create_EdgeLoop(num, temp); + Tree_Add(GModel::current()->getGEOInternals()->EdgeLoops, &l); + List_Delete(temp); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SEGM_LOOP; @@ -5189,13 +5189,13 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindCurve(num)){ - yymsg(0, "Curve %d already exists", num); + yymsg(0, "Curve %d already exists", num); } else{ Curve *c = Create_Curve(num, MSH_SEGM_COMPOUND, 1, NULL, NULL, -1, -1, 0., 1.); for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) c->compound.push_back((int)*(double*)List_Pointer((yyvsp[(7) - (8)].l), i)); - Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); + Tree_Add(GModel::current()->getGEOInternals()->Curves, &c); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SEGM_COMPOUND; @@ -5215,13 +5215,13 @@ yyreduce: { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_LINE)){ - yymsg(0, "Physical line %d already exists", num); + yymsg(0, "Physical line %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_LINE, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_LINE; @@ -5234,15 +5234,15 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - Surface *s = Create_Surface(num, MSH_SURF_PLAN); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - setSurfaceGeneratrices(s, temp); - List_Delete(temp); - End_Surface(s); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + Surface *s = Create_Surface(num, MSH_SURF_PLAN); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + setSurfaceGeneratrices(s, temp); + List_Delete(temp); + End_Surface(s); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SURF_PLAN; @@ -5255,36 +5255,36 @@ yyreduce: { int num = (int)(yyvsp[(4) - (9)].d), type = 0; if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - double d; - List_Read((yyvsp[(7) - (9)].l), 0, &d); - EdgeLoop *el = FindEdgeLoop((int)fabs(d)); - if(!el){ - yymsg(0, "Unknown line loop %d", (int)d); - } - else{ - int j = List_Nbr(el->Curves); - if(j == 4){ - type = MSH_SURF_REGL; - } - else if(j == 3){ - type = MSH_SURF_TRIC; - } - else{ - yymsg(0, "Wrong definition of Ruled Surface %d: " - "%d borders instead of 3 or 4", num, j); - type = MSH_SURF_PLAN; - } - Surface *s = Create_Surface(num, type); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (9)].l)); - setSurfaceGeneratrices(s, temp); - List_Delete(temp); - End_Surface(s); - s->InSphereCenter = (yyvsp[(8) - (9)].l); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); - } + double d; + List_Read((yyvsp[(7) - (9)].l), 0, &d); + EdgeLoop *el = FindEdgeLoop((int)fabs(d)); + if(!el){ + yymsg(0, "Unknown line loop %d", (int)d); + } + else{ + int j = List_Nbr(el->Curves); + if(j == 4){ + type = MSH_SURF_REGL; + } + else if(j == 3){ + type = MSH_SURF_TRIC; + } + else{ + yymsg(0, "Wrong definition of Ruled Surface %d: " + "%d borders instead of 3 or 4", num, j); + type = MSH_SURF_PLAN; + } + Surface *s = Create_Surface(num, type); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (9)].l)); + setSurfaceGeneratrices(s, temp); + List_Delete(temp); + End_Surface(s); + s->InSphereCenter = (yyvsp[(8) - (9)].l); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + } } List_Delete((yyvsp[(7) - (9)].l)); (yyval.s).Type = type; @@ -5325,23 +5325,23 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){ - yymsg(0, "Sphere %d has to be defined using 2 points (center + " - "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); + yymsg(0, "Sphere %d has to be defined using 2 points (center + " + "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); } else{ - double p1,p2; - List_Read((yyvsp[(6) - (7)].l), 0, &p1); - List_Read((yyvsp[(6) - (7)].l), 1, &p2); - Vertex *v1 = FindPoint((int)p1); - Vertex *v2 = FindPoint((int)p2); - if(!v1) yymsg(0, "Sphere %d : unknown point %d", num, (int)p1); - if(!v2) yymsg(0, "Sphere %d : unknown point %d", num, (int)p2); - if(v1 && v2) - myGmshSurface = gmshSphere::NewSphere - (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, - sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + - (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + - (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); + double p1,p2; + List_Read((yyvsp[(6) - (7)].l), 0, &p1); + List_Read((yyvsp[(6) - (7)].l), 1, &p2); + Vertex *v1 = FindPoint((int)p1); + Vertex *v2 = FindPoint((int)p2); + if(!v1) yymsg(0, "Sphere %d : unknown point %d", num, (int)p1); + if(!v2) yymsg(0, "Sphere %d : unknown point %d", num, (int)p2); + if(v1 && v2) + myGmshSurface = gmshSphere::NewSphere + (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, + sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + + (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + + (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); } (yyval.s).Type = 0; (yyval.s).Num = num; @@ -5353,23 +5353,23 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if (List_Nbr((yyvsp[(6) - (7)].l)) != 2){ - yymsg(0, "PolarSphere %d has to be defined using 2 points (center + " - "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); + yymsg(0, "PolarSphere %d has to be defined using 2 points (center + " + "any point) and not %d", num, List_Nbr((yyvsp[(6) - (7)].l))); } else{ - double p1,p2; - List_Read((yyvsp[(6) - (7)].l), 0, &p1); - List_Read((yyvsp[(6) - (7)].l), 1, &p2); - Vertex *v1 = FindPoint((int)p1); - Vertex *v2 = FindPoint((int)p2); - if(!v1) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p1); - if(!v2) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p2); - if(v1 && v2) - myGmshSurface = gmshPolarSphere::NewPolarSphere - (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, - sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + - (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + - (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); + double p1,p2; + List_Read((yyvsp[(6) - (7)].l), 0, &p1); + List_Read((yyvsp[(6) - (7)].l), 1, &p2); + Vertex *v1 = FindPoint((int)p1); + Vertex *v2 = FindPoint((int)p2); + if(!v1) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p1); + if(!v2) yymsg(0, "PolarSphere %d : unknown point %d", num, (int)p2); + if(v1 && v2) + myGmshSurface = gmshPolarSphere::NewPolarSphere + (num, v1->Pos.X, v1->Pos.Y, v1->Pos.Z, + sqrt((v2->Pos.X - v1->Pos.X) * (v2->Pos.X - v1->Pos.X) + + (v2->Pos.Y - v1->Pos.Y) * (v2->Pos.Y - v1->Pos.Y) + + (v2->Pos.Z - v1->Pos.Z) * (v2->Pos.Z - v1->Pos.Z))); } (yyval.s).Type = 0; (yyval.s).Num = num; @@ -5381,13 +5381,13 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindSurfaceLoop(num)){ - yymsg(0, "Surface loop %d already exists", num); + yymsg(0, "Surface loop %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - SurfaceLoop *l = Create_SurfaceLoop(num, temp); - Tree_Add(GModel::current()->getGEOInternals()->SurfaceLoops, &l); - List_Delete(temp); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + SurfaceLoop *l = Create_SurfaceLoop(num, temp); + Tree_Add(GModel::current()->getGEOInternals()->SurfaceLoops, &l); + List_Delete(temp); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_SURF_LOOP; @@ -5400,15 +5400,15 @@ yyreduce: { int num = (int)(yyvsp[(4) - (9)].d); if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ Surface *s = Create_Surface(num, MSH_SURF_COMPOUND); for(int i = 0; i < List_Nbr((yyvsp[(7) - (9)].l)); i++){ s->compound.push_back((int)*(double*)List_Pointer((yyvsp[(7) - (9)].l), i)); - s->TypeOfMapping = (yyvsp[(8) - (9)].i); - } - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + s->TypeOfMapping = (yyvsp[(8) - (9)].i); + } + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); } List_Delete((yyvsp[(7) - (9)].l)); (yyval.s).Type = MSH_SURF_COMPOUND; @@ -5421,24 +5421,24 @@ yyreduce: { int num = (int)(yyvsp[(4) - (13)].d); if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ Surface *s = Create_Surface(num, MSH_SURF_COMPOUND); for(int i = 0; i < List_Nbr((yyvsp[(7) - (13)].l)); i++) s->compound.push_back((int)*(double*)List_Pointer((yyvsp[(7) - (13)].l), i)); - for (int i = 0; i < List_Nbr((yyvsp[(10) - (13)].l)); i++){ + for (int i = 0; i < List_Nbr((yyvsp[(10) - (13)].l)); i++){ if(i > 3){ yymsg(0, "Too many boundary specifiers in compound surface"); break; } - List_T *l = *(List_T**)List_Pointer((yyvsp[(10) - (13)].l), i); + List_T *l = *(List_T**)List_Pointer((yyvsp[(10) - (13)].l), i); for (int j = 0; j < List_Nbr(l); j++){ s->compoundBoundary[i].push_back((int)*(double*)List_Pointer(l, j)); - s->TypeOfMapping = (yyvsp[(12) - (13)].i); - } - } - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + s->TypeOfMapping = (yyvsp[(12) - (13)].i); + } + } + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); } List_Delete((yyvsp[(7) - (13)].l)); for (int i = 0; i < List_Nbr((yyvsp[(10) - (13)].l)); i++) @@ -5462,13 +5462,13 @@ yyreduce: { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_SURFACE)){ - yymsg(0, "Physical surface %d already exists", num); + yymsg(0, "Physical surface %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_SURFACE, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_SURFACE; @@ -5482,14 +5482,14 @@ yyreduce: yymsg(0, "'Complex Volume' command is deprecated: use 'Volume' instead"); int num = (int)(yyvsp[(4) - (8)].d); if(FindVolume(num)){ - yymsg(0, "Volume %d already exists", num); + yymsg(0, "Volume %d already exists", num); } else{ - Volume *v = Create_Volume(num, MSH_VOLUME); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); - setVolumeSurfaces(v, temp); - List_Delete(temp); - Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); + Volume *v = Create_Volume(num, MSH_VOLUME); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(7) - (8)].l)); + setVolumeSurfaces(v, temp); + List_Delete(temp); + Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_VOLUME; @@ -5502,14 +5502,14 @@ yyreduce: { int num = (int)(yyvsp[(3) - (7)].d); if(FindVolume(num)){ - yymsg(0, "Volume %d already exists", num); + yymsg(0, "Volume %d already exists", num); } else{ - Volume *v = Create_Volume(num, MSH_VOLUME); - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); - setVolumeSurfaces(v, temp); - List_Delete(temp); - Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); + Volume *v = Create_Volume(num, MSH_VOLUME); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(6) - (7)].l)); + setVolumeSurfaces(v, temp); + List_Delete(temp); + Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); } List_Delete((yyvsp[(6) - (7)].l)); (yyval.s).Type = MSH_VOLUME; @@ -5538,13 +5538,13 @@ yyreduce: { int num = (int)(yyvsp[(4) - (8)].d); if(FindVolume(num)){ - yymsg(0, "Volume %d already exists", num); + yymsg(0, "Volume %d already exists", num); } else{ - Volume *v = Create_Volume(num, MSH_VOLUME_COMPOUND); + Volume *v = Create_Volume(num, MSH_VOLUME_COMPOUND); for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) v->compound.push_back((int)*(double*)List_Pointer((yyvsp[(7) - (8)].l), i)); - Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); + Tree_Add(GModel::current()->getGEOInternals()->Volumes, &v); } List_Delete((yyvsp[(7) - (8)].l)); (yyval.s).Type = MSH_VOLUME_COMPOUND; @@ -5564,13 +5564,13 @@ yyreduce: { int num = (int)(yyvsp[(5) - (9)].i); if(FindPhysicalGroup(num, MSH_PHYSICAL_VOLUME)){ - yymsg(0, "Physical volume %d already exists", num); + yymsg(0, "Physical volume %d already exists", num); } else{ - List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); - PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp); - List_Delete(temp); - List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); + List_T *temp = ListOfDouble2ListOfInt((yyvsp[(8) - (9)].l)); + PhysicalGroup *p = Create_PhysicalGroup(num, MSH_PHYSICAL_VOLUME, temp); + List_Delete(temp); + List_Add(GModel::current()->getGEOInternals()->PhysicalGroups, &p); } List_Delete((yyvsp[(8) - (9)].l)); (yyval.s).Type = MSH_PHYSICAL_VOLUME; @@ -5681,24 +5681,24 @@ yyreduce: #line 1692 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Vertex *v = FindPoint(std::abs(TheShape.Num)); - if(v){ - TheShape.Type = MSH_POINT; - List_Add((yyval.l), &TheShape); - } - else{ - GVertex *gv = GModel::current()->getVertexByTag(std::abs(TheShape.Num)); - if(gv){ - TheShape.Type = MSH_POINT_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown point %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Vertex *v = FindPoint(std::abs(TheShape.Num)); + if(v){ + TheShape.Type = MSH_POINT; + List_Add((yyval.l), &TheShape); + } + else{ + GVertex *gv = GModel::current()->getVertexByTag(std::abs(TheShape.Num)); + if(gv){ + TheShape.Type = MSH_POINT_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown point %d", TheShape.Num); + } } ;} break; @@ -5707,24 +5707,24 @@ yyreduce: #line 1715 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Curve *c = FindCurve(std::abs(TheShape.Num)); - if(c){ - TheShape.Type = c->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GEdge *ge = GModel::current()->getEdgeByTag(std::abs(TheShape.Num)); - if(ge){ - TheShape.Type = MSH_SEGM_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown curve %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Curve *c = FindCurve(std::abs(TheShape.Num)); + if(c){ + TheShape.Type = c->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GEdge *ge = GModel::current()->getEdgeByTag(std::abs(TheShape.Num)); + if(ge){ + TheShape.Type = MSH_SEGM_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown curve %d", TheShape.Num); + } } ;} break; @@ -5733,24 +5733,24 @@ yyreduce: #line 1738 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Surface *s = FindSurface(std::abs(TheShape.Num)); - if(s){ - TheShape.Type = s->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GFace *gf = GModel::current()->getFaceByTag(std::abs(TheShape.Num)); - if(gf){ - TheShape.Type = MSH_SURF_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown surface %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Surface *s = FindSurface(std::abs(TheShape.Num)); + if(s){ + TheShape.Type = s->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GFace *gf = GModel::current()->getFaceByTag(std::abs(TheShape.Num)); + if(gf){ + TheShape.Type = MSH_SURF_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown surface %d", TheShape.Num); + } } ;} break; @@ -5759,24 +5759,24 @@ yyreduce: #line 1761 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(4) - (6)].l), i, &d); - Shape TheShape; - TheShape.Num = (int)d; - Volume *v = FindVolume(std::abs(TheShape.Num)); - if(v){ - TheShape.Type = v->Typ; - List_Add((yyval.l), &TheShape); - } - else{ - GRegion *gr = GModel::current()->getRegionByTag(std::abs(TheShape.Num)); - if(gr){ - TheShape.Type = MSH_VOLUME_FROM_GMODEL; - List_Add((yyval.l), &TheShape); - } - else - yymsg(1, "Unknown volume %d", TheShape.Num); - } + double d; + List_Read((yyvsp[(4) - (6)].l), i, &d); + Shape TheShape; + TheShape.Num = (int)d; + Volume *v = FindVolume(std::abs(TheShape.Num)); + if(v){ + TheShape.Type = v->Typ; + List_Add((yyval.l), &TheShape); + } + else{ + GRegion *gr = GModel::current()->getRegionByTag(std::abs(TheShape.Num)); + if(gr){ + TheShape.Type = MSH_VOLUME_FROM_GMODEL; + List_Add((yyval.l), &TheShape); + } + else + yymsg(1, "Unknown volume %d", TheShape.Num); + } } ;} break; @@ -5788,7 +5788,7 @@ yyreduce: if(List_Nbr((yyvsp[(7) - (8)].l)) == 4){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[4]; @@ -5812,7 +5812,7 @@ yyreduce: if(List_Nbr((yyvsp[(12) - (14)].l)) == 0){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double pt[3] = {(yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2]}; @@ -5835,7 +5835,7 @@ yyreduce: if(List_Nbr((yyvsp[(14) - (16)].l)) == 0){ int t = (int)(yyvsp[(4) - (16)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double pt1[3] = {(yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2]}; @@ -5859,7 +5859,7 @@ yyreduce: if(List_Nbr((yyvsp[(10) - (12)].l)) == 1){ int t = (int)(yyvsp[(4) - (12)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -5882,14 +5882,14 @@ yyreduce: if(!strcmp((yyvsp[(2) - (8)].c), "Union")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const gLevelset *> vl; for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) { double d; List_Read((yyvsp[(7) - (8)].l), i, &d); LevelSet *pl = FindLevelSet((int)d); - if(!pl) yymsg(0, "Levelset Union %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Union %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetUnion(vl); @@ -5900,14 +5900,14 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "Intersection")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const gLevelset *> vl; for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) { double d; List_Read((yyvsp[(7) - (8)].l), i, &d); LevelSet *pl = FindLevelSet((int)d); - if(!pl) yymsg(0, "Levelset Intersection %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Intersection %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetIntersection(vl); @@ -5918,14 +5918,14 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "Cut")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const gLevelset *> vl; for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) { double d; List_Read((yyvsp[(7) - (8)].l), i, &d); LevelSet *pl = FindLevelSet((int)d); - if(!pl) yymsg(0, "Levelset Cut %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Cut %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetCut(vl); @@ -5936,14 +5936,14 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "Crack")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { std::vector<const gLevelset *> vl; for(int i = 0; i < List_Nbr((yyvsp[(7) - (8)].l)); i++) { double d; List_Read((yyvsp[(7) - (8)].l), i, &d); LevelSet *pl = FindLevelSet((int)d); - if(!pl) yymsg(0, "Levelset Crack %d : unknown levelset %d", t, (int)d); + if(!pl) yymsg(0, "Levelset Crack %d : unknown levelset %d", t, (int)d); else vl.push_back(pl->ls); } gLevelset *ls = new gLevelsetCrack(vl); @@ -5954,7 +5954,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "Reverse")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -5971,7 +5971,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (8)].c), "PostView")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { if(List_Nbr((yyvsp[(7) - (8)].l)) > 0){ @@ -5997,7 +5997,7 @@ yyreduce: if(!strcmp((yyvsp[(2) - (8)].c), "MathEval")){ int t = (int)(yyvsp[(4) - (8)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { gLevelset *ls = new gLevelsetMathEval((yyvsp[(7) - (8)].c), t); @@ -6042,7 +6042,7 @@ yyreduce: if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 1){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -6057,7 +6057,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Cone") && List_Nbr((yyvsp[(12) - (14)].l)) == 1){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d; @@ -6072,7 +6072,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 2){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[2]; @@ -6088,7 +6088,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Cylinder") && List_Nbr((yyvsp[(12) - (14)].l)) == 3){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[3]; @@ -6104,7 +6104,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Ellipsoid") && List_Nbr((yyvsp[(12) - (14)].l)) == 3){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[3]; @@ -6120,7 +6120,7 @@ yyreduce: else if(!strcmp((yyvsp[(2) - (14)].c), "Quadric") && List_Nbr((yyvsp[(12) - (14)].l)) == 5){ int t = (int)(yyvsp[(4) - (14)].d); if(FindLevelSet(t)){ - yymsg(0, "Levelset %d already exists", t); + yymsg(0, "Levelset %d already exists", t); } else { double d[5]; @@ -6145,9 +6145,9 @@ yyreduce: #line 2133 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - DeleteShape(TheShape.Type, TheShape.Num); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + DeleteShape(TheShape.Type, TheShape.Num); } List_Delete((yyvsp[(3) - (4)].l)); ;} @@ -6167,14 +6167,14 @@ yyreduce: { #if defined(HAVE_POST) if(!strcmp((yyvsp[(2) - (6)].c), "View")){ - int index = (int)(yyvsp[(4) - (6)].d); - if(index >= 0 && index < (int)PView::list.size()) - delete PView::list[index]; - else - yymsg(0, "Unknown view %d", index); + int index = (int)(yyvsp[(4) - (6)].d); + if(index >= 0 && index < (int)PView::list.size()) + delete PView::list[index]; + else + yymsg(0, "Unknown view %d", index); } else - yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c)); + yymsg(0, "Unknown command 'Delete %s'", (yyvsp[(2) - (6)].c)); #endif Free((yyvsp[(2) - (6)].c)); ;} @@ -6187,25 +6187,25 @@ yyreduce: ClearProject(); } else if(!strcmp((yyvsp[(2) - (3)].c), "Model")){ - GModel::current()->destroy(); - GModel::current()->getGEOInternals()->destroy(); + GModel::current()->destroy(); + GModel::current()->getGEOInternals()->destroy(); } else if(!strcmp((yyvsp[(2) - (3)].c), "Physicals")){ - GModel::current()->getGEOInternals()->reset_physicals(); - GModel::current()->deletePhysicalGroups(); + GModel::current()->getGEOInternals()->reset_physicals(); + GModel::current()->deletePhysicalGroups(); } else if(!strcmp((yyvsp[(2) - (3)].c), "Variables")){ - gmsh_yysymbols.clear(); + gmsh_yysymbols.clear(); } else if(!strcmp((yyvsp[(2) - (3)].c), "Options")){ ReInitOptions(0); InitOptionsGUI(0); } else{ - if(gmsh_yysymbols.count((yyvsp[(2) - (3)].c))) - gmsh_yysymbols.erase((yyvsp[(2) - (3)].c)); - else - yymsg(0, "Unknown object or expression to delete '%s'", (yyvsp[(2) - (3)].c)); + if(gmsh_yysymbols.count((yyvsp[(2) - (3)].c))) + gmsh_yysymbols.erase((yyvsp[(2) - (3)].c)); + else + yymsg(0, "Unknown object or expression to delete '%s'", (yyvsp[(2) - (3)].c)); } Free((yyvsp[(2) - (3)].c)); ;} @@ -6216,11 +6216,11 @@ yyreduce: { #if defined(HAVE_POST) if(!strcmp((yyvsp[(2) - (4)].c), "Empty") && !strcmp((yyvsp[(3) - (4)].c), "Views")){ - for(int i = PView::list.size() - 1; i >= 0; i--) - if(PView::list[i]->getData()->empty()) delete PView::list[i]; + for(int i = PView::list.size() - 1; i >= 0; i--) + if(PView::list[i]->getData()->empty()) delete PView::list[i]; } else - yymsg(0, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c)); + yymsg(0, "Unknown command 'Delete %s %s'", (yyvsp[(2) - (4)].c), (yyvsp[(3) - (4)].c)); #endif Free((yyvsp[(2) - (4)].c)); Free((yyvsp[(3) - (4)].c)); ;} @@ -6230,9 +6230,9 @@ yyreduce: #line 2208 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(4) - (5)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(4) - (5)].l), i, &TheShape); - ColorShape(TheShape.Type, TheShape.Num, (yyvsp[(2) - (5)].u)); + Shape TheShape; + List_Read((yyvsp[(4) - (5)].l), i, &TheShape); + ColorShape(TheShape.Type, TheShape.Num, (yyvsp[(2) - (5)].u)); } List_Delete((yyvsp[(4) - (5)].l)); ;} @@ -6242,7 +6242,7 @@ yyreduce: #line 2222 "Gmsh.y" { for(int i = 0; i < 4; i++) - VisibilityShape((yyvsp[(2) - (3)].c), i, 1); + VisibilityShape((yyvsp[(2) - (3)].c), i, 1); Free((yyvsp[(2) - (3)].c)); ;} break; @@ -6251,7 +6251,7 @@ yyreduce: #line 2228 "Gmsh.y" { for(int i = 0; i < 4; i++) - VisibilityShape((yyvsp[(2) - (3)].c), i, 0); + VisibilityShape((yyvsp[(2) - (3)].c), i, 0); Free((yyvsp[(2) - (3)].c)); ;} break; @@ -6260,9 +6260,9 @@ yyreduce: #line 2234 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - VisibilityShape(TheShape.Type, TheShape.Num, 1); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + VisibilityShape(TheShape.Type, TheShape.Num, 1); } List_Delete((yyvsp[(3) - (4)].l)); ;} @@ -6272,9 +6272,9 @@ yyreduce: #line 2243 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){ - Shape TheShape; - List_Read((yyvsp[(3) - (4)].l), i, &TheShape); - VisibilityShape(TheShape.Type, TheShape.Num, 0); + Shape TheShape; + List_Read((yyvsp[(3) - (4)].l), i, &TheShape); + VisibilityShape(TheShape.Type, TheShape.Num, 0); } List_Delete((yyvsp[(3) - (4)].l)); ;} @@ -6285,42 +6285,42 @@ yyreduce: { if(!strcmp((yyvsp[(1) - (3)].c), "Include")){ std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c)); - // Warning: we *don't* close included files (to allow user - // functions in these files). If you need to include many many - // files and don't have functions in the files, use "Merge" - // instead: some OSes limit the number of files a process can - // open simultaneously. The right solution would be of course - // to modify FunctionManager to reopen the files instead of - // using the FILE pointer, but hey, I'm lazy... - Msg::StatusBar(2, true, "Reading '%s'", tmp.c_str()); - ParseFile(tmp, false, true); - SetBoundingBox(); - Msg::StatusBar(2, true, "Done reading '%s'", tmp.c_str()); + // Warning: we *don't* close included files (to allow user + // functions in these files). If you need to include many many + // files and don't have functions in the files, use "Merge" + // instead: some OSes limit the number of files a process can + // open simultaneously. The right solution would be of course + // to modify FunctionManager to reopen the files instead of + // using the FILE pointer, but hey, I'm lazy... + Msg::StatusBar(2, true, "Reading '%s'", tmp.c_str()); + ParseFile(tmp, false, true); + SetBoundingBox(); + Msg::StatusBar(2, true, "Done reading '%s'", tmp.c_str()); } else if(!strcmp((yyvsp[(1) - (3)].c), "Print")){ - // make sure we have the latest data from GEO_Internals in GModel - // (fixes bug where we would have no geometry in the picture if - // the print command is in the same file as the geometry) - GModel::current()->importGEOInternals(); + // make sure we have the latest data from GEO_Internals in GModel + // (fixes bug where we would have no geometry in the picture if + // the print command is in the same file as the geometry) + GModel::current()->importGEOInternals(); std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c)); - CreateOutputFile(tmp, CTX::instance()->print.format); + CreateOutputFile(tmp, CTX::instance()->print.format); } else if(!strcmp((yyvsp[(1) - (3)].c), "Save")){ - GModel::current()->importGEOInternals(); + GModel::current()->importGEOInternals(); std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c)); - CreateOutputFile(tmp, CTX::instance()->mesh.format); + CreateOutputFile(tmp, CTX::instance()->mesh.format); } else if(!strcmp((yyvsp[(1) - (3)].c), "Merge") || !strcmp((yyvsp[(1) - (3)].c), "MergeWithBoundingBox")){ - // MergeWithBoundingBox is deprecated + // MergeWithBoundingBox is deprecated std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(2) - (3)].c)); - MergeFile(tmp, true); + MergeFile(tmp, true); } else if(!strcmp((yyvsp[(1) - (3)].c), "System")) - SystemCall((yyvsp[(2) - (3)].c)); + SystemCall((yyvsp[(2) - (3)].c)); else if(!strcmp((yyvsp[(1) - (3)].c), "SetName")) - GModel::current()->setName((yyvsp[(2) - (3)].c)); + GModel::current()->setName((yyvsp[(2) - (3)].c)); else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); Free((yyvsp[(1) - (3)].c)); Free((yyvsp[(2) - (3)].c)); ;} break; @@ -6330,16 +6330,16 @@ yyreduce: { #if defined(HAVE_POST) if(!strcmp((yyvsp[(1) - (7)].c), "Save") && !strcmp((yyvsp[(2) - (7)].c), "View")){ - int index = (int)(yyvsp[(4) - (7)].d); - if(index >= 0 && index < (int)PView::list.size()){ + int index = (int)(yyvsp[(4) - (7)].d); + if(index >= 0 && index < (int)PView::list.size()){ std::string tmp = FixRelativePath(gmsh_yyname, (yyvsp[(6) - (7)].c)); - PView::list[index]->write(tmp, CTX::instance()->post.fileFormat); - } - else - yymsg(0, "Unknown view %d", index); + PView::list[index]->write(tmp, CTX::instance()->post.fileFormat); + } + else + yymsg(0, "Unknown view %d", index); } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); #endif Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} @@ -6350,14 +6350,14 @@ yyreduce: { #if defined(HAVE_POST) && defined(HAVE_MESH) if(!strcmp((yyvsp[(1) - (7)].c), "Background") && !strcmp((yyvsp[(2) - (7)].c), "Mesh") && !strcmp((yyvsp[(3) - (7)].c), "View")){ - int index = (int)(yyvsp[(5) - (7)].d); - if(index >= 0 && index < (int)PView::list.size()) - GModel::current()->getFields()->setBackgroundMesh(index); - else - yymsg(0, "Unknown view %d", index); + int index = (int)(yyvsp[(5) - (7)].d); + if(index >= 0 && index < (int)PView::list.size()) + GModel::current()->getFields()->setBackgroundMesh(index); + else + yymsg(0, "Unknown view %d", index); } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (7)].c)); #endif Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(2) - (7)].c)); Free((yyvsp[(3) - (7)].c)); ;} @@ -6367,20 +6367,20 @@ yyreduce: #line 2331 "Gmsh.y" { if(!strcmp((yyvsp[(1) - (3)].c), "Sleep")){ - SleepInSeconds((yyvsp[(2) - (3)].d)); + SleepInSeconds((yyvsp[(2) - (3)].d)); } else if(!strcmp((yyvsp[(1) - (3)].c), "Remesh")){ - yymsg(0, "Surface remeshing must be reinterfaced"); + yymsg(0, "Surface remeshing must be reinterfaced"); } else if(!strcmp((yyvsp[(1) - (3)].c), "Mesh")){ - int lock = CTX::instance()->lock; - CTX::instance()->lock = 0; - GModel::current()->importGEOInternals(); - GModel::current()->mesh((int)(yyvsp[(2) - (3)].d)); - CTX::instance()->lock = lock; + int lock = CTX::instance()->lock; + CTX::instance()->lock = 0; + GModel::current()->importGEOInternals(); + GModel::current()->mesh((int)(yyvsp[(2) - (3)].d)); + CTX::instance()->lock = lock; } else - yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown command '%s'", (yyvsp[(1) - (3)].c)); Free((yyvsp[(1) - (3)].c)); ;} break; @@ -6390,10 +6390,10 @@ yyreduce: { #if defined(HAVE_POST) try { - PluginManager::instance()->action((yyvsp[(3) - (7)].c), (yyvsp[(6) - (7)].c), 0); + PluginManager::instance()->action((yyvsp[(3) - (7)].c), (yyvsp[(6) - (7)].c), 0); } catch(...) { - yymsg(0, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c)); + yymsg(0, "Unknown action '%s' or plugin '%s'", (yyvsp[(6) - (7)].c), (yyvsp[(3) - (7)].c)); } #endif Free((yyvsp[(3) - (7)].c)); Free((yyvsp[(6) - (7)].c)); @@ -6405,23 +6405,23 @@ yyreduce: { #if defined(HAVE_POST) if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromAllViews")) - PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromVisibleViews")) - PView::combine(false, 0, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 0, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "ElementsByViewName")) - PView::combine(false, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 2, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsFromAllViews")) - PView::combine(true, 1, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 1, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsFromVisibleViews")) - PView::combine(true, 0, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 0, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeStepsByViewName")) - PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "Views")) - PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); + PView::combine(false, 1, CTX::instance()->post.combineRemoveOrig); else if(!strcmp((yyvsp[(2) - (3)].c), "TimeSteps")) - PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); + PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); else - yymsg(0, "Unknown 'Combine' command"); + yymsg(0, "Unknown 'Combine' command"); #endif Free((yyvsp[(2) - (3)].c)); ;} @@ -6487,12 +6487,12 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if((yyvsp[(3) - (6)].d) > (yyvsp[(5) - (6)].d)) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; @@ -6507,12 +6507,12 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if(((yyvsp[(7) - (8)].d) > 0. && (yyvsp[(3) - (8)].d) > (yyvsp[(5) - (8)].d)) || ((yyvsp[(7) - (8)].d) < 0. && (yyvsp[(3) - (8)].d) < (yyvsp[(5) - (8)].d))) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; @@ -6529,12 +6529,12 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if((yyvsp[(5) - (8)].d) > (yyvsp[(7) - (8)].d)) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; @@ -6551,12 +6551,12 @@ yyreduce: fgetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop]); yylinenoImbricatedLoopsTab[ImbricatedLoop] = gmsh_yylineno; if(((yyvsp[(9) - (10)].d) > 0. && (yyvsp[(5) - (10)].d) > (yyvsp[(7) - (10)].d)) || ((yyvsp[(9) - (10)].d) < 0. && (yyvsp[(5) - (10)].d) < (yyvsp[(7) - (10)].d))) - skip_until("For", "EndFor"); + skip_until("For", "EndFor"); else - ImbricatedLoop++; + ImbricatedLoop++; if(ImbricatedLoop > MAX_RECUR_LOOPS - 1){ - yymsg(0, "Reached maximum number of imbricated loops"); - ImbricatedLoop = MAX_RECUR_LOOPS - 1; + yymsg(0, "Reached maximum number of imbricated loops"); + ImbricatedLoop = MAX_RECUR_LOOPS - 1; } ;} break; @@ -6565,11 +6565,11 @@ yyreduce: #line 2496 "Gmsh.y" { if(ImbricatedLoop <= 0){ - yymsg(0, "Invalid For/EndFor loop"); - ImbricatedLoop = 0; + yymsg(0, "Invalid For/EndFor loop"); + ImbricatedLoop = 0; } else{ - double step = LoopControlVariablesTab[ImbricatedLoop - 1][2]; + double step = LoopControlVariablesTab[ImbricatedLoop - 1][2]; const char *name = LoopControlVariablesNameTab[ImbricatedLoop - 1]; if(name){ if(!gmsh_yysymbols.count(name)) @@ -6582,14 +6582,14 @@ yyreduce: else{ LoopControlVariablesTab[ImbricatedLoop - 1][0] += step; } - double x0 = LoopControlVariablesTab[ImbricatedLoop - 1][0]; - double x1 = LoopControlVariablesTab[ImbricatedLoop - 1][1]; + double x0 = LoopControlVariablesTab[ImbricatedLoop - 1][0]; + double x1 = LoopControlVariablesTab[ImbricatedLoop - 1][1]; if((step > 0. && x0 <= x1) || (step < 0. && x0 >= x1)){ - fsetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop - 1]); - gmsh_yylineno = yylinenoImbricatedLoopsTab[ImbricatedLoop - 1]; - } - else - ImbricatedLoop--; + fsetpos(gmsh_yyin, &yyposImbricatedLoopsTab[ImbricatedLoop - 1]); + gmsh_yylineno = yylinenoImbricatedLoopsTab[ImbricatedLoop - 1]; + } + else + ImbricatedLoop--; } ;} break; @@ -6599,7 +6599,7 @@ yyreduce: { if(!FunctionManager::Instance()->createFunction ((yyvsp[(2) - (2)].c), gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Redefinition of function %s", (yyvsp[(2) - (2)].c)); + yymsg(0, "Redefinition of function %s", (yyvsp[(2) - (2)].c)); skip_until(NULL, "Return"); //FIXME: wee leak $2 ;} @@ -6610,7 +6610,7 @@ yyreduce: { if(!FunctionManager::Instance()->leaveFunction (&gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Error while exiting function"); + yymsg(0, "Error while exiting function"); ;} break; @@ -6619,7 +6619,7 @@ yyreduce: { if(!FunctionManager::Instance()->enterFunction ((yyvsp[(2) - (3)].c), &gmsh_yyin, gmsh_yyname, gmsh_yylineno)) - yymsg(0, "Unknown function %s", (yyvsp[(2) - (3)].c)); + yymsg(0, "Unknown function %s", (yyvsp[(2) - (3)].c)); //FIXME: wee leak $2 ;} break; @@ -6642,8 +6642,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (5)].l), - (yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(2) - (5)].v)[0], (yyvsp[(2) - (5)].v)[1], (yyvsp[(2) - (5)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); List_Delete((yyvsp[(4) - (5)].l)); ;} break; @@ -6653,8 +6653,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(ROTATE, (yyvsp[(10) - (11)].l), - 0., 0., 0., (yyvsp[(3) - (11)].v)[0], (yyvsp[(3) - (11)].v)[1], (yyvsp[(3) - (11)].v)[2], (yyvsp[(5) - (11)].v)[0], (yyvsp[(5) - (11)].v)[1], (yyvsp[(5) - (11)].v)[2], (yyvsp[(7) - (11)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(3) - (11)].v)[0], (yyvsp[(3) - (11)].v)[1], (yyvsp[(3) - (11)].v)[2], (yyvsp[(5) - (11)].v)[0], (yyvsp[(5) - (11)].v)[1], (yyvsp[(5) - (11)].v)[2], (yyvsp[(7) - (11)].d), + NULL, (yyval.l)); List_Delete((yyvsp[(10) - (11)].l)); ;} break; @@ -6664,8 +6664,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (13)].l), - (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].v)[0], (yyvsp[(7) - (13)].v)[1], (yyvsp[(7) - (13)].v)[2], (yyvsp[(9) - (13)].d), - NULL, (yyval.l)); + (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].v)[0], (yyvsp[(7) - (13)].v)[1], (yyvsp[(7) - (13)].v)[2], (yyvsp[(9) - (13)].d), + NULL, (yyval.l)); List_Delete((yyvsp[(12) - (13)].l)); ;} break; @@ -6682,8 +6682,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (7)].l), - (yyvsp[(2) - (7)].v)[0], (yyvsp[(2) - (7)].v)[1], (yyvsp[(2) - (7)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(2) - (7)].v)[0], (yyvsp[(2) - (7)].v)[1], (yyvsp[(2) - (7)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); List_Delete((yyvsp[(4) - (7)].l)); ;} break; @@ -6700,8 +6700,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(ROTATE, (yyvsp[(10) - (13)].l), - 0., 0., 0., (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(3) - (13)].v)[0], (yyvsp[(3) - (13)].v)[1], (yyvsp[(3) - (13)].v)[2], (yyvsp[(5) - (13)].v)[0], (yyvsp[(5) - (13)].v)[1], (yyvsp[(5) - (13)].v)[2], (yyvsp[(7) - (13)].d), + &extr, (yyval.l)); List_Delete((yyvsp[(10) - (13)].l)); ;} break; @@ -6718,8 +6718,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (15)].l), - (yyvsp[(3) - (15)].v)[0], (yyvsp[(3) - (15)].v)[1], (yyvsp[(3) - (15)].v)[2], (yyvsp[(5) - (15)].v)[0], (yyvsp[(5) - (15)].v)[1], (yyvsp[(5) - (15)].v)[2], (yyvsp[(7) - (15)].v)[0], (yyvsp[(7) - (15)].v)[1], (yyvsp[(7) - (15)].v)[2], (yyvsp[(9) - (15)].d), - &extr, (yyval.l)); + (yyvsp[(3) - (15)].v)[0], (yyvsp[(3) - (15)].v)[1], (yyvsp[(3) - (15)].v)[2], (yyvsp[(5) - (15)].v)[0], (yyvsp[(5) - (15)].v)[1], (yyvsp[(5) - (15)].v)[2], (yyvsp[(7) - (15)].v)[0], (yyvsp[(7) - (15)].v)[1], (yyvsp[(7) - (15)].v)[2], (yyvsp[(9) - (15)].d), + &extr, (yyval.l)); List_Delete((yyvsp[(12) - (15)].l)); ;} break; @@ -6736,7 +6736,7 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShapes(BOUNDARY_LAYER, (yyvsp[(3) - (6)].l), 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + &extr, (yyval.l)); List_Delete((yyvsp[(3) - (6)].l)); ;} break; @@ -6746,8 +6746,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; @@ -6756,8 +6756,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; @@ -6766,8 +6766,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (8)].d), - (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., - NULL, (yyval.l)); + (yyvsp[(6) - (8)].v)[0], (yyvsp[(6) - (8)].v)[1], (yyvsp[(6) - (8)].v)[2], 0., 0., 0., 0., 0., 0., 0., + NULL, (yyval.l)); ;} break; @@ -6776,8 +6776,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; @@ -6786,8 +6786,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; @@ -6796,8 +6796,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), - 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), - NULL, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], (yyvsp[(8) - (12)].v)[0], (yyvsp[(8) - (12)].v)[1], (yyvsp[(8) - (12)].v)[2], (yyvsp[(10) - (12)].d), + NULL, (yyval.l)); ;} break; @@ -6806,8 +6806,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; @@ -6816,8 +6816,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; @@ -6826,8 +6826,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (14)].d), - (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), - NULL, (yyval.l)); + (yyvsp[(6) - (14)].v)[0], (yyvsp[(6) - (14)].v)[1], (yyvsp[(6) - (14)].v)[2], (yyvsp[(8) - (14)].v)[0], (yyvsp[(8) - (14)].v)[1], (yyvsp[(8) - (14)].v)[2], (yyvsp[(10) - (14)].v)[0], (yyvsp[(10) - (14)].v)[1], (yyvsp[(10) - (14)].v)[2], (yyvsp[(12) - (14)].d), + NULL, (yyval.l)); ;} break; @@ -6843,8 +6843,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; @@ -6860,8 +6860,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; @@ -6877,8 +6877,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), - (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., - &extr, (yyval.l)); + (yyvsp[(6) - (12)].v)[0], (yyvsp[(6) - (12)].v)[1], (yyvsp[(6) - (12)].v)[2], 0., 0., 0., 0., 0., 0., 0., + &extr, (yyval.l)); ;} break; @@ -6894,8 +6894,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; @@ -6911,8 +6911,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; @@ -6928,8 +6928,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (16)].d), - 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), - &extr, (yyval.l)); + 0., 0., 0., (yyvsp[(6) - (16)].v)[0], (yyvsp[(6) - (16)].v)[1], (yyvsp[(6) - (16)].v)[2], (yyvsp[(8) - (16)].v)[0], (yyvsp[(8) - (16)].v)[1], (yyvsp[(8) - (16)].v)[2], (yyvsp[(10) - (16)].d), + &extr, (yyval.l)); ;} break; @@ -6945,8 +6945,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; @@ -6962,8 +6962,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; @@ -6979,8 +6979,8 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(Shape)); ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (18)].d), - (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), - &extr, (yyval.l)); + (yyvsp[(6) - (18)].v)[0], (yyvsp[(6) - (18)].v)[1], (yyvsp[(6) - (18)].v)[2], (yyvsp[(8) - (18)].v)[0], (yyvsp[(8) - (18)].v)[1], (yyvsp[(8) - (18)].v)[2], (yyvsp[(10) - (18)].v)[0], (yyvsp[(10) - (18)].v)[1], (yyvsp[(10) - (18)].v)[2], (yyvsp[(12) - (18)].d), + &extr, (yyval.l)); ;} break; @@ -7014,18 +7014,18 @@ yyreduce: extr.mesh.ExtrudeMesh = true; extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (7)].l)); if(List_Nbr((yyvsp[(3) - (7)].l)) == List_Nbr((yyvsp[(5) - (7)].l))){ - extr.mesh.NbElmLayer.clear(); - extr.mesh.hLayer.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(3) - (7)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (7)].l), i, &d); - extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); - List_Read((yyvsp[(5) - (7)].l), i, &d); - extr.mesh.hLayer.push_back(d); - } + extr.mesh.NbElmLayer.clear(); + extr.mesh.hLayer.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(3) - (7)].l)); i++){ + double d; + List_Read((yyvsp[(3) - (7)].l), i, &d); + extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); + List_Read((yyvsp[(5) - (7)].l), i, &d); + extr.mesh.hLayer.push_back(d); + } } else - yymsg(0, "Wrong layer definition {%d, %d}", List_Nbr((yyvsp[(3) - (7)].l)), List_Nbr((yyvsp[(5) - (7)].l))); + yymsg(0, "Wrong layer definition {%d, %d}", List_Nbr((yyvsp[(3) - (7)].l)), List_Nbr((yyvsp[(5) - (7)].l))); List_Delete((yyvsp[(3) - (7)].l)); List_Delete((yyvsp[(5) - (7)].l)); ;} @@ -7038,19 +7038,19 @@ yyreduce: extr.mesh.ExtrudeMesh = true; extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (9)].l)); if(List_Nbr((yyvsp[(3) - (9)].l)) == List_Nbr((yyvsp[(5) - (9)].l)) && List_Nbr((yyvsp[(3) - (9)].l)) == List_Nbr((yyvsp[(7) - (9)].l))){ - extr.mesh.NbElmLayer.clear(); - extr.mesh.hLayer.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(3) - (9)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (9)].l), i, &d); - extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); - List_Read((yyvsp[(7) - (9)].l), i, &d); - extr.mesh.hLayer.push_back(d); - } + extr.mesh.NbElmLayer.clear(); + extr.mesh.hLayer.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(3) - (9)].l)); i++){ + double d; + List_Read((yyvsp[(3) - (9)].l), i, &d); + extr.mesh.NbElmLayer.push_back((d > 0) ? (int)d : 1); + List_Read((yyvsp[(7) - (9)].l), i, &d); + extr.mesh.hLayer.push_back(d); + } } else - yymsg(0, "Wrong layer definition {%d, %d, %d}", List_Nbr((yyvsp[(3) - (9)].l)), - List_Nbr((yyvsp[(5) - (9)].l)), List_Nbr((yyvsp[(7) - (9)].l))); + yymsg(0, "Wrong layer definition {%d, %d, %d}", List_Nbr((yyvsp[(3) - (9)].l)), + List_Nbr((yyvsp[(5) - (9)].l)), List_Nbr((yyvsp[(7) - (9)].l))); List_Delete((yyvsp[(3) - (9)].l)); List_Delete((yyvsp[(5) - (9)].l)); List_Delete((yyvsp[(7) - (9)].l)); @@ -7069,18 +7069,18 @@ yyreduce: { int num = (int)(yyvsp[(3) - (9)].d); if(FindSurface(num)){ - yymsg(0, "Surface %d already exists", num); + yymsg(0, "Surface %d already exists", num); } else{ - Surface *s = Create_Surface(num, MSH_SURF_DISCRETE); - Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); - extr.mesh.Holes[num].first = (yyvsp[(8) - (9)].d); - extr.mesh.Holes[num].second.clear(); - for(int i = 0; i < List_Nbr((yyvsp[(6) - (9)].l)); i++){ - double d; - List_Read((yyvsp[(6) - (9)].l), i, &d); - extr.mesh.Holes[num].second.push_back((int)d); - } + Surface *s = Create_Surface(num, MSH_SURF_DISCRETE); + Tree_Add(GModel::current()->getGEOInternals()->Surfaces, &s); + extr.mesh.Holes[num].first = (yyvsp[(8) - (9)].d); + extr.mesh.Holes[num].second.clear(); + for(int i = 0; i < List_Nbr((yyvsp[(6) - (9)].l)); i++){ + double d; + List_Read((yyvsp[(6) - (9)].l), i, &d); + extr.mesh.Holes[num].second.push_back((int)d); + } } List_Delete((yyvsp[(6) - (9)].l)); ;} @@ -7393,7 +7393,7 @@ yyreduce: #line 3159 "Gmsh.y" { if(!(yyvsp[(3) - (5)].l)){ - List_T *tmp = Tree2List(GModel::current()->getGEOInternals()->Surfaces); + List_T *tmp = Tree2List(GModel::current()->getGEOInternals()->Surfaces); if(List_Nbr(tmp)){ for(int i = 0; i < List_Nbr(tmp); i++){ Surface *s; @@ -7439,19 +7439,19 @@ yyreduce: #line 3202 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (6)].l), i, &d); - int j = (int)d; - Surface *s = FindSurface(j); - if(s){ + double d; + List_Read((yyvsp[(3) - (6)].l), i, &d); + int j = (int)d; + Surface *s = FindSurface(j); + if(s){ s->TransfiniteSmoothing = (int)(yyvsp[(5) - (6)].d); } else{ - GFace *gf = GModel::current()->getFaceByTag(j); - if(gf) + GFace *gf = GModel::current()->getFaceByTag(j); + if(gf) gf->meshAttributes.transfiniteSmoothing = (int)(yyvsp[(5) - (6)].d); else - yymsg(1, "Unknown surface %d", (int)(yyvsp[(5) - (6)].d)); + yymsg(1, "Unknown surface %d", (int)(yyvsp[(5) - (6)].d)); } } List_Delete((yyvsp[(3) - (6)].l)); @@ -7463,7 +7463,7 @@ yyreduce: { Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d)); if(s){ - setSurfaceEmbeddedPoints(s, (yyvsp[(3) - (10)].l)); + setSurfaceEmbeddedPoints(s, (yyvsp[(3) - (10)].l)); } else{ GFace *gf = GModel::current()->getFaceByTag((int)(yyvsp[(8) - (10)].d)); @@ -7489,7 +7489,7 @@ yyreduce: { Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d)); if(s){ - setSurfaceEmbeddedCurves(s, (yyvsp[(3) - (10)].l)); + setSurfaceEmbeddedCurves(s, (yyvsp[(3) - (10)].l)); } else{ GFace *gf = GModel::current()->getFaceByTag((int)(yyvsp[(8) - (10)].d)); @@ -7739,9 +7739,9 @@ yyreduce: #line 3463 "Gmsh.y" { if(!(yyvsp[(3) - (3)].d)) - yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d)); + yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d)); else - (yyval.d) = (yyvsp[(1) - (3)].d) / (yyvsp[(3) - (3)].d); + (yyval.d) = (yyvsp[(1) - (3)].d) / (yyvsp[(3) - (3)].d); ;} break; @@ -8049,11 +8049,11 @@ yyreduce: #line 3542 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (1)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c)); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (1)].c)][0]; + (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (1)].c)][0]; Free((yyvsp[(1) - (1)].c)); ;} break; @@ -8064,11 +8064,11 @@ yyreduce: char tmpstring[1024]; sprintf(tmpstring, "%s_%d", (yyvsp[(1) - (5)].c), (int)(yyvsp[(4) - (5)].d)) ; if(!gmsh_yysymbols.count(tmpstring)){ - yymsg(0, "Unknown variable '%s'", tmpstring); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", tmpstring); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[tmpstring][0]; + (yyval.d) = gmsh_yysymbols[tmpstring][0]; Free((yyvsp[(1) - (5)].c)); ;} break; @@ -8078,15 +8078,15 @@ yyreduce: { int index = (int)(yyvsp[(3) - (4)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (4)].c)); + (yyval.d) = 0.; } else if((int)gmsh_yysymbols[(yyvsp[(1) - (4)].c)].size() < index + 1){ - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (4)].c), index); - (yyval.d) = 0.; + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (4)].c), index); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (4)].c)][index]; + (yyval.d) = gmsh_yysymbols[(yyvsp[(1) - (4)].c)][index]; Free((yyvsp[(1) - (4)].c)); ;} break; @@ -8095,11 +8095,11 @@ yyreduce: #line 3582 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(2) - (4)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c)); + (yyval.d) = 0.; } else - (yyval.d) = gmsh_yysymbols[(yyvsp[(2) - (4)].c)].size(); + (yyval.d) = gmsh_yysymbols[(yyvsp[(2) - (4)].c)].size(); Free((yyvsp[(2) - (4)].c)); ;} break; @@ -8108,11 +8108,11 @@ yyreduce: #line 3592 "Gmsh.y" { if(!gmsh_yysymbols.count((yyvsp[(1) - (2)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c)); + (yyval.d) = 0.; } else - (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (2)].c)][0] += (yyvsp[(2) - (2)].i)); + (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (2)].c)][0] += (yyvsp[(2) - (2)].i)); Free((yyvsp[(1) - (2)].c)); ;} break; @@ -8122,15 +8122,15 @@ yyreduce: { int index = (int)(yyvsp[(3) - (5)].d); if(!gmsh_yysymbols.count((yyvsp[(1) - (5)].c))){ - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (5)].c)); - (yyval.d) = 0.; + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (5)].c)); + (yyval.d) = 0.; } else if((int)gmsh_yysymbols[(yyvsp[(1) - (5)].c)].size() < index + 1){ - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (5)].c), index); - (yyval.d) = 0.; + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (5)].c), index); + (yyval.d) = 0.; } else - (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (5)].c)][index] += (yyvsp[(5) - (5)].i)); + (yyval.d) = (gmsh_yysymbols[(yyvsp[(1) - (5)].c)][index] += (yyvsp[(5) - (5)].i)); Free((yyvsp[(1) - (5)].c)); ;} break; @@ -8156,9 +8156,9 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d)){ - d += (yyvsp[(4) - (4)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d); - (yyval.d) = d; + d += (yyvsp[(4) - (4)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d); + (yyval.d) = d; } Free((yyvsp[(1) - (4)].c)); Free((yyvsp[(3) - (4)].c)); ;} @@ -8169,9 +8169,9 @@ yyreduce: { double d = 0.; if(NumberOption(GMSH_GET, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d)){ - d += (yyvsp[(7) - (7)].i); - NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d); - (yyval.d) = d; + d += (yyvsp[(7) - (7)].i); + NumberOption(GMSH_SET|GMSH_GUI, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d); + (yyval.d) = d; } Free((yyvsp[(1) - (7)].c)); Free((yyvsp[(6) - (7)].c)); ;} @@ -8298,8 +8298,8 @@ yyreduce: { (yyval.l) = (yyvsp[(3) - (4)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) = - (*pd); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) = - (*pd); } ;} break; @@ -8309,8 +8309,8 @@ yyreduce: { (yyval.l) = (yyvsp[(4) - (5)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) *= (yyvsp[(1) - (5)].d); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) *= (yyvsp[(1) - (5)].d); } ;} break; @@ -8339,8 +8339,8 @@ yyreduce: { (yyval.l) = (yyvsp[(2) - (2)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) = - (*pd); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) = - (*pd); } ;} break; @@ -8350,8 +8350,8 @@ yyreduce: { (yyval.l) = (yyvsp[(3) - (3)].l); for(int i = 0; i < List_Nbr((yyval.l)); i++){ - double *pd = (double*)List_Pointer((yyval.l), i); - (*pd) *= (yyvsp[(1) - (3)].d); + double *pd = (double*)List_Pointer((yyval.l), i); + (*pd) *= (yyvsp[(1) - (3)].d); } ;} break; @@ -8362,7 +8362,7 @@ yyreduce: (yyval.l) = List_Create(2, 1, sizeof(double)); for(double d = (yyvsp[(1) - (3)].d); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d <= (yyvsp[(3) - (3)].d)) : (d >= (yyvsp[(3) - (3)].d)); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d += 1.) : (d -= 1.)) - List_Add((yyval.l), &d); + List_Add((yyval.l), &d); ;} break; @@ -8372,11 +8372,11 @@ yyreduce: (yyval.l) = List_Create(2, 1, sizeof(double)); if(!(yyvsp[(5) - (5)].d) || ((yyvsp[(1) - (5)].d) < (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) < 0) || ((yyvsp[(1) - (5)].d) > (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) > 0)){ yymsg(0, "Wrong increment in '%g:%g:%g'", (yyvsp[(1) - (5)].d), (yyvsp[(3) - (5)].d), (yyvsp[(5) - (5)].d)); - List_Add((yyval.l), &((yyvsp[(1) - (5)].d))); + List_Add((yyval.l), &((yyvsp[(1) - (5)].d))); } else - for(double d = (yyvsp[(1) - (5)].d); ((yyvsp[(5) - (5)].d) > 0) ? (d <= (yyvsp[(3) - (5)].d)) : (d >= (yyvsp[(3) - (5)].d)); d += (yyvsp[(5) - (5)].d)) - List_Add((yyval.l), &d); + for(double d = (yyvsp[(1) - (5)].d); ((yyvsp[(5) - (5)].d) > 0) ? (d <= (yyvsp[(3) - (5)].d)) : (d >= (yyvsp[(3) - (5)].d)); d += (yyvsp[(5) - (5)].d)) + List_Add((yyval.l), &d); ;} break; @@ -8389,16 +8389,16 @@ yyreduce: Vertex *v = FindPoint((int)(yyvsp[(3) - (4)].d)); (yyval.l) = List_Create(3, 1, sizeof(double)); if(!v) { - yymsg(0, "Unknown point '%d'", (int)(yyvsp[(3) - (4)].d)); - double d = 0.0; - List_Add((yyval.l), &d); - List_Add((yyval.l), &d); - List_Add((yyval.l), &d); + yymsg(0, "Unknown point '%d'", (int)(yyvsp[(3) - (4)].d)); + double d = 0.0; + List_Add((yyval.l), &d); + List_Add((yyval.l), &d); + List_Add((yyval.l), &d); } else{ - List_Add((yyval.l), &v->Pos.X); - List_Add((yyval.l), &v->Pos.Y); - List_Add((yyval.l), &v->Pos.Z); + List_Add((yyval.l), &v->Pos.X); + List_Add((yyval.l), &v->Pos.Y); + List_Add((yyval.l), &v->Pos.Z); } ;} break; @@ -8408,9 +8408,9 @@ yyreduce: { (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double)); for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){ - Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); - double d = s->Num; - List_Add((yyval.l), &d); + Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); + double d = s->Num; + List_Add((yyval.l), &d); } List_Delete((yyvsp[(1) - (1)].l)); ;} @@ -8421,9 +8421,9 @@ yyreduce: { (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double)); for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){ - Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); - double d = s->Num; - List_Add((yyval.l), &d); + Shape *s = (Shape*) List_Pointer((yyvsp[(1) - (1)].l), i); + double d = s->Num; + List_Add((yyval.l), &d); } List_Delete((yyvsp[(1) - (1)].l)); ;} @@ -8434,10 +8434,10 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(double)); if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (3)].c)); else - for(unsigned int i = 0; i < gmsh_yysymbols[(yyvsp[(1) - (3)].c)].size(); i++) - List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (3)].c)][i]); + for(unsigned int i = 0; i < gmsh_yysymbols[(yyvsp[(1) - (3)].c)].size(); i++) + List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (3)].c)][i]); Free((yyvsp[(1) - (3)].c)); ;} break; @@ -8447,15 +8447,15 @@ yyreduce: { (yyval.l) = List_Create(2, 1, sizeof(double)); if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c))) - yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); + yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (6)].c)); else{ - for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ - int index = (int)(*(double*)List_Pointer_Fast((yyvsp[(4) - (6)].l), i)); - if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) - yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), index); - else - List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index]); - } + for(int i = 0; i < List_Nbr((yyvsp[(4) - (6)].l)); i++){ + int index = (int)(*(double*)List_Pointer_Fast((yyvsp[(4) - (6)].l), i)); + if((int)gmsh_yysymbols[(yyvsp[(1) - (6)].c)].size() < index + 1) + yymsg(0, "Uninitialized variable '%s[%d]'", (yyvsp[(1) - (6)].c), index); + else + List_Add((yyval.l), &gmsh_yysymbols[(yyvsp[(1) - (6)].c)][index]); + } } Free((yyvsp[(1) - (6)].c)); List_Delete((yyvsp[(4) - (6)].l)); @@ -8488,9 +8488,9 @@ yyreduce: #line 3882 "Gmsh.y" { for(int i = 0; i < List_Nbr((yyvsp[(3) - (3)].l)); i++){ - double d; - List_Read((yyvsp[(3) - (3)].l), i, &d); - List_Add((yyval.l), &d); + double d; + List_Read((yyvsp[(3) - (3)].l), i, &d); + List_Add((yyval.l), &d); } List_Delete((yyvsp[(3) - (3)].l)); ;} @@ -8543,10 +8543,10 @@ yyreduce: (yyval.l) = List_Create(256, 10, sizeof(unsigned int)); GmshColorTable *ct = GetColorTable((int)(yyvsp[(3) - (6)].d)); if(!ct) - yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d)); + yymsg(0, "View[%d] does not exist", (int)(yyvsp[(3) - (6)].d)); else{ - for(int i = 0; i < ct->size; i++) - List_Add((yyval.l), &ct->table[i]); + for(int i = 0; i < ct->size; i++) + List_Add((yyval.l), &ct->table[i]); } Free((yyvsp[(1) - (6)].c)); ;} @@ -8578,14 +8578,14 @@ yyreduce: #line 3962 "Gmsh.y" { if(!gmsh_yystringsymbols.count((yyvsp[(1) - (1)].c))){ - yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c)); - (yyval.c) = (yyvsp[(1) - (1)].c); + yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c)); + (yyval.c) = (yyvsp[(1) - (1)].c); } else{ - std::string val = gmsh_yystringsymbols[(yyvsp[(1) - (1)].c)]; - (yyval.c) = (char *)Malloc((val.size() + 1) * sizeof(char)); - strcpy((yyval.c), val.c_str()); - Free((yyvsp[(1) - (1)].c)); + std::string val = gmsh_yystringsymbols[(yyvsp[(1) - (1)].c)]; + (yyval.c) = (char *)Malloc((val.size() + 1) * sizeof(char)); + strcpy((yyval.c), val.c_str()); + Free((yyvsp[(1) - (1)].c)); } ;} break; @@ -8647,11 +8647,11 @@ yyreduce: (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char)); int i; for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){ - if((yyvsp[(3) - (4)].c)[i] == '.'){ - strncpy((yyval.c), (yyvsp[(3) - (4)].c), i); - (yyval.c)[i]='\0'; - break; - } + if((yyvsp[(3) - (4)].c)[i] == '.'){ + strncpy((yyval.c), (yyvsp[(3) - (4)].c), i); + (yyval.c)[i]='\0'; + break; + } } if(i <= 0) strcpy((yyval.c), (yyvsp[(3) - (4)].c)); Free((yyvsp[(3) - (4)].c)); @@ -8664,13 +8664,13 @@ yyreduce: (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char)); int i; for(i = strlen((yyvsp[(3) - (4)].c)) - 1; i >= 0; i--){ - if((yyvsp[(3) - (4)].c)[i] == '/' || (yyvsp[(3) - (4)].c)[i] == '\\') - break; + if((yyvsp[(3) - (4)].c)[i] == '/' || (yyvsp[(3) - (4)].c)[i] == '\\') + break; } if(i <= 0) - strcpy((yyval.c), (yyvsp[(3) - (4)].c)); + strcpy((yyval.c), (yyvsp[(3) - (4)].c)); else - strcpy((yyval.c), &(yyvsp[(3) - (4)].c)[i+1]); + strcpy((yyval.c), &(yyvsp[(3) - (4)].c)[i+1]); Free((yyvsp[(3) - (4)].c)); ;} break; @@ -8688,17 +8688,17 @@ yyreduce: char tmpstring[1024]; int i = PrintListOfDouble((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].l), tmpstring); if(i < 0){ - yymsg(0, "Too few arguments in Sprintf"); - (yyval.c) = (yyvsp[(3) - (6)].c); + yymsg(0, "Too few arguments in Sprintf"); + (yyval.c) = (yyvsp[(3) - (6)].c); } else if(i > 0){ - yymsg(0, "%d extra argument%s in Sprintf", i, (i > 1) ? "s" : ""); - (yyval.c) = (yyvsp[(3) - (6)].c); + yymsg(0, "%d extra argument%s in Sprintf", i, (i > 1) ? "s" : ""); + (yyval.c) = (yyvsp[(3) - (6)].c); } else{ - (yyval.c) = (char*)Malloc((strlen(tmpstring) + 1) * sizeof(char)); - strcpy((yyval.c), tmpstring); - Free((yyvsp[(3) - (6)].c)); + (yyval.c) = (char*)Malloc((strlen(tmpstring) + 1) * sizeof(char)); + strcpy((yyval.c), tmpstring); + Free((yyvsp[(3) - (6)].c)); } List_Delete((yyvsp[(5) - (6)].l)); ;} @@ -8745,35 +8745,35 @@ yyerrlab: yyerror (YY_("syntax error")); #else { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } } #endif } @@ -8783,20 +8783,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } /* Else will try to reuse look-ahead token after shifting the error @@ -8828,29 +8828,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -8896,7 +8896,7 @@ yyexhaustedlab: yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); @@ -8904,7 +8904,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -8939,15 +8939,15 @@ int PrintListOfDouble(char *format, List_T *list, char *buffer) j++; if(j < (int)strlen(format)){ if(format[j] == '%'){ - strcat(buffer, "%"); - j++; + strcat(buffer, "%"); + j++; } while(j < (int)strlen(format) && format[j] != '%') j++; if(k != j){ - strncpy(tmp1, &(format[k]), j-k); - tmp1[j-k] = '\0'; - sprintf(tmp2, tmp1, *(double*)List_Pointer(list, i)); - strcat(buffer, tmp2); + strncpy(tmp1, &(format[k]), j-k); + tmp1[j-k] = '\0'; + sprintf(tmp2, tmp1, *(double*)List_Pointer(list, i)); + strcat(buffer, tmp2); } } else diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index 8fa0837ece853bcdc6867bec559bbf72e072db8a..dfed508f70958d6597e1406f744ff054dc6f32d7 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -111,15 +111,15 @@ typedef unsigned int flex_uint32_t; /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const @@ -189,83 +189,83 @@ extern FILE *gmsh_yyin, *gmsh_yyout; /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up gmsh_yytext. */ \ + do \ + { \ + /* Undo effects of setting up gmsh_yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up gmsh_yytext again */ \ - } \ - while ( 0 ) + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up gmsh_yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via gmsh_yyrestart()), so that the user can continue scanning by - * just pointing gmsh_yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via gmsh_yyrestart()), so that the user can continue scanning by + * just pointing gmsh_yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ @@ -290,13 +290,13 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when gmsh_yytext is formed. */ static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t gmsh_yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* Flag which is used to allow gmsh_yywrap()'s to do buffer switches * instead of setting up a fresh gmsh_yyin. A bit of a hack ... @@ -328,24 +328,24 @@ void gmsh_yyfree (void * ); #define yy_new_buffer gmsh_yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ gmsh_yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ + { \ + if ( ! YY_CURRENT_BUFFER ){\ gmsh_yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) @@ -373,21 +373,21 @@ static void yy_fatal_error (yyconst char msg[] ); * corresponding action - sets up gmsh_yytext. */ #define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - gmsh_yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; \ + gmsh_yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 151 #define YY_END_OF_BUFFER 152 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; static yyconst flex_int16_t yy_accept[648] = { 0, 0, 0, 152, 150, 1, 1, 150, 5, 150, 6, @@ -885,20 +885,20 @@ char *strsave(char *ptr); void skipcomments(void); void skipline(void); -#define YY_INPUT(buf,result,max_size) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ){ \ - buf[n++] = (char) c; \ - gmsh_yylineno++; \ - } \ - if ( c == EOF && ferror( gmsh_yyin ) ) \ - Msg::Fatal("Input in flex scanner failed"); \ - result = n; \ - } \ +#define YY_INPUT(buf,result,max_size) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ){ \ + buf[n++] = (char) c; \ + gmsh_yylineno++; \ + } \ + if ( c == EOF && ferror( gmsh_yyin ) ) \ + Msg::Fatal("Input in flex scanner failed"); \ + result = n; \ + } \ #if defined(WIN32) #define isatty(arg) -1 @@ -1002,33 +1002,33 @@ static int input (void ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - yy_size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( gmsh_yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, gmsh_yyin))==0 && ferror(gmsh_yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(gmsh_yyin); \ - } \ - }\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + yy_size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( gmsh_yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, gmsh_yyin))==0 && ferror(gmsh_yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(gmsh_yyin); \ + } \ + }\ \ #endif @@ -1077,823 +1077,823 @@ extern int gmsh_yylex (void); #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; #line 49 "Gmsh.l" #line 1094 "Gmsh.yy.cpp" - if ( !(yy_init) ) - { - (yy_init) = 1; + if ( !(yy_init) ) + { + (yy_init) = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! gmsh_yyin ) - gmsh_yyin = stdin; + if ( ! gmsh_yyin ) + gmsh_yyin = stdin; - if ( ! gmsh_yyout ) - gmsh_yyout = stdout; + if ( ! gmsh_yyout ) + gmsh_yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - gmsh_yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); - } + if ( ! YY_CURRENT_BUFFER ) { + gmsh_yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); + } - gmsh_yy_load_buffer_state( ); - } + gmsh_yy_load_buffer_state( ); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); - /* Support of gmsh_yytext. */ - *yy_cp = (yy_hold_char); + /* Support of gmsh_yytext. */ + *yy_cp = (yy_hold_char); - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = (yy_start); + yy_current_state = (yy_start); yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 648 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 770 ); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 648 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 770 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; case 1: /* rule 1 can match eol */ YY_RULE_SETUP #line 51 "Gmsh.l" /* none */; - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP #line 52 "Gmsh.l" return tEND; - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP #line 53 "Gmsh.l" skipcomments(); - YY_BREAK + YY_BREAK case 4: YY_RULE_SETUP #line 54 "Gmsh.l" skipline(); - YY_BREAK + YY_BREAK case 5: YY_RULE_SETUP #line 55 "Gmsh.l" { parsestring('\"'); return tBIGSTR; } - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP #line 56 "Gmsh.l" { parsestring('\''); return tBIGSTR; } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP #line 57 "Gmsh.l" { gmsh_yylval.d = NEWREG(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP #line 58 "Gmsh.l" { gmsh_yylval.d = NEWPOINT(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP #line 59 "Gmsh.l" { gmsh_yylval.d = NEWLINE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP #line 60 "Gmsh.l" { gmsh_yylval.d = NEWLINE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP #line 61 "Gmsh.l" { gmsh_yylval.d = NEWLINELOOP(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP #line 62 "Gmsh.l" { gmsh_yylval.d = NEWSURFACE(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP #line 63 "Gmsh.l" { gmsh_yylval.d = NEWSURFACELOOP(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP #line 64 "Gmsh.l" { gmsh_yylval.d = NEWVOLUME(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP #line 65 "Gmsh.l" { gmsh_yylval.d = NEWFIELD(); return tDOUBLE; } - YY_BREAK + YY_BREAK case 16: YY_RULE_SETUP #line 66 "Gmsh.l" return tAFFECT; - YY_BREAK + YY_BREAK case 17: YY_RULE_SETUP #line 67 "Gmsh.l" return tAFFECTPLUS; - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP #line 68 "Gmsh.l" return tAFFECTMINUS; - YY_BREAK + YY_BREAK case 19: YY_RULE_SETUP #line 69 "Gmsh.l" return tAFFECTTIMES; - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP #line 70 "Gmsh.l" return tAFFECTDIVIDE; - YY_BREAK + YY_BREAK case 21: YY_RULE_SETUP #line 71 "Gmsh.l" return tDOTS; - YY_BREAK + YY_BREAK case 22: YY_RULE_SETUP #line 72 "Gmsh.l" return tDOTS; - YY_BREAK + YY_BREAK case 23: YY_RULE_SETUP #line 73 "Gmsh.l" return tOR; - YY_BREAK + YY_BREAK case 24: YY_RULE_SETUP #line 74 "Gmsh.l" return tAND; - YY_BREAK + YY_BREAK case 25: YY_RULE_SETUP #line 75 "Gmsh.l" return tPLUSPLUS; - YY_BREAK + YY_BREAK case 26: YY_RULE_SETUP #line 76 "Gmsh.l" return tMINUSMINUS; - YY_BREAK + YY_BREAK case 27: YY_RULE_SETUP #line 77 "Gmsh.l" return tEQUAL; - YY_BREAK + YY_BREAK case 28: YY_RULE_SETUP #line 78 "Gmsh.l" return tNOTEQUAL; - YY_BREAK + YY_BREAK case 29: YY_RULE_SETUP #line 79 "Gmsh.l" return tLESSOREQUAL; - YY_BREAK + YY_BREAK case 30: YY_RULE_SETUP #line 80 "Gmsh.l" return tGREATEROREQUAL; - YY_BREAK + YY_BREAK case 31: YY_RULE_SETUP #line 82 "Gmsh.l" return tAcos; - YY_BREAK + YY_BREAK case 32: YY_RULE_SETUP #line 83 "Gmsh.l" return tAcos; - YY_BREAK + YY_BREAK case 33: YY_RULE_SETUP #line 84 "Gmsh.l" return tAlias; - YY_BREAK + YY_BREAK case 34: YY_RULE_SETUP #line 85 "Gmsh.l" return tAliasWithOptions; - YY_BREAK + YY_BREAK case 35: YY_RULE_SETUP #line 86 "Gmsh.l" return tAsin; - YY_BREAK + YY_BREAK case 36: YY_RULE_SETUP #line 87 "Gmsh.l" return tAsin; - YY_BREAK + YY_BREAK case 37: YY_RULE_SETUP #line 88 "Gmsh.l" return tAtan; - YY_BREAK + YY_BREAK case 38: YY_RULE_SETUP #line 89 "Gmsh.l" return tAtan; - YY_BREAK + YY_BREAK case 39: YY_RULE_SETUP #line 90 "Gmsh.l" return tAtan2; - YY_BREAK + YY_BREAK case 40: YY_RULE_SETUP #line 91 "Gmsh.l" return tAtan2; - YY_BREAK + YY_BREAK case 41: YY_RULE_SETUP #line 93 "Gmsh.l" return tBezier; - YY_BREAK + YY_BREAK case 42: YY_RULE_SETUP #line 94 "Gmsh.l" return tBSpline; - YY_BREAK + YY_BREAK case 43: YY_RULE_SETUP #line 95 "Gmsh.l" return tBoundingBox; - YY_BREAK + YY_BREAK case 44: YY_RULE_SETUP #line 97 "Gmsh.l" return tCeil; - YY_BREAK + YY_BREAK case 45: YY_RULE_SETUP #line 98 "Gmsh.l" return tCircle; - YY_BREAK + YY_BREAK case 46: YY_RULE_SETUP #line 99 "Gmsh.l" return tCoherence; - YY_BREAK + YY_BREAK case 47: YY_RULE_SETUP #line 100 "Gmsh.l" return tCombine; - YY_BREAK + YY_BREAK case 48: YY_RULE_SETUP #line 101 "Gmsh.l" return tCosh; - YY_BREAK + YY_BREAK case 49: YY_RULE_SETUP #line 102 "Gmsh.l" return tCos; - YY_BREAK + YY_BREAK case 50: YY_RULE_SETUP #line 103 "Gmsh.l" return tCharacteristic; - YY_BREAK + YY_BREAK case 51: YY_RULE_SETUP #line 104 "Gmsh.l" return tComplex; - YY_BREAK + YY_BREAK case 52: YY_RULE_SETUP #line 105 "Gmsh.l" return tColor; - YY_BREAK + YY_BREAK case 53: YY_RULE_SETUP #line 106 "Gmsh.l" return tColorTable; - YY_BREAK + YY_BREAK case 54: YY_RULE_SETUP #line 107 "Gmsh.l" return tCompound; - YY_BREAK + YY_BREAK case 55: YY_RULE_SETUP #line 108 "Gmsh.l" return tCoordinates; - YY_BREAK + YY_BREAK case 56: YY_RULE_SETUP #line 109 "Gmsh.l" return tSpline; - YY_BREAK + YY_BREAK case 57: YY_RULE_SETUP #line 110 "Gmsh.l" return tCall; - YY_BREAK + YY_BREAK case 58: YY_RULE_SETUP #line 111 "Gmsh.l" return tCreateTopology; - YY_BREAK + YY_BREAK case 59: YY_RULE_SETUP #line 113 "Gmsh.l" return tDelete; - YY_BREAK + YY_BREAK case 60: YY_RULE_SETUP #line 114 "Gmsh.l" return tDegenerated; - YY_BREAK + YY_BREAK case 61: YY_RULE_SETUP #line 115 "Gmsh.l" return tDilate; - YY_BREAK + YY_BREAK case 62: YY_RULE_SETUP #line 116 "Gmsh.l" return tDraw; - YY_BREAK + YY_BREAK case 63: YY_RULE_SETUP #line 118 "Gmsh.l" return tExp; - YY_BREAK + YY_BREAK case 64: YY_RULE_SETUP #line 119 "Gmsh.l" return tEllipse; - YY_BREAK + YY_BREAK case 65: YY_RULE_SETUP #line 120 "Gmsh.l" return tEllipse; - YY_BREAK + YY_BREAK case 66: YY_RULE_SETUP #line 121 "Gmsh.l" return tExtrude; - YY_BREAK + YY_BREAK case 67: YY_RULE_SETUP #line 122 "Gmsh.l" return tElliptic; - YY_BREAK + YY_BREAK case 68: YY_RULE_SETUP #line 123 "Gmsh.l" return tEndFor; - YY_BREAK + YY_BREAK case 69: YY_RULE_SETUP #line 124 "Gmsh.l" return tEndIf; - YY_BREAK + YY_BREAK case 70: YY_RULE_SETUP #line 125 "Gmsh.l" return tEuclidian; - YY_BREAK + YY_BREAK case 71: YY_RULE_SETUP #line 126 "Gmsh.l" return tExit; - YY_BREAK + YY_BREAK case 72: YY_RULE_SETUP #line 128 "Gmsh.l" return tFabs; - YY_BREAK + YY_BREAK case 73: YY_RULE_SETUP #line 129 "Gmsh.l" return tField; - YY_BREAK + YY_BREAK case 74: YY_RULE_SETUP #line 130 "Gmsh.l" return tFloor; - YY_BREAK + YY_BREAK case 75: YY_RULE_SETUP #line 131 "Gmsh.l" return tFmod; - YY_BREAK + YY_BREAK case 76: YY_RULE_SETUP #line 132 "Gmsh.l" return tFor; - YY_BREAK + YY_BREAK case 77: YY_RULE_SETUP #line 133 "Gmsh.l" return tFunction; - YY_BREAK + YY_BREAK case 78: YY_RULE_SETUP #line 135 "Gmsh.l" return tGetValue; - YY_BREAK + YY_BREAK case 79: YY_RULE_SETUP #line 136 "Gmsh.l" return tGMSH_MAJOR_VERSION; - YY_BREAK + YY_BREAK case 80: YY_RULE_SETUP #line 137 "Gmsh.l" return tGMSH_MINOR_VERSION; - YY_BREAK + YY_BREAK case 81: YY_RULE_SETUP #line 138 "Gmsh.l" return tGMSH_PATCH_VERSION; - YY_BREAK + YY_BREAK case 82: YY_RULE_SETUP #line 140 "Gmsh.l" return tHide; - YY_BREAK + YY_BREAK case 83: YY_RULE_SETUP #line 141 "Gmsh.l" return tHole; - YY_BREAK + YY_BREAK case 84: YY_RULE_SETUP #line 142 "Gmsh.l" return tHomRank; - YY_BREAK + YY_BREAK case 85: YY_RULE_SETUP #line 143 "Gmsh.l" return tHomGen; - YY_BREAK + YY_BREAK case 86: YY_RULE_SETUP #line 144 "Gmsh.l" return tHomCut; - YY_BREAK + YY_BREAK case 87: YY_RULE_SETUP #line 145 "Gmsh.l" return tHomSeq; - YY_BREAK + YY_BREAK case 88: YY_RULE_SETUP #line 146 "Gmsh.l" return tHypot; - YY_BREAK + YY_BREAK case 89: YY_RULE_SETUP #line 148 "Gmsh.l" return tIn; - YY_BREAK + YY_BREAK case 90: YY_RULE_SETUP #line 149 "Gmsh.l" return tIf; - YY_BREAK + YY_BREAK case 91: YY_RULE_SETUP #line 150 "Gmsh.l" return tIntersect; - YY_BREAK + YY_BREAK case 92: YY_RULE_SETUP #line 151 "Gmsh.l" return tInterpolationScheme; - YY_BREAK + YY_BREAK case 93: YY_RULE_SETUP #line 153 "Gmsh.l" return tNurbsKnots; - YY_BREAK + YY_BREAK case 94: YY_RULE_SETUP #line 155 "Gmsh.l" return tLength; - YY_BREAK + YY_BREAK case 95: YY_RULE_SETUP #line 156 "Gmsh.l" return tLine; - YY_BREAK + YY_BREAK case 96: YY_RULE_SETUP #line 157 "Gmsh.l" return tLoop; - YY_BREAK + YY_BREAK case 97: YY_RULE_SETUP #line 158 "Gmsh.l" return tLog; - YY_BREAK + YY_BREAK case 98: YY_RULE_SETUP #line 159 "Gmsh.l" return tLog10; - YY_BREAK + YY_BREAK case 99: YY_RULE_SETUP #line 160 "Gmsh.l" return tLayers; - YY_BREAK + YY_BREAK case 100: YY_RULE_SETUP #line 161 "Gmsh.l" return tLevelset; - YY_BREAK + YY_BREAK case 101: YY_RULE_SETUP #line 163 "Gmsh.l" return tModulo; - YY_BREAK + YY_BREAK case 102: YY_RULE_SETUP #line 164 "Gmsh.l" return tMPI_Rank; - YY_BREAK + YY_BREAK case 103: YY_RULE_SETUP #line 165 "Gmsh.l" return tMPI_Size; - YY_BREAK + YY_BREAK case 104: YY_RULE_SETUP #line 167 "Gmsh.l" return tNurbs; - YY_BREAK + YY_BREAK case 105: YY_RULE_SETUP #line 169 "Gmsh.l" return tNurbsOrder; - YY_BREAK + YY_BREAK case 106: YY_RULE_SETUP #line 170 "Gmsh.l" return tOCCShape; - YY_BREAK + YY_BREAK case 107: YY_RULE_SETUP #line 172 "Gmsh.l" return tPhysical; - YY_BREAK + YY_BREAK case 108: YY_RULE_SETUP #line 173 "Gmsh.l" return tPi; - YY_BREAK + YY_BREAK case 109: YY_RULE_SETUP #line 174 "Gmsh.l" return tPlane; - YY_BREAK + YY_BREAK case 110: YY_RULE_SETUP #line 175 "Gmsh.l" return tPoint; - YY_BREAK + YY_BREAK case 111: YY_RULE_SETUP #line 176 "Gmsh.l" return tParametric; - YY_BREAK + YY_BREAK case 112: YY_RULE_SETUP #line 177 "Gmsh.l" return tPolarSphere; - YY_BREAK + YY_BREAK case 113: YY_RULE_SETUP #line 178 "Gmsh.l" return tPrintf; - YY_BREAK + YY_BREAK case 114: YY_RULE_SETUP #line 179 "Gmsh.l" return tPlugin; - YY_BREAK + YY_BREAK case 115: YY_RULE_SETUP #line 181 "Gmsh.l" return tRecombine; - YY_BREAK + YY_BREAK case 116: YY_RULE_SETUP #line 182 "Gmsh.l" return tRotate; - YY_BREAK + YY_BREAK case 117: YY_RULE_SETUP #line 183 "Gmsh.l" return tRuled; - YY_BREAK + YY_BREAK case 118: YY_RULE_SETUP #line 184 "Gmsh.l" return tRand; - YY_BREAK + YY_BREAK case 119: YY_RULE_SETUP #line 185 "Gmsh.l" return tReturn; - YY_BREAK + YY_BREAK case 120: YY_RULE_SETUP #line 187 "Gmsh.l" return tSmoother; - YY_BREAK + YY_BREAK case 121: YY_RULE_SETUP #line 188 "Gmsh.l" return tSqrt; - YY_BREAK + YY_BREAK case 122: YY_RULE_SETUP #line 189 "Gmsh.l" return tSin; - YY_BREAK + YY_BREAK case 123: YY_RULE_SETUP #line 190 "Gmsh.l" return tSinh; - YY_BREAK + YY_BREAK case 124: YY_RULE_SETUP #line 191 "Gmsh.l" return tSphere; - YY_BREAK + YY_BREAK case 125: YY_RULE_SETUP #line 192 "Gmsh.l" return tSpline; - YY_BREAK + YY_BREAK case 126: YY_RULE_SETUP #line 193 "Gmsh.l" return tSplit; - YY_BREAK + YY_BREAK case 127: YY_RULE_SETUP #line 194 "Gmsh.l" return tSurface; - YY_BREAK + YY_BREAK case 128: YY_RULE_SETUP #line 195 "Gmsh.l" return tSprintf; - YY_BREAK + YY_BREAK case 129: YY_RULE_SETUP #line 196 "Gmsh.l" return tStrCat; - YY_BREAK + YY_BREAK case 130: YY_RULE_SETUP #line 197 "Gmsh.l" return tStrPrefix; - YY_BREAK + YY_BREAK case 131: YY_RULE_SETUP #line 198 "Gmsh.l" return tStrRelative; - YY_BREAK + YY_BREAK case 132: YY_RULE_SETUP #line 199 "Gmsh.l" return tShow; - YY_BREAK + YY_BREAK case 133: YY_RULE_SETUP #line 200 "Gmsh.l" return tSymmetry; - YY_BREAK + YY_BREAK case 134: YY_RULE_SETUP #line 201 "Gmsh.l" return tSyncModel; - YY_BREAK + YY_BREAK case 135: YY_RULE_SETUP #line 203 "Gmsh.l" return tText2D; - YY_BREAK + YY_BREAK case 136: YY_RULE_SETUP #line 204 "Gmsh.l" return tText3D; - YY_BREAK + YY_BREAK case 137: YY_RULE_SETUP #line 205 "Gmsh.l" return tTime; - YY_BREAK + YY_BREAK case 138: YY_RULE_SETUP #line 206 "Gmsh.l" return tTransfinite; - YY_BREAK + YY_BREAK case 139: YY_RULE_SETUP #line 207 "Gmsh.l" return tTranslate; - YY_BREAK + YY_BREAK case 140: YY_RULE_SETUP #line 208 "Gmsh.l" return tTanh; - YY_BREAK + YY_BREAK case 141: YY_RULE_SETUP #line 209 "Gmsh.l" return tTan; - YY_BREAK + YY_BREAK case 142: YY_RULE_SETUP #line 210 "Gmsh.l" return tToday; - YY_BREAK + YY_BREAK case 143: YY_RULE_SETUP #line 212 "Gmsh.l" return tUsing; - YY_BREAK + YY_BREAK case 144: YY_RULE_SETUP #line 214 "Gmsh.l" return tVolume; - YY_BREAK + YY_BREAK case 145: #line 217 "Gmsh.l" case 146: @@ -1904,386 +1904,386 @@ case 148: YY_RULE_SETUP #line 219 "Gmsh.l" { gmsh_yylval.d = atof((char *)gmsh_yytext); return tDOUBLE; } - YY_BREAK + YY_BREAK case 149: YY_RULE_SETUP #line 221 "Gmsh.l" { gmsh_yylval.c = strsave((char*)gmsh_yytext); return tSTRING; } - YY_BREAK + YY_BREAK case 150: YY_RULE_SETUP #line 223 "Gmsh.l" return gmsh_yytext[0]; - YY_BREAK + YY_BREAK case 151: YY_RULE_SETUP #line 225 "Gmsh.l" ECHO; - YY_BREAK + YY_BREAK #line 1924 "Gmsh.yy.cpp" case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed gmsh_yyin at a new source and called - * gmsh_yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = gmsh_yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( gmsh_yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * gmsh_yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed gmsh_yyin at a new source and called + * gmsh_yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = gmsh_yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( gmsh_yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * gmsh_yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ } /* end of gmsh_yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - gmsh_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - gmsh_yyrestart(gmsh_yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gmsh_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + gmsh_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + gmsh_yyrestart(gmsh_yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gmsh_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - return ret_val; + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 648 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 648 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 648 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 647); - - return yy_is_jam ? 0 : yy_current_state; + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 648 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 647); + + return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { - register char *yy_cp; + register char *yy_cp; yy_cp = (yy_c_buf_p); - /* undo effects of setting up gmsh_yytext */ - *yy_cp = (yy_hold_char); + /* undo effects of setting up gmsh_yytext */ + *yy_cp = (yy_hold_char); - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register yy_size_t number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT @@ -2294,71 +2294,71 @@ static int yy_get_next_buffer (void) #endif { - int c; + int c; - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - gmsh_yyrestart(gmsh_yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( gmsh_yywrap( ) ) - return 0; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + gmsh_yyrestart(gmsh_yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( gmsh_yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve gmsh_yytext */ - (yy_hold_char) = *++(yy_c_buf_p); + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve gmsh_yytext */ + (yy_hold_char) = *++(yy_c_buf_p); - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. @@ -2368,14 +2368,14 @@ static int yy_get_next_buffer (void) void gmsh_yyrestart (FILE * input_file ) { - if ( ! YY_CURRENT_BUFFER ){ + if ( ! YY_CURRENT_BUFFER ){ gmsh_yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = + YY_CURRENT_BUFFER_LVALUE = gmsh_yy_create_buffer(gmsh_yyin,YY_BUF_SIZE ); - } + } - gmsh_yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - gmsh_yy_load_buffer_state( ); + gmsh_yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + gmsh_yy_load_buffer_state( ); } /** Switch to a different input buffer. @@ -2385,40 +2385,40 @@ static int yy_get_next_buffer (void) void gmsh_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - /* TODO. We should be able to replace this entire function body - * with - * gmsh_yypop_buffer_state(); - * gmsh_yypush_buffer_state(new_buffer); + /* TODO. We should be able to replace this entire function body + * with + * gmsh_yypop_buffer_state(); + * gmsh_yypush_buffer_state(new_buffer); */ - gmsh_yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - gmsh_yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (gmsh_yywrap()) processing, but the only time this flag - * is looked at is after gmsh_yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; + gmsh_yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + gmsh_yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (gmsh_yywrap()) processing, but the only time this flag + * is looked at is after gmsh_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; } static void gmsh_yy_load_buffer_state (void) { - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - gmsh_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + gmsh_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. @@ -2429,26 +2429,26 @@ static void gmsh_yy_load_buffer_state (void) */ YY_BUFFER_STATE gmsh_yy_create_buffer (FILE * file, int size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); + b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) gmsh_yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) gmsh_yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - gmsh_yy_init_buffer(b,file ); + gmsh_yy_init_buffer(b,file ); - return b; + return b; } /** Destroy the buffer. @@ -2458,16 +2458,16 @@ static void gmsh_yy_load_buffer_state (void) void gmsh_yy_delete_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) - return; + if ( ! b ) + return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - gmsh_yyfree((void *) b->yy_ch_buf ); + if ( b->yy_is_our_buffer ) + gmsh_yyfree((void *) b->yy_ch_buf ); - gmsh_yyfree((void *) b ); + gmsh_yyfree((void *) b ); } #ifndef __cplusplus @@ -2481,12 +2481,12 @@ extern int isatty (int ); static void gmsh_yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { - int oerrno = errno; + int oerrno = errno; - gmsh_yy_flush_buffer(b ); + gmsh_yy_flush_buffer(b ); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; /* If b is the current buffer, then gmsh_yy_init_buffer was _probably_ * called from gmsh_yyrestart() or through yy_get_next_buffer. @@ -2499,7 +2499,7 @@ extern int isatty (int ); b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - errno = oerrno; + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. @@ -2508,25 +2508,25 @@ extern int isatty (int ); */ void gmsh_yy_flush_buffer (YY_BUFFER_STATE b ) { - if ( ! b ) - return; + if ( ! b ) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - gmsh_yy_load_buffer_state( ); + if ( b == YY_CURRENT_BUFFER ) + gmsh_yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2537,28 +2537,28 @@ extern int isatty (int ); */ void gmsh_yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) - return; - - gmsh_yyensure_buffer_stack(); - - /* This block is copied from gmsh_yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from gmsh_yy_switch_to_buffer. */ - gmsh_yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; + if (new_buffer == NULL) + return; + + gmsh_yyensure_buffer_stack(); + + /* This block is copied from gmsh_yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from gmsh_yy_switch_to_buffer. */ + gmsh_yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. @@ -2567,18 +2567,18 @@ void gmsh_yypush_buffer_state (YY_BUFFER_STATE new_buffer ) */ void gmsh_yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) - return; - - gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - gmsh_yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } + if (!YY_CURRENT_BUFFER) + return; + + gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + gmsh_yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } } /* Allocates the stack if it does not exist. @@ -2586,45 +2586,45 @@ void gmsh_yypop_buffer_state (void) */ static void gmsh_yyensure_buffer_stack (void) { - yy_size_t num_to_alloc; + yy_size_t num_to_alloc; - if (!(yy_buffer_stack)) { + if (!(yy_buffer_stack)) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)gmsh_yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. @@ -2635,31 +2635,31 @@ static void gmsh_yyensure_buffer_stack (void) */ YY_BUFFER_STATE gmsh_yy_scan_buffer (char * base, yy_size_t size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - gmsh_yy_switch_to_buffer(b ); - - return b; + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) gmsh_yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + gmsh_yy_switch_to_buffer(b ); + + return b; } /** Setup the input buffer state to scan a string. The next call to gmsh_yylex() will @@ -2673,7 +2673,7 @@ YY_BUFFER_STATE gmsh_yy_scan_buffer (char * base, yy_size_t size ) YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char * yystr ) { - return gmsh_yy_scan_bytes(yystr,strlen(yystr) ); + return gmsh_yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to gmsh_yylex() will @@ -2685,31 +2685,31 @@ YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char * yystr ) */ YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n, i; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n, i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) gmsh_yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) gmsh_yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in gmsh_yy_scan_bytes()" ); - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = gmsh_yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in gmsh_yy_scan_bytes()" ); + b = gmsh_yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in gmsh_yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; + return b; } #ifndef YY_EXIT_FAILURE @@ -2718,26 +2718,26 @@ YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up gmsh_yytext. */ \ + do \ + { \ + /* Undo effects of setting up gmsh_yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - gmsh_yytext[gmsh_yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = gmsh_yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - gmsh_yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) + gmsh_yytext[gmsh_yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = gmsh_yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + gmsh_yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ @@ -2852,15 +2852,15 @@ int gmsh_yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - gmsh_yypop_buffer_state(); - } + while(YY_CURRENT_BUFFER){ + gmsh_yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + gmsh_yypop_buffer_state(); + } - /* Destroy the stack itself. */ - gmsh_yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; + /* Destroy the stack itself. */ + gmsh_yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * gmsh_yylex() is called, initialization will occur. */ @@ -2876,43 +2876,43 @@ int gmsh_yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; - for ( n = 0; s[n]; ++n ) - ; + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; + return n; } #endif void *gmsh_yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return (void *) malloc( size ); } void *gmsh_yyrealloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); } void gmsh_yyfree (void * ptr ) { - free( (char *) ptr ); /* see gmsh_yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see gmsh_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" @@ -2932,7 +2932,7 @@ void skipcomments(void) while (1) { while ((c = yyinput()) != '*'){ if(feof(gmsh_yyin)){ - Msg::Error("End of file in commented region"); + Msg::Error("End of file in commented region"); return; } } @@ -2999,8 +2999,8 @@ void skip_until(const char *skip, const char *until) while (1){ chars[0] = yyinput(); if(feof(gmsh_yyin)){ - Msg::Error("Unexpected end of file"); - return; + Msg::Error("Unexpected end of file"); + return; } if(chars[0] == until[0]) break; if(skip && chars[0] == skip[0]) break; @@ -3014,17 +3014,17 @@ void skip_until(const char *skip, const char *until) for(i=1; i<l; i++){ chars[i] = yyinput(); if(feof(gmsh_yyin)){ - l = i; - break; + l = i; + break; } } if(!strncmp(chars,until,l_until)){ if(!nb_skip){ - return; + return; } else{ - nb_skip--; + nb_skip--; } } else if(skip && !strncmp(chars,skip,l_skip)){ @@ -3032,7 +3032,7 @@ void skip_until(const char *skip, const char *until) } else{ for(i=1;i<l-1;i++){ - unput(chars[l-i]); + unput(chars[l-i]); } } diff --git a/Plugin/Distance.cpp b/Plugin/Distance.cpp index d4121bb6d6d6a16010a93f35f542be830d606650..bbd92cd634ed45be15a79c3edb6950870038a6ad 100644 --- a/Plugin/Distance.cpp +++ b/Plugin/Distance.cpp @@ -78,25 +78,25 @@ PView *GMSH_DistancePlugin::execute(PView *v) if(entities[i]->dim() == (maxDim - 1)) { GEntity* g2 = entities[i]; for(unsigned int k = 0; k < g2->getNumMeshElements(); k++){ - std::vector<double> iDistances; - std::vector<SPoint3> iClosePts; - MElement *e = g2->getMeshElement(k); - MVertex *v1 = e->getVertex(0); - MVertex *v2 = e->getVertex(1); - SPoint3 p1(v1->x(), v1->y(), v1->z()); - SPoint3 p2(v2->x(), v2->y(), v2->z()); - if(e->getNumVertices() == 2){ - signedDistancesPointsLine(iDistances, iClosePts, pts, p1,p2); - } - else if(e->getNumVertices() == 3){ - MVertex *v3 = e->getVertex(2); - SPoint3 p3 (v3->x(),v3->y(),v3->z()); - signedDistancesPointsTriangle(iDistances, iClosePts, pts, p1, p2, p3); - } - for (unsigned int kk = 0; kk< pts.size(); kk++) { - if (std::abs(iDistances[kk]) < distances[kk]) - distances[kk] = std::abs(iDistances[kk]); - } + std::vector<double> iDistances; + std::vector<SPoint3> iClosePts; + MElement *e = g2->getMeshElement(k); + MVertex *v1 = e->getVertex(0); + MVertex *v2 = e->getVertex(1); + SPoint3 p1(v1->x(), v1->y(), v1->z()); + SPoint3 p2(v2->x(), v2->y(), v2->z()); + if(e->getNumVertices() == 2){ + signedDistancesPointsLine(iDistances, iClosePts, pts, p1,p2); + } + else if(e->getNumVertices() == 3){ + MVertex *v3 = e->getVertex(2); + SPoint3 p3 (v3->x(),v3->y(),v3->z()); + signedDistancesPointsTriangle(iDistances, iClosePts, pts, p1, p2, p3); + } + for (unsigned int kk = 0; kk< pts.size(); kk++) { + if (std::abs(iDistances[kk]) < distances[kk]) + distances[kk] = std::abs(iDistances[kk]); + } } } } @@ -118,8 +118,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) // SPoint3 p2 (v2->x(),v2->y(),v2->z()); // signedDistancesPointsLine(iDistances, iClosePts, pts, p1,p2); // for (int k = 0; k< pts.size(); k++) { -// if (std::abs(iDistances[k]) < distances[k] ) -// distances[k] = std::abs(iDistances[k]); +// if (std::abs(iDistances[k]) < distances[k] ) +// distances[k] = std::abs(iDistances[k]); // } // } // } @@ -143,9 +143,9 @@ PView *GMSH_DistancePlugin::execute(PView *v) if(entities[i]->dim() < maxDim) { GEntity *ge = entities[i]; for(unsigned int j = 0; j < ge->mesh_vertices.size(); j++){ - MVertex *v = ge->mesh_vertices[j]; - myAssembler.fixVertex(v, 0, 1, 0.0); - bbox += SPoint3(v->x(),v->y(),v->z()); + MVertex *v = ge->mesh_vertices[j]; + myAssembler.fixVertex(v, 0, 1, 0.0); + bbox += SPoint3(v->x(),v->y(),v->z()); } } } @@ -154,10 +154,10 @@ PView *GMSH_DistancePlugin::execute(PView *v) if(entities[ii]->dim() == maxDim) { GEntity *ge = entities[ii]; for(unsigned int i = 0; i < ge->getNumMeshElements(); ++i){ - MElement *t = ge->getMeshElement(i); - for(int k = 0; k < t->getNumVertices(); k++){ + MElement *t = ge->getMeshElement(i); + for(int k = 0; k < t->getNumVertices(); k++){ myAssembler.numberVertex(t->getVertex(k), 0, 1); - } + } } } } @@ -173,8 +173,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) if(entities[ii]->dim() == maxDim) { GEntity *ge = entities[ii]; for(unsigned int i = 0; i < ge->getNumMeshElements(); ++i){ - SElement se(ge->getMeshElement(i)); - distance.addToMatrix(myAssembler, &se); + SElement se(ge->getMeshElement(i)); + distance.addToMatrix(myAssembler, &se); } groupOfElements g((GFace*)ge); distance.addToRightHandSide(myAssembler, g); @@ -214,23 +214,23 @@ PView *GMSH_DistancePlugin::execute(PView *v) for(unsigned int ii = 0; ii < entities.size(); ii++){ if(entities[ii]->dim() == maxDim) { for(unsigned int i = 0; i < entities[ii]->getNumMeshElements(); i++){ - MElement *e = entities[ii]->getMeshElement(i); - if (maxDim == 3) fprintf(f3,"SS("); - else if (maxDim == 2) fprintf(f3,"ST("); - std::vector<double> dist; - for(int j = 0; j < e->getNumVertices(); j++) { - MVertex *v = e->getVertex(j); - if(j) fprintf(f3,",%g,%g,%g",v->x(),v->y(), v->z()); - else fprintf(f3,"%g,%g,%g", v->x(),v->y(), v->z()); - std::map<MVertex*, double*>::iterator it = distance_map.find(v); - dist.push_back(*(it->second)); - } - fprintf(f3,"){"); - for (unsigned int i = 0; i < dist.size(); i++){ - if (i) fprintf(f3,",%g", dist[i]); - else fprintf(f3,"%g", dist[i]); - } - fprintf(f3,"};\n"); + MElement *e = entities[ii]->getMeshElement(i); + if (maxDim == 3) fprintf(f3,"SS("); + else if (maxDim == 2) fprintf(f3,"ST("); + std::vector<double> dist; + for(int j = 0; j < e->getNumVertices(); j++) { + MVertex *v = e->getVertex(j); + if(j) fprintf(f3,",%g,%g,%g",v->x(),v->y(), v->z()); + else fprintf(f3,"%g,%g,%g", v->x(),v->y(), v->z()); + std::map<MVertex*, double*>::iterator it = distance_map.find(v); + dist.push_back(*(it->second)); + } + fprintf(f3,"){"); + for (unsigned int i = 0; i < dist.size(); i++){ + if (i) fprintf(f3,",%g", dist[i]); + else fprintf(f3,"%g", dist[i]); + } + fprintf(f3,"};\n"); } } } @@ -243,23 +243,23 @@ PView *GMSH_DistancePlugin::execute(PView *v) for(unsigned int ii = 0; ii < entities.size(); ii++){ if(entities[ii]->dim() == maxDim) { for(unsigned int i = 0; i < entities[ii]->getNumMeshElements(); i++){ - MElement *e = entities[ii]->getMeshElement(i); - if (maxDim == 3) fprintf(f4,"SS("); - else if (maxDim == 2) fprintf(f4,"ST("); - std::vector<double> dist; - for(int j = 0; j < e->getNumVertices(); j++) { - MVertex *v = e->getVertex(j); - if(j) fprintf(f4,",%g,%g,%g",v->x(),v->y(), v->z()); - else fprintf(f4,"%g,%g,%g", v->x(),v->y(), v->z()); - std::map<MVertex*, double>::iterator it = distance_map2.find(v); - dist.push_back(it->second); - } - fprintf(f4,"){"); - for (unsigned int i = 0; i < dist.size(); i++){ - if (i) fprintf(f4,",%g", dist[i]); - else fprintf(f4,"%g", dist[i]); - } - fprintf(f4,"};\n"); + MElement *e = entities[ii]->getMeshElement(i); + if (maxDim == 3) fprintf(f4,"SS("); + else if (maxDim == 2) fprintf(f4,"ST("); + std::vector<double> dist; + for(int j = 0; j < e->getNumVertices(); j++) { + MVertex *v = e->getVertex(j); + if(j) fprintf(f4,",%g,%g,%g",v->x(),v->y(), v->z()); + else fprintf(f4,"%g,%g,%g", v->x(),v->y(), v->z()); + std::map<MVertex*, double>::iterator it = distance_map2.find(v); + dist.push_back(it->second); + } + fprintf(f4,"){"); + for (unsigned int i = 0; i < dist.size(); i++){ + if (i) fprintf(f4,",%g", dist[i]); + else fprintf(f4,"%g", dist[i]); + } + fprintf(f4,"};\n"); } } } @@ -306,8 +306,8 @@ PView *GMSH_DistancePlugin::execute(PView *v) // fprintf(f,"View \"distance ANN\"{\n"); // for(std::map<MVertex*, double>::iterator it = distance.begin(); it != distance.end(); it++) { // fprintf(f,"SP(%g,%g,%g){%g};\n", -// it->first->x(), it->first->y(), it->first->z(), -// it->second); +// it->first->x(), it->first->y(), it->first->z(), +// it->second); // } // fprintf(f,"};\n"); // fclose(f); diff --git a/Plugin/GSHHS.cpp b/Plugin/GSHHS.cpp index 7a3dd44395b2bbfe4b3e8b4c13e8008dd8a27509..ec79ea4cc05acb40782af229be1d9fdb46662aba 100644 --- a/Plugin/GSHHS.cpp +++ b/Plugin/GSHHS.cpp @@ -118,10 +118,10 @@ public: * 4th byte: source = (flag >> 24) & 255: Values: 0 = CIA WDBII, 1 = WVS */ int west, east, south, north; /* min/max extent in micro-degrees */ - int area; /* Area of polygon in 1/10 km^2 */ - int area_full; /* Area of original full-resolution polygon in 1/10 km^2 */ - int container; /* Id of container polygon that encloses this polygon (-1 if none) */ - int ancestor; /* Id of ancestor polygon in the full resolution set that was the source of this polygon (-1 if none) */ + int area; /* Area of polygon in 1/10 km^2 */ + int area_full; /* Area of original full-resolution polygon in 1/10 km^2 */ + int container; /* Id of container polygon that encloses this polygon (-1 if none) */ + int ancestor; /* Id of ancestor polygon in the full resolution set that was the source of this polygon (-1 if none) */ }; GSHHS h; POINT p; diff --git a/Post/PView.h b/Post/PView.h index e0c602ffeaed8cacb1588e3109e9b09e53dbc519..4a29eb033f10bafcbeec933e6fa614ade255b6d9 100644 --- a/Post/PView.h +++ b/Post/PView.h @@ -53,7 +53,7 @@ class PView{ // construct a new model-based view from a bunch of data PView(std::string name, std::string type, GModel *model, std::map<int, std::vector<double> > &data, double time=0., - int numComp = -1); + int numComp = -1); // add a new time step to a given model-based view void addStep(GModel *model, std::map<int, std::vector<double> > &data, double time=0.,int numComp = -1); diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp index 6ba081e0af73646951d78fb37b86abc81afebb82..5315c00013f50e5d5cd375eaa5f203f2bb88cb82 100644 --- a/Post/PViewDataGModelIO.cpp +++ b/Post/PViewDataGModelIO.cpp @@ -19,7 +19,7 @@ bool PViewDataGModel::addData(GModel *model, std::map<int, std::vector<double> > int numComp = 9; if (numC < 0){ for(std::map<int, std::vector<double> >::iterator it = data.begin(); - it != data.end(); it++) + it != data.end(); it++) numComp = std::min(numComp, (int)it->second.size()); } else numComp = numC; diff --git a/Solver/dgAlgorithm.cpp b/Solver/dgAlgorithm.cpp index 1740a28e99f9f75e394cce376db84a70cae7b20a..11c6ef297f065064a817977990779421a90bfa86 100644 --- a/Solver/dgAlgorithm.cpp +++ b/Solver/dgAlgorithm.cpp @@ -73,11 +73,11 @@ void dgAlgorithm::residualForSomeGroups( const dgConservationLaw &claw, */ void dgAlgorithm::computeElementaryTimeSteps ( //dofManager &dof, // the DOF manager (maybe useless here) - const dgConservationLaw &claw, // the conservation law - const dgGroupOfElements & group, - fullMatrix<double> &solution, - std::vector<double> & DT - ) + const dgConservationLaw &claw, // the conservation law + const dgGroupOfElements & group, + fullMatrix<double> &solution, + std::vector<double> & DT + ) { const int nbFields = claw.getNbFields(); dataCacheMap cacheMap; @@ -89,7 +89,7 @@ void dgAlgorithm::computeElementaryTimeSteps ( //dofManager &dof, // the DOF man // provided dataCache dataCacheDouble *maxConvectiveSpeed = claw.newMaxConvectiveSpeed(cacheMap); dataCacheDouble *maximumDiffusivity = claw.newMaximumDiffusivity(cacheMap); - + /* This is an estimate on how lengths changes with p It is merely the smallest distance between gauss points at order p + 1 */ @@ -120,9 +120,9 @@ void dgAlgorithm::computeElementaryTimeSteps ( //dofManager &dof, // the DOF man } void dgAlgorithm::multAddInverseMassMatrix ( /*dofManager &dof,*/ - const dgGroupOfElements & group, - fullMatrix<double> &residu, - fullMatrix<double> &sol) + const dgGroupOfElements & group, + fullMatrix<double> &residu, + fullMatrix<double> &sol) { fullMatrix<double> residuEl; fullMatrix<double> solEl; diff --git a/Solver/dgAlgorithm.h b/Solver/dgAlgorithm.h index ce37b69cd66fb0c8ec896632e66f2d3e924bdfc1..014d0dec03e34ded8553d4aedbbcd8bee0c6b02b 100644 --- a/Solver/dgAlgorithm.h +++ b/Solver/dgAlgorithm.h @@ -17,21 +17,21 @@ class dgSystemOfEquations; class dgAlgorithm { public : static void jacobianVolume ( //dofManager &dof, // the DOF manager (maybe useless here) - const dgConservationLaw &claw, // the conservation law - const dgGroupOfElements & group, - fullMatrix<double> &solution, - fullMatrix<double> &residual); + const dgConservationLaw &claw, // the conservation law + const dgGroupOfElements & group, + fullMatrix<double> &solution, + fullMatrix<double> &residual); static void computeElementaryTimeSteps ( //dofManager &dof, // the DOF manager (maybe useless here) - const dgConservationLaw &claw, // the conservation law - const dgGroupOfElements & group, // the group - fullMatrix<double> &solution, // the solution - std::vector<double> & DT // elementary time steps - ); + const dgConservationLaw &claw, // the conservation law + const dgGroupOfElements & group, // the group + fullMatrix<double> &solution, // the solution + std::vector<double> & DT // elementary time steps + ); static void multAddInverseMassMatrix ( /*dofManager &dof,*/ - const dgGroupOfElements & group, - fullMatrix<double> &residu, - fullMatrix<double> &sol); + const dgGroupOfElements & group, + fullMatrix<double> &residu, + fullMatrix<double> &sol); }; #endif diff --git a/Solver/dgConservationLaw.h b/Solver/dgConservationLaw.h index b1890cd9ba0720ef1b53456c7a46f82734e923f1..09e198fe58080c60e2614b1b89519b171b451a8a 100644 --- a/Solver/dgConservationLaw.h +++ b/Solver/dgConservationLaw.h @@ -4,7 +4,7 @@ /* \partial_t L(u) = \nabla \cdot (\vec{f}(u,forcings)) -> convective flux f + \nabla \cdot (\vec{g}(u,\nabla u,forcings) -> diffusive flux g - + r(u,forcings) -> source term r + + r(u,forcings) -> source term r */ #include "fullMatrix.h" class dataCacheDouble; diff --git a/Solver/dgConservationLawPerfectGas.cpp b/Solver/dgConservationLawPerfectGas.cpp index 834d761c59d0a4a5d5483edc7c3bf615f75a2472..635f86e34121737aee1afa479848d54058cae64f 100644 --- a/Solver/dgConservationLawPerfectGas.cpp +++ b/Solver/dgConservationLawPerfectGas.cpp @@ -52,20 +52,20 @@ const double GAMMA = 1.4; #define max3(a,b,c) ( max2( a , max2(b,c) ) ) bool riemannExact( double rho1, /* inputs */ - double u1, - double v1, - double w1, - double p1, - double rho2, - double u2, - double v2, - double w2, - double p2, - double *rhoav, /* outputs */ - double *uav, - double *utav, - double *uttav, - double *pav ) + double u1, + double v1, + double w1, + double p1, + double rho2, + double u2, + double v2, + double w2, + double p2, + double *rhoav, /* outputs */ + double *uav, + double *utav, + double *uttav, + double *pav ) { /* @@ -243,11 +243,11 @@ bool riemannExact( double rho1, /* inputs */ } static inline void _ROE2D (const double &_GAMMA, - const double &nx, - const double &ny, - const double *solL, - const double *solR, - double *FLUX){ + const double &nx, + const double &ny, + const double *solL, + const double *solR, + double *FLUX){ //sol cons var: rho, rhou, rhov, rhoE //u prim var : rho, u, v, p @@ -262,7 +262,7 @@ static inline void _ROE2D (const double &_GAMMA, uL[2] = solL[2]*overRhoL; uL[3] = GM1*(solL[3] - 0.5* (solL[1]*solL[1]+solL[2]*solL[2])*overRhoL); - const double overRhoR = 1./solR[0]; + const double overRhoR = 1./solR[0]; uR[0] = solR[0]; uR[1] = solR[1]*overRhoR; uR[2] = solR[2]*overRhoR; @@ -287,16 +287,16 @@ static inline void _ROE2D (const double &_GAMMA, FLUX[2] += halfrhoun*uR[2] + .5*uR[3]*ny; FLUX[3] += halfrhoun*HR; - /* --- add rhoe dissipation ---*/ + /* --- add rhoe dissipation ---*/ - double sqr_rhoL = sqrt(uL[0]); - double sqr_rhoR = sqrt(uR[0]); + double sqr_rhoL = sqrt(uL[0]); + double sqr_rhoR = sqrt(uR[0]); double invz1 = 1./ (sqr_rhoL + sqr_rhoR); - //rhoe average state - double u = ( sqr_rhoL* uL[1] + sqr_rhoR * uR[1] ) * invz1; - double v = ( sqr_rhoL* uL[2] + sqr_rhoR * uR[2] ) * invz1; - double H = ( sqr_rhoL* HL + sqr_rhoR * HR ) * invz1; + //rhoe average state + double u = ( sqr_rhoL* uL[1] + sqr_rhoR * uR[1] ) * invz1; + double v = ( sqr_rhoL* uL[2] + sqr_rhoR * uR[2] ) * invz1; + double H = ( sqr_rhoL* HL + sqr_rhoR * HR ) * invz1; double dU[4]; for (int k=0;k<4;k++) dU[k] = solR[k] - solL[k]; @@ -304,7 +304,7 @@ static inline void _ROE2D (const double &_GAMMA, double un = u*nx + v*ny ; double tet = ny*u - nx*v; - double u2 = u*u + v*v; + double u2 = u*u + v*v; double c2 = GM1 * ( H - 0.5 * u2); double c = sqrt(c2); @@ -345,9 +345,9 @@ static inline void _ROE2D (const double &_GAMMA, double eps = 1.e-6; double absUn = (fabs(un) + eps*c)*A; double lA[4] = {absUn, - absUn, - fabs(un + c)*A, - (fabs(un - c)+eps*c)*A}; + absUn, + fabs(un + c)*A, + (fabs(un - c)+eps*c)*A}; // add wave contributions to flux int index = 0; @@ -398,8 +398,8 @@ class dgPerfectGasLaw2d::diffusion : public dataCacheDouble { dataCacheDouble &sol,&grad,&mu,κ public: diffusion(dataCacheMap &cacheMap, - const function * muFunction, - const function * kappaFunction ): + const function * muFunction, + const function * kappaFunction ): dataCacheDouble(cacheMap,1,12), sol(cacheMap.getSolution(this)), grad(cacheMap.getSolutionGradient(this)), @@ -492,15 +492,15 @@ public: _value(k,2) = sol(k,2); _value(k,3) = sol(k,3); if (sol(k,0) < _rhoMin){ - //printf("CL: clip rho min =%g \n", _rhoMin); - _value(k,0) = _rhoMin; + //printf("CL: clip rho min =%g \n", _rhoMin); + _value(k,0) = _rhoMin; } double rhoV2 = sol(k,1)*sol(k,1)+sol(k,2)*sol(k,2); rhoV2 /= sol(k,0); const double p = (GAMMA-1)*(sol(k,3) - 0.5*rhoV2); if (p < _presMin) { - _value(k,3) = _presMin / (GAMMA-1) + 0.5 *rhoV2 ; - //printf("CL: clip pres min =%g \n ", _value(k,3)); + _value(k,3) = _presMin / (GAMMA-1) + 0.5 *rhoV2 ; + //printf("CL: clip pres min =%g \n ", _value(k,3)); } } } @@ -565,20 +565,20 @@ class dgPerfectGasLaw2d::riemannGodunov : public dataCacheDouble { double rhoAv,unAv,utAv,usAv,pAv; riemannExact(solL(i,0), unL,utL,0.0,pL, - solR(i,0), unR,utR,0.0,pR, - &rhoAv,&unAv,&utAv,&usAv,&pAv); + solR(i,0), unR,utR,0.0,pR, + &rhoAv,&unAv,&utAv,&usAv,&pAv); - + const double vxAv = unAv * nx + utAv *ny; const double vyAv = unAv * ny - utAv *nx; // p = rho E (G-1) - 0.5 (G-1) * rho V^2 // rho E = p / (G-1) + 0.5 * rho V^2 const double rhoE = - (1./(GAMMA-1.)) * pAv + 0.5 * rhoAv * (vxAv*vxAv + vyAv*vyAv); + (1./(GAMMA-1.)) * pAv + 0.5 * rhoAv * (vxAv*vxAv + vyAv*vyAv); /* printf("%g %g %g %g, (%g %g) %g %g %g %g\n", - solL(i,0), solL(i,1), solL(i,2), solL(i,3),pL,pAv, - rhoAv, rhoAv*vxAv,rhoAv*vyAv,rhoE); + solL(i,0), solL(i,1), solL(i,2), solL(i,3),pL,pAv, + rhoAv, rhoAv*vxAv,rhoAv*vyAv,rhoE); */ const double F0 = rhoAv * unAv; /* @@ -691,31 +691,31 @@ class dgBoundaryConditionPerfectGasLaw2dWall : public dgBoundaryCondition { void _eval () { int nQP = sol().size1(); for(int i=0; i< nQP; i++) { - const double nx = normals(0,i); - const double ny = normals(1,i); - - const double solLeft [4] = {sol(i,0),sol(i,1),sol(i,2),sol(i,3)}; - const double vn = (solLeft [1] * nx + solLeft [2] * ny); - const double solRight[4] = {sol(i,0), - sol(i,1) - 2 * vn * nx, - sol(i,2) - 2 * vn * ny, - sol(i,3)}; - double FLUX[4] ; - _ROE2D (GAMMA,nx,ny,solLeft,solRight,FLUX); - _value(i,0) = FLUX[0]; - _value(i,1) = FLUX[1]; - _value(i,2) = FLUX[2]; - _value(i,3) = FLUX[3]; - /* - const double q11 = sol(i,1)*sol(i,1)/sol(i,0); - const double q22 = sol(i,2)*sol(i,2)/sol(i,0); - const double p = (GAMMA-1.)*sol(i,3) - 0.5*(GAMMA-1.)*(q11+q22); - _value(i,0) = 0;//FLUX[0]; - _value(i,1) = -p*nx;//FLUX[1]; - _value(i,2) = -p*ny;//FLUX[2]; - _value(i,3) = 0.0;//FLUX[3]; - */ - + const double nx = normals(0,i); + const double ny = normals(1,i); + + const double solLeft [4] = {sol(i,0),sol(i,1),sol(i,2),sol(i,3)}; + const double vn = (solLeft [1] * nx + solLeft [2] * ny); + const double solRight[4] = {sol(i,0), + sol(i,1) - 2 * vn * nx, + sol(i,2) - 2 * vn * ny, + sol(i,3)}; + double FLUX[4] ; + _ROE2D (GAMMA,nx,ny,solLeft,solRight,FLUX); + _value(i,0) = FLUX[0]; + _value(i,1) = FLUX[1]; + _value(i,2) = FLUX[2]; + _value(i,3) = FLUX[3]; + /* + const double q11 = sol(i,1)*sol(i,1)/sol(i,0); + const double q22 = sol(i,2)*sol(i,2)/sol(i,0); + const double p = (GAMMA-1.)*sol(i,3) - 0.5*(GAMMA-1.)*(q11+q22); + _value(i,0) = 0;//FLUX[0]; + _value(i,1) = -p*nx;//FLUX[1]; + _value(i,2) = -p*ny;//FLUX[2]; + _value(i,3) = 0.0;//FLUX[3]; + */ + } } }; @@ -735,10 +735,10 @@ class dgBoundaryConditionPerfectGasLaw2dWall : public dgBoundaryCondition { void _eval () { int nQP = sol().size1(); for(int i=0; i< nQP; i++) { - _value(i,0) = sol(i,0); - _value(i,1) = 0.0; - _value(i,2) = 0.0; - _value(i,3) = sol(i,3) - 0.5 * (sol(i,1) * sol(i,1) + sol(i,2) * sol(i,2))/sol(i,0); + _value(i,0) = sol(i,0); + _value(i,1) = 0.0; + _value(i,2) = 0.0; + _value(i,3) = sol(i,3) - 0.5 * (sol(i,1) * sol(i,1) + sol(i,2) * sol(i,2))/sol(i,0); } } }; @@ -767,13 +767,13 @@ class dgBoundaryConditionPerfectGasLaw2dWall : public dgBoundaryCondition { const fullMatrix<double> &dfl = (*diffusiveFlux)(); for(int i=0; i< nQP; i++) { - for (int k=0;k<3;k++) { + for (int k=0;k<3;k++) { _value(i,k) = - dfl(i,k+4*0) *normals(0,i) + - dfl(i,k+4*1) *normals(1,i) + - dfl(i,k+4*2) *normals(2,i); - } - _value(i,3) = 0.0; + dfl(i,k+4*0) *normals(0,i) + + dfl(i,k+4*1) *normals(1,i) + + dfl(i,k+4*2) *normals(2,i); + } + _value(i,3) = 0.0; } } ~neumannNonSlip (){}; @@ -793,9 +793,9 @@ class dgBoundaryConditionPerfectGasLaw2dWall : public dgBoundaryCondition { void _eval () { int nQP = sol().size1(); for(int i=0; i< nQP; i++) { - for(int k=0; k< sol().size2(); k++) { - _value(i,k) = sol(i,k); - } + for(int k=0; k< sol().size2(); k++) { + _value(i,k) = sol(i,k); + } } } }; diff --git a/Solver/dgConservationLawShallowWater1d.cpp b/Solver/dgConservationLawShallowWater1d.cpp index d0448e0baba256a768c88b95b1a30bb12b8a9836..36edf5595052c1bce4ea5133c5d119d2ec82824f 100644 --- a/Solver/dgConservationLawShallowWater1d.cpp +++ b/Solver/dgConservationLawShallowWater1d.cpp @@ -54,7 +54,7 @@ public: _value(k,1) = sol(k,1); double H = sol(k,0)+h; if (H < _hMin){ - _value(k,0) = _hMin; + _value(k,0) = _hMin; } } } @@ -131,7 +131,7 @@ class dgConservationLawShallowWater1d::riemann:public dataCacheDouble { dataCacheDouble &_pressureL, &_pressureR, &_celerityL, &_celerityR; public: riemann(dataCacheMap &cacheMapLeft, dataCacheMap &cacheMapRight, const function *bathymetry, - const function *pressure, const function *celerity): + const function *pressure, const function *celerity): dataCacheDouble(cacheMapLeft,1,4), normals(cacheMapLeft.getNormals(this)), solL(cacheMapLeft.getSolution(this)), @@ -193,16 +193,16 @@ class dgConservationLawShallowWater1d::riemann:public dataCacheDouble { // double SL = std::min(uL - _celerityL(i,0), ustar - cstar); // double SR = std::min(uR + _celerityR(i,0), ustar + cstar); // if (SL >= 0.){ -// F1 = HL*uL*n0; -// F2 = (.5*uL*uL + pL/RHO )*n0 ; +// F1 = HL*uL*n0; +// F2 = (.5*uL*uL + pL/RHO )*n0 ; // } // else if (SR <=0.){ -// F1 = HR*uR*n0; -// F2 = (.5*uR*uR + pR/RHO )*n0 ; +// F1 = HR*uR*n0; +// F2 = (.5*uR*uR + pR/RHO )*n0 ; // } // else{ -// F1 = (SR*HL*uL*n0-SL*HR*uR*n0 + SL*SR*(HR-HL))/(SR-SL); -// F2 = (SR*(.5*uL*uL + pL/RHO )*n0-SL*(.5*uR*uR + pR/RHO )*n0 + SL*SR*(uR-uL))/(SR-SL); +// F1 = (SR*HL*uL*n0-SL*HR*uR*n0 + SL*SR*(HR-HL))/(SR-SL); +// F2 = (SR*(.5*uL*uL + pL/RHO )*n0-SL*(.5*uR*uR + pR/RHO )*n0 + SL*SR*(uR-uL))/(SR-SL); // } //------------- diff --git a/Solver/dgConservationLawShallowWater2d.cpp b/Solver/dgConservationLawShallowWater2d.cpp index ea1da13f93633f0cb15cbae9ba6ff83bea5964e2..c75650656782b3a036857946321d3b118001280c 100644 --- a/Solver/dgConservationLawShallowWater2d.cpp +++ b/Solver/dgConservationLawShallowWater2d.cpp @@ -57,7 +57,7 @@ public: _value(k,2) = sol(k,2); double H = sol(k,0)+h; if (H < _hMin){ - _value(k,0) = _hMin; + _value(k,0) = _hMin; } } } diff --git a/Solver/dgConservationLawWaveEquation.cpp b/Solver/dgConservationLawWaveEquation.cpp index dc6b7aaacb44621fb3b2580f3c52a85f6a9c7301..dfaf0553d75ba8347f4aad13c1e9125d32faeaa7 100644 --- a/Solver/dgConservationLawWaveEquation.cpp +++ b/Solver/dgConservationLawWaveEquation.cpp @@ -18,7 +18,7 @@ class dgConservationLawWaveEquation::hyperbolicFlux : public dataCacheDouble { int nQP = sol().size1(); _value.scale(0.); for(int i=0; i< nQP; i++) { - const double p = sol(i,0); + const double p = sol(i,0); for (int j=0;j<_DIM;j++){ _value(i,0 +j*_nbf) = c*c*rho*sol(i,j+1); _value(i,j+1+j*_nbf) = p/rho; @@ -56,7 +56,7 @@ class dgConservationLawWaveEquation::riemann : public dataCacheDouble { for(int i=0; i< nQP; i++) { const double n[3] = {normals(0,i),normals(1,i),normals(2,i)}; double unL=0,unR=0; - for (int j=0;j<_DIM;j++){ + for (int j=0;j<_DIM;j++){ unL += n[j]*solL(i,j+1); unR += n[j]*solR(i,j+1); } @@ -73,7 +73,7 @@ class dgConservationLawWaveEquation::riemann : public dataCacheDouble { for (int j=0;j<_DIM;j++) _value(i,j+1) = Fun*n[j]; for (int j=0;j<_nbf;j++) - _value(i,j+_nbf) = -_value(i,j); + _value(i,j+_nbf) = -_value(i,j); } } }; @@ -112,7 +112,7 @@ class dgBoundaryConditionWaveEquationWall : public dgBoundaryCondition { int nQP = sol().size1(); for(int i=0; i< nQP; i++) { const double n[3] = {normals(0,i),normals(1,i),normals(2,i)}; - double p = sol(i,0); + double p = sol(i,0); _value(i,0) = 0; for (int j=0;j<_DIM;j++) _value(i,j+1) = -p/rho*n[j]; diff --git a/Solver/dgGroupOfElements.cpp b/Solver/dgGroupOfElements.cpp index 1d508fd4ac09a1c4a4f4eceab7d3c2f01ebcf7e7..bc91a828ee99c2e16c51a4fd0ffbcb318cc95489 100644 --- a/Solver/dgGroupOfElements.cpp +++ b/Solver/dgGroupOfElements.cpp @@ -56,8 +56,8 @@ static fullMatrix<double> dgGetFaceIntegrationRuleOnElement ( } dgGroupOfElements::dgGroupOfElements(const std::vector<MElement*> &e, - int polyOrder, - int ghostPartition) + int polyOrder, + int ghostPartition) : _elements(e), _fs(*_elements[0]->getFunctionSpace(polyOrder)), _integration(dgGetIntegrationRule (_elements[0], polyOrder)), @@ -125,11 +125,11 @@ dgGroupOfElements::dgGroupOfElements(const std::vector<MElement*> &e, for (int xi=0;xi<nbQP; xi++) { _fs.df((*_integration)(xi,0), - (*_integration)(xi,1), - (*_integration)(xi,2), g); + (*_integration)(xi,1), + (*_integration)(xi,2), g); _fs.f((*_integration)(xi,0), - (*_integration)(xi,1), - (*_integration)(xi,2), f); + (*_integration)(xi,1), + (*_integration)(xi,2), f); const double weight = (*_integration)(xi,3); for (int k=0;k<nbNodes; k++){ (*_redistributionFluxes[0])(k,xi) = g[k][0] * weight; @@ -138,9 +138,9 @@ dgGroupOfElements::dgGroupOfElements(const std::vector<MElement*> &e, (*_redistributionSource)(k,xi) = f[k] * weight; (*_collocation)(xi,k) = f[k]; // for (int l=0;l<_fs.coefficients.size1();l++){ - // (*_redistributionJacobianOfFluxes[0])(l+_fs.coefficients.size1()*k,j) = g[k][0] * f[l] * weight; - // (*_redistributionJacobianOfFluxes[0])(l+_fs.coefficients.size1()*k,j) = g[k][1] * f[l] * weight; - // (*_redistributionJacobianOfFluxes[0])(l+_fs.coefficients.size1()*k,j) = g[k][2] * f[l] * weight; + // (*_redistributionJacobianOfFluxes[0])(l+_fs.coefficients.size1()*k,j) = g[k][0] * f[l] * weight; + // (*_redistributionJacobianOfFluxes[0])(l+_fs.coefficients.size1()*k,j) = g[k][1] * f[l] * weight; + // (*_redistributionJacobianOfFluxes[0])(l+_fs.coefficients.size1()*k,j) = g[k][2] * f[l] * weight; // } } for (int alpha=0; alpha<_dimUVW; alpha++) for (int beta=0; beta<_dimUVW; beta++) { @@ -355,7 +355,7 @@ void dgGroupCollection::buildGroupsOfElements(GModel *model, int dim, int order, } } } - + // do a group of elements for every element type in the mesh int id=_elementGroups.size(); for (std::map<int, std::vector<MElement *> >::iterator it = localElements.begin(); it !=localElements.end() ; ++it){ diff --git a/Solver/dgLimiter.cpp b/Solver/dgLimiter.cpp index dd8286ca407ec2fa3add3b9baeb9a1d96f8b142a..d97e0cc999903e86f496854a18a4d881179e2089 100644 --- a/Solver/dgLimiter.cpp +++ b/Solver/dgLimiter.cpp @@ -9,7 +9,7 @@ int dgSlopeLimiter::apply ( dgDofContainer *solution) dgGroupCollection *groups=solution->getGroups(); solution->scatter(); int nbFields =_claw->getNbFields(); - + // first compute max and min of all fields for all stencils //---------------------------------------------------------- dgDofContainer MIN(groups, nbFields); @@ -18,7 +18,7 @@ int dgSlopeLimiter::apply ( dgDofContainer *solution) MIN.setAll ( 1.e22); MAX.setAll (-1.e22); - int iElementL, iElementR, fSize; + int iElementL, iElementR, fSize; fullMatrix<double> TempL, TempR; for( int iGFace=0; iGFace<groups->getNbFaceGroups(); iGFace++) { dgGroupOfFaces* group = groups->getFaceGroup(iGFace); @@ -42,7 +42,7 @@ int dgSlopeLimiter::apply ( dgDofContainer *solution) iElementR = right.getElementId(iFace); TempL.setAsProxy(solleft, nbFields*iElementL, nbFields ); - TempR.setAsProxy(solright, nbFields*iElementR, nbFields ); + TempR.setAsProxy(solright, nbFields*iElementR, nbFields ); fSize = TempL.size1(); for (int k=0; k< nbFields; ++k){ @@ -74,7 +74,7 @@ int dgSlopeLimiter::apply ( dgDofContainer *solution) fullMatrix<double> &MING = MIN.getGroupProxy(iGroup); fullMatrix<double> Temp; for (int iElement=0 ; iElement<group.getNbElements() ; ++iElement) { - Temp.setAsProxy(sol, nbFields*iElement, nbFields ); + Temp.setAsProxy(sol, nbFields*iElement, nbFields ); for (int k=0; k<nbFields; ++k) { double AVG = 0.; @@ -87,7 +87,7 @@ int dgSlopeLimiter::apply ( dgDofContainer *solution) AVG += Temp(i,k); locMax = std::max (locMax, Temp (i,k)); locMin = std::min (locMin, Temp (i,k)); - } + } AVG /= (double) fSize; //SLOPE LIMITING DG @@ -100,7 +100,7 @@ int dgSlopeLimiter::apply ( dgDofContainer *solution) if (AVG < neighMin) slopeLimiterValue = 0; if (AVG > neighMax) slopeLimiterValue = 0; - // if (slopeLimiterValue != 1.0) printf("LIMTING %g\n",slopeLimiterValue); + // if (slopeLimiterValue != 1.0) printf("LIMTING %g\n",slopeLimiterValue); // slopeLimiterValue = 0.0; for (int i=0; i<fSize; ++i) Temp(i,k) = AVG + Temp(i,k)*slopeLimiterValue; diff --git a/Solver/dgResidual.cpp b/Solver/dgResidual.cpp index bcd51dc7bd2518b2ac3291c3b35d8fb66e81ea1f..0baf556ff3bc6f57765775b86198a51f6fd964cf 100644 --- a/Solver/dgResidual.cpp +++ b/Solver/dgResidual.cpp @@ -268,11 +268,11 @@ dgResidualInterface::dgResidualInterface (const dgConservationLaw &claw): } void dgResidualInterface::compute1Group ( //dofManager &dof, // the DOF manager (maybe useless here) - dgGroupOfFaces &group, - const fullMatrix<double> &solution, // solution !! at faces nodes + dgGroupOfFaces &group, + const fullMatrix<double> &solution, // solution !! at faces nodes const std::vector<const fullMatrix<double>*> solutionOnElements, - fullMatrix<double> &residual // residual !! at faces nodes - ) + fullMatrix<double> &residual // residual !! at faces nodes + ) { // A) global operations before entering the loop over the faces // A1 ) copy locally some references from the group for the sake of lisibility diff --git a/Solver/dgResidual.h b/Solver/dgResidual.h index ebd382cb014cee94f2ea8611d2f5d9591cd89213..e4a13d2ff3ab62356b51fdcca45956d2c0a3c052 100644 --- a/Solver/dgResidual.h +++ b/Solver/dgResidual.h @@ -33,10 +33,10 @@ class dgResidualInterface { public: dgResidualInterface (const dgConservationLaw &claw); void compute1Group ( //dofManager &dof, // the DOF manager (maybe useless here) - dgGroupOfFaces &group, - const fullMatrix<double> &solution, // solution !! at faces nodes + dgGroupOfFaces &group, + const fullMatrix<double> &solution, // solution !! at faces nodes const std::vector<const fullMatrix<double>*> solutionOnElements, - fullMatrix<double> &residual // residual !! at faces nodes + fullMatrix<double> &residual // residual !! at faces nodes ); void computeAndMap1Group (dgGroupOfFaces &faces, dgDofContainer &solution, dgDofContainer &residual); ~dgResidualInterface(); diff --git a/Solver/dgRungeKutta.cpp b/Solver/dgRungeKutta.cpp index 9786dfff955a8552b16b450e92e6fda0241379fd..336744ef18399af60348e99c317ec6d4338ee108 100644 --- a/Solver/dgRungeKutta.cpp +++ b/Solver/dgRungeKutta.cpp @@ -101,9 +101,9 @@ double dgRungeKutta::iterate43SchlegelJCAM2009(const dgConservationLaw *claw, do double dgRungeKutta::diagonalRK (const dgConservationLaw *claw, - double dt, // time-step - dgDofContainer *sol, - int nStages, double *A, double *b) { + double dt, // time-step + dgDofContainer *sol, + int nStages, double *A, double *b) { // U_{n+1}=U_n+h*(SUM_i dt*b_i*K_i) // K_i=M^(-1)R(U_n+dt*A_i*K_{i-1}) fullMatrix<double> residuEl, KEl; @@ -218,7 +218,7 @@ double dgRungeKutta::nonDiagonalRK(const dgConservationLaw *claw, } double dgRungeKutta::computeInvSpectralRadius(const dgConservationLaw *claw, - dgDofContainer *solution){ + dgDofContainer *solution){ double sr = 1.e22; dgGroupCollection *groups=solution->getGroups(); for (int i=0;i<groups->getNbElementGroups();i++){ diff --git a/Solver/dgRungeKuttaMultirate.cpp b/Solver/dgRungeKuttaMultirate.cpp index 5c2392f39688ae3041d258e7723a5f6e4c870eec..b9de7ab7e869c285bac637b5a929e6e3e331cb49 100644 --- a/Solver/dgRungeKuttaMultirate.cpp +++ b/Solver/dgRungeKuttaMultirate.cpp @@ -52,24 +52,24 @@ static double cOuter43[10]={0, 1.0/4.0, 1.0/4.0, 1.0/2.0, 1.0/2.0, 1.0/2.0, 3.0/ // Butcher tables for Multirate RK22 (Constantinescu) static double A22[2][2]={ - {0, 0}, - {1.0, 0} - }; - // Small step RK22 + {0, 0}, + {1.0, 0} + }; + // Small step RK22 static double AInner22[4][4]={ - {0, 0, 0, 0}, - {1.0/2.0, 0, 0, 0}, - {1.0/4.0, 1.0/4.0, 0, 0}, - {1.0/4.0, 1.0/4.0, 1.0/2.0, 0} - }; - - // Big step RK22 + {0, 0, 0, 0}, + {1.0/2.0, 0, 0, 0}, + {1.0/4.0, 1.0/4.0, 0, 0}, + {1.0/4.0, 1.0/4.0, 1.0/2.0, 0} + }; + + // Big step RK22 static double AOuter22[4][4]={ - {0, 0, 0, 0}, - {1.0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 1.0, 0} - }; + {0, 0, 0, 0}, + {1.0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 1.0, 0} + }; static double b22[2]={1.0/2.0, 1.0/2.0}; static double c22[2]={0, 1.0}; static double bInner22[4]={1.0/4.0, 1.0/4.0, 1.0/4.0, 1.0/4.0}; @@ -82,10 +82,10 @@ dgRungeKuttaMultirate::dgRungeKuttaMultirate(dgGroupCollection* gc,dgConservatio _residualVolume=new dgResidualVolume(*_law); _residualInterface=new dgResidualInterface(*_law); _gc=gc; - _init=false; + _init=false; } void dgRungeKuttaMultirate::initialize(int nStages){ - if(_init==false){ + if(_init==false){ _K=new dgDofContainer*[nStages]; for(int i=0;i<nStages;i++){ _K[i]=new dgDofContainer(_gc,_law->getNbFields()); @@ -139,10 +139,10 @@ void dgRungeKuttaMultirate::initialize(int nStages){ v[i]->erase(unique(v[i]->begin(),v[i]->end()),v[i]->end()); } } - _init=true; - } - else - return; + _init=true; + } + else + return; } dgRungeKuttaMultirate::~dgRungeKuttaMultirate(){ @@ -286,9 +286,9 @@ dgRungeKuttaMultirate43::dgRungeKuttaMultirate43(dgGroupCollection *gc,dgConserv double dgRungeKuttaMultirate43::splitForMultirate(int maxLevels, dgDofContainer *solution){ - double dt = _gc->splitGroupsForMultirate(maxLevels, 1, 1, _law, solution); - _gc->buildGroupsOfInterfaces(); - return dt; + double dt = _gc->splitGroupsForMultirate(maxLevels, 1, 1, _law, solution); + _gc->buildGroupsOfInterfaces(); + return dt; } double dgRungeKuttaMultirate43::iterate(double dt, dgDofContainer *solution){ initialize(10); @@ -482,55 +482,55 @@ dgRungeKuttaMultirate22::dgRungeKuttaMultirate22(dgGroupCollection *gc,dgConserv double dgRungeKuttaMultirate22::splitForMultirate(int maxLevels, dgDofContainer *solution){ - double dt = _gc->splitGroupsForMultirate(maxLevels, 1, 2, _law, solution); - _gc->buildGroupsOfInterfaces(); - return dt; + double dt = _gc->splitGroupsForMultirate(maxLevels, 1, 2, _law, solution); + _gc->buildGroupsOfInterfaces(); + return dt; } double dgRungeKuttaMultirate22::iterate(double dt, dgDofContainer *solution){ - initialize(4); - _solution=solution; - _dt=dt; - computeInputForK(0,0,false,-1); - computeInputForK(1,0,false,-1); - - return solution->norm(); + initialize(4); + _solution=solution; + _dt=dt; + computeInputForK(0,0,false,-1); + computeInputForK(1,0,false,-1); + + return solution->norm(); } void dgRungeKuttaMultirate22::computeInputForK(int iK,int exponent,bool isBuffer,int upperLeveliK){ - if(exponent>_maxExponent){ - return; - } + if(exponent>_maxExponent){ + return; + } #ifdef MULTIRATEVERBOSE for(int i=0;i<exponent;i++) printf("\t"); printf("Exponent %d, %s, input K%d\n",exponent,isBuffer?" Buffer":"Not buffer",iK); #endif - double localDt=_dt/pow(2.0,(double)exponent); - // compute K[iK] for this exponent and buffer - - if(!isBuffer){ - std::vector<dgGroupOfElements *> &gV=_bulkGroupsOfElements[exponent].first; - _currentInput->scale(gV,0.0); - _currentInput->axpy(gV,*_solution,1.0); - for(int i=0;i<iK;i++){ - if(A22[iK][i]!=0.0){ - _currentInput->axpy(gV,*_K[i],A22[iK][i]*localDt); - } - } - } - else{ - std::vector<dgGroupOfElements *>&gVi=_innerBufferGroupsOfElements[exponent].first; - std::vector<dgGroupOfElements *>&gVo=_outerBufferGroupsOfElements[exponent].first; - _currentInput->scale(gVi,0.0); - _currentInput->scale(gVo,0.0); - _currentInput->axpy(gVi,*_solution,1.0); - _currentInput->axpy(gVo,*_solution,1.0); - for(int i=0;i<iK;i++){ - if(AInner22[iK][i]!=0.0){ - _currentInput->axpy(gVi,*_K[i],AInner22[iK][i]*localDt*2);} - if(AOuter22[iK][i]!=0.0) - _currentInput->axpy(gVo,*_K[i],AOuter22[iK][i]*localDt*2); - } + double localDt=_dt/pow(2.0,(double)exponent); + // compute K[iK] for this exponent and buffer + + if(!isBuffer){ + std::vector<dgGroupOfElements *> &gV=_bulkGroupsOfElements[exponent].first; + _currentInput->scale(gV,0.0); + _currentInput->axpy(gV,*_solution,1.0); + for(int i=0;i<iK;i++){ + if(A22[iK][i]!=0.0){ + _currentInput->axpy(gV,*_K[i],A22[iK][i]*localDt); + } + } + } + else{ + std::vector<dgGroupOfElements *>&gVi=_innerBufferGroupsOfElements[exponent].first; + std::vector<dgGroupOfElements *>&gVo=_outerBufferGroupsOfElements[exponent].first; + _currentInput->scale(gVi,0.0); + _currentInput->scale(gVo,0.0); + _currentInput->axpy(gVi,*_solution,1.0); + _currentInput->axpy(gVo,*_solution,1.0); + for(int i=0;i<iK;i++){ + if(AInner22[iK][i]!=0.0){ + _currentInput->axpy(gVi,*_K[i],AInner22[iK][i]*localDt*2);} + if(AOuter22[iK][i]!=0.0) + _currentInput->axpy(gVo,*_K[i],AOuter22[iK][i]*localDt*2); + } // We need to update input for the neighboring elements with bigger time step. // if there is no corresponding K to be computed if( (iK>0 && iK<3) ){ @@ -560,43 +560,43 @@ void dgRungeKuttaMultirate22::computeInputForK(int iK,int exponent,bool isBuffer } } } - } - - if(!isBuffer){ - switch(iK){ - case 0: - computeInputForK(0,exponent+1,true,iK); - break; - case 1: - computeInputForK(3,exponent+1,true,iK); - break; - } - } - else{ - computeInputForK(iK%2,exponent,false,iK); - } - - if(exponent==0){ - computeK(iK, exponent, false); - switch(iK){ - case 0: - for(int i=1;i<3;i++){ - computeInputForK(i,exponent+1,true,iK); - } - break; - case 1: - updateSolution(exponent, false); - break; - } - } - - if(isBuffer && exponent>0){ - computeK(iK%2, exponent, false); - computeK(iK, exponent, true); - if(iK%2==1) - updateSolution(exponent, false); - if(iK==3) - updateSolution(exponent, true); + } + + if(!isBuffer){ + switch(iK){ + case 0: + computeInputForK(0,exponent+1,true,iK); + break; + case 1: + computeInputForK(3,exponent+1,true,iK); + break; + } + } + else{ + computeInputForK(iK%2,exponent,false,iK); + } + + if(exponent==0){ + computeK(iK, exponent, false); + switch(iK){ + case 0: + for(int i=1;i<3;i++){ + computeInputForK(i,exponent+1,true,iK); + } + break; + case 1: + updateSolution(exponent, false); + break; + } + } + + if(isBuffer && exponent>0){ + computeK(iK%2, exponent, false); + computeK(iK, exponent, true); + if(iK%2==1) + updateSolution(exponent, false); + if(iK==3) + updateSolution(exponent, true); switch(iK%2){ case 0: for(int i=1;i<3;i++){ @@ -613,147 +613,147 @@ void dgRungeKuttaMultirate22::updateSolution(int exponent,bool isBuffer){ printf("\t"); printf("Updating solution at level %d %s\n",exponent,isBuffer?"Buffer":"Bulk"); #endif - double localDt=_dt/pow(2.0,(double)exponent); - if(isBuffer){ - std::vector<dgGroupOfElements *>&gVi=_innerBufferGroupsOfElements[exponent].first; - std::vector<dgGroupOfElements *>&gVo=_outerBufferGroupsOfElements[exponent].first; - for(int i=0;i<4;i++){ - if(bInner22[i]!=0.0) - _solution->axpy(gVi,*_K[i],bInner22[i]*localDt*2); - if(bOuter22[i]!=0.0) - _solution->axpy(gVo,*_K[i],bOuter22[i]*localDt*2); - } - } - else{ - std::vector<dgGroupOfElements *>&gV=_bulkGroupsOfElements[exponent].first; - for(int i=0;i<2;i++){ - if(b22[i]!=0.0) - _solution->axpy(gV,*_K[i],b22[i]*localDt); - } - } + double localDt=_dt/pow(2.0,(double)exponent); + if(isBuffer){ + std::vector<dgGroupOfElements *>&gVi=_innerBufferGroupsOfElements[exponent].first; + std::vector<dgGroupOfElements *>&gVo=_outerBufferGroupsOfElements[exponent].first; + for(int i=0;i<4;i++){ + if(bInner22[i]!=0.0) + _solution->axpy(gVi,*_K[i],bInner22[i]*localDt*2); + if(bOuter22[i]!=0.0) + _solution->axpy(gVo,*_K[i],bOuter22[i]*localDt*2); + } + } + else{ + std::vector<dgGroupOfElements *>&gV=_bulkGroupsOfElements[exponent].first; + for(int i=0;i<2;i++){ + if(b22[i]!=0.0) + _solution->axpy(gV,*_K[i],b22[i]*localDt); + } + } } void dgRungeKuttaMultirate22::registerBindings(binding *b) { - classBinding *cb = b->addClass<dgRungeKuttaMultirate22>("dgRungeKuttaMultirate22"); - cb->setDescription("Multirate explicit Runge-Kutta with Constantinescu 2 stages 2nd order method"); - methodBinding *cm; - cm = cb->setConstructor<dgRungeKuttaMultirate22,dgGroupCollection *,dgConservationLaw*>(); - cm->setArgNames("groupCollection","law",NULL); - cm->setDescription("A new multirate explicit runge kutta, pass parameters to the iterate function"); - cm = cb->addMethod("splitForMultirate",&dgRungeKuttaMultirate22::splitForMultirate); - cm->setArgNames("maxLevels","solution",NULL); - cm->setDescription("Split Groups for Multirate based on CFL condition, with appropriate buffer sizes, and build the corresponding Groups of Interfaces"); - cm = cb->addMethod("iterate",&dgRungeKuttaMultirate22::iterate); - cm->setArgNames("dt","solution",NULL); - cm->setDescription("update the solution by doing a multirate RK2a (from Constantinescu and Sandu, 'Update on Multirate Timestepping Methods for Hyperbolic Conservation Laws', Computer Sciance Technical Report, 2007) step of base time step dt for the conservation law"); + classBinding *cb = b->addClass<dgRungeKuttaMultirate22>("dgRungeKuttaMultirate22"); + cb->setDescription("Multirate explicit Runge-Kutta with Constantinescu 2 stages 2nd order method"); + methodBinding *cm; + cm = cb->setConstructor<dgRungeKuttaMultirate22,dgGroupCollection *,dgConservationLaw*>(); + cm->setArgNames("groupCollection","law",NULL); + cm->setDescription("A new multirate explicit runge kutta, pass parameters to the iterate function"); + cm = cb->addMethod("splitForMultirate",&dgRungeKuttaMultirate22::splitForMultirate); + cm->setArgNames("maxLevels","solution",NULL); + cm->setDescription("Split Groups for Multirate based on CFL condition, with appropriate buffer sizes, and build the corresponding Groups of Interfaces"); + cm = cb->addMethod("iterate",&dgRungeKuttaMultirate22::iterate); + cm->setArgNames("dt","solution",NULL); + cm->setDescription("update the solution by doing a multirate RK2a (from Constantinescu and Sandu, 'Update on Multirate Timestepping Methods for Hyperbolic Conservation Laws', Computer Sciance Technical Report, 2007) step of base time step dt for the conservation law"); } dgRungeKuttaMultirateConservative::dgRungeKuttaMultirateConservative(dgGroupCollection *gc, dgConservationLaw *law, fullMatrix<double> *A, fullMatrix<double> *b, fullMatrix<double> *c): _A(A), _b(b), _c(c), dgRungeKuttaMultirate(gc, law){ - if(A->size1()!=A->size2() || A->size1()!=b->size2() || A->size1()!=c->size2()) - Msg::Error("The base method's Butcher tables have incompatible sizes"); - //Number of stages of the base method - int bStages = A->size1(); - - //Compute Butcher Table for Outer Buffer - _AOuter=new fullMatrix<double> (2*bStages,2*bStages); - _bOuter=new fullMatrix<double> (1,2*bStages); - _cOuter=new fullMatrix<double> (1,2*bStages); - - //Compute Butcher Table for Inner Buffer - _AInner=new fullMatrix<double> (2*bStages,2*bStages); - _bInner=new fullMatrix<double> (1,2*bStages); - _cInner=new fullMatrix<double> (1,2*bStages); - for(int i=0;i<bStages;i++){ - for(int j=0;j<bStages;j++){ - - (*_AOuter)(i, j)=(*_A)(i, j); - (*_AOuter)(bStages+i,bStages+j)=(*_A)(i, j); - (*_bOuter)(0, i)=0.5*(*_b)(0, i); - (*_bOuter)(0,bStages+i)=0.5*(*_b)(0, i); - (*_cOuter)(0, i)=(*_c)(0, i); - (*_cOuter)(0,bStages+i)=(*_c)(0, i); - - (*_AInner)(i, j)=0.5*(*_A)(i, j); - (*_AInner)(bStages+i,bStages+j)=0.5*(*_A)(i, j); - (*_AInner)(bStages+i,j)=0.5*(*_b)(0, j); - (*_bInner)(0, i)=0.5*(*_b)(0, i); - (*_bInner)(0,bStages+i)=0.5*(*_b)(0, i); - (*_cInner)(0, i)=0.5*(*_c)(0, i); - (*_cInner)(0,bStages+i)=0.5+0.5*(*_c)(0, i); - - } - } + if(A->size1()!=A->size2() || A->size1()!=b->size2() || A->size1()!=c->size2()) + Msg::Error("The base method's Butcher tables have incompatible sizes"); + //Number of stages of the base method + int bStages = A->size1(); + + //Compute Butcher Table for Outer Buffer + _AOuter=new fullMatrix<double> (2*bStages,2*bStages); + _bOuter=new fullMatrix<double> (1,2*bStages); + _cOuter=new fullMatrix<double> (1,2*bStages); + + //Compute Butcher Table for Inner Buffer + _AInner=new fullMatrix<double> (2*bStages,2*bStages); + _bInner=new fullMatrix<double> (1,2*bStages); + _cInner=new fullMatrix<double> (1,2*bStages); + for(int i=0;i<bStages;i++){ + for(int j=0;j<bStages;j++){ + + (*_AOuter)(i, j)=(*_A)(i, j); + (*_AOuter)(bStages+i,bStages+j)=(*_A)(i, j); + (*_bOuter)(0, i)=0.5*(*_b)(0, i); + (*_bOuter)(0,bStages+i)=0.5*(*_b)(0, i); + (*_cOuter)(0, i)=(*_c)(0, i); + (*_cOuter)(0,bStages+i)=(*_c)(0, i); + + (*_AInner)(i, j)=0.5*(*_A)(i, j); + (*_AInner)(bStages+i,bStages+j)=0.5*(*_A)(i, j); + (*_AInner)(bStages+i,j)=0.5*(*_b)(0, j); + (*_bInner)(0, i)=0.5*(*_b)(0, i); + (*_bInner)(0,bStages+i)=0.5*(*_b)(0, i); + (*_cInner)(0, i)=0.5*(*_c)(0, i); + (*_cInner)(0,bStages+i)=0.5+0.5*(*_c)(0, i); + + } + } } void dgRungeKuttaMultirateConservative::printButcher(){ - Msg::Info("------- Printing Inner Butcher Tables --------"); - printf("\n ************************************************** \n"); - _AInner->print("A_inner"); - printf("\n ********************* \n"); - _bInner->print("b_inner"); - printf("\n ********************* \n"); - _cInner->print("c_inner"); - Msg::Info("------- Printing Outer Butcher Tables --------"); - printf("\n ************************************************** \n"); - _AOuter->print("A_outer"); - printf("\n ********************* \n"); - _bOuter->print("b_outer"); - printf("\n ********************* \n"); - _cOuter->print("c_outer"); + Msg::Info("------- Printing Inner Butcher Tables --------"); + printf("\n ************************************************** \n"); + _AInner->print("A_inner"); + printf("\n ********************* \n"); + _bInner->print("b_inner"); + printf("\n ********************* \n"); + _cInner->print("c_inner"); + Msg::Info("------- Printing Outer Butcher Tables --------"); + printf("\n ************************************************** \n"); + _AOuter->print("A_outer"); + printf("\n ********************* \n"); + _bOuter->print("b_outer"); + printf("\n ********************* \n"); + _cOuter->print("c_outer"); } double dgRungeKuttaMultirateConservative::splitForMultirate(int maxLevels, dgDofContainer *solution){ - double dt = _gc->splitGroupsForMultirate(maxLevels, 1, _b->size2(), _law, solution); - _gc->buildGroupsOfInterfaces(); - return dt; + double dt = _gc->splitGroupsForMultirate(maxLevels, 1, _b->size2(), _law, solution); + _gc->buildGroupsOfInterfaces(); + return dt; } double dgRungeKuttaMultirateConservative::iterate(double dt, dgDofContainer *solution){ - initialize(4); - _solution=solution; - _dt=dt; - computeInputForK(0,0,false,-1); - computeInputForK(1,0,false,-1); - - return solution->norm(); + initialize(4); + _solution=solution; + _dt=dt; + computeInputForK(0,0,false,-1); + computeInputForK(1,0,false,-1); + + return solution->norm(); } void dgRungeKuttaMultirateConservative::computeInputForK(int iK,int exponent,bool isBuffer,int upperLeveliK){ - if(exponent>_maxExponent){ - return; - } + if(exponent>_maxExponent){ + return; + } #ifdef MULTIRATEVERBOSE for(int i=0;i<exponent;i++) printf("\t"); printf("Exponent %d, %s, input K%d\n",exponent,isBuffer?" Buffer":"Not buffer",iK); #endif - double localDt=_dt/pow(2.0,(double)exponent); - // compute K[iK] for this exponent and buffer - - if(!isBuffer){ - std::vector<dgGroupOfElements *> &gV=_bulkGroupsOfElements[exponent].first; - _currentInput->scale(gV,0.0); - _currentInput->axpy(gV,*_solution,1.0); - for(int i=0;i<iK;i++){ - if((*_A)(iK, i)!=0.0){ - _currentInput->axpy(gV,*_K[i],(*_A)(iK, i)*localDt); - } - } - } - else{ - std::vector<dgGroupOfElements *>&gVi=_innerBufferGroupsOfElements[exponent].first; - std::vector<dgGroupOfElements *>&gVo=_outerBufferGroupsOfElements[exponent].first; - _currentInput->scale(gVi,0.0); - _currentInput->scale(gVo,0.0); - _currentInput->axpy(gVi,*_solution,1.0); - _currentInput->axpy(gVo,*_solution,1.0); - for(int i=0;i<iK;i++){ - if((*_AInner)(iK, i)!=0.0){ - _currentInput->axpy(gVi,*_K[i],(*_AInner)(iK, i)*localDt*2);} - if((*_AOuter)(iK, i)!=0.0) - _currentInput->axpy(gVo,*_K[i],(*_AOuter)(iK, i)*localDt*2); - } + double localDt=_dt/pow(2.0,(double)exponent); + // compute K[iK] for this exponent and buffer + + if(!isBuffer){ + std::vector<dgGroupOfElements *> &gV=_bulkGroupsOfElements[exponent].first; + _currentInput->scale(gV,0.0); + _currentInput->axpy(gV,*_solution,1.0); + for(int i=0;i<iK;i++){ + if((*_A)(iK, i)!=0.0){ + _currentInput->axpy(gV,*_K[i],(*_A)(iK, i)*localDt); + } + } + } + else{ + std::vector<dgGroupOfElements *>&gVi=_innerBufferGroupsOfElements[exponent].first; + std::vector<dgGroupOfElements *>&gVo=_outerBufferGroupsOfElements[exponent].first; + _currentInput->scale(gVi,0.0); + _currentInput->scale(gVo,0.0); + _currentInput->axpy(gVi,*_solution,1.0); + _currentInput->axpy(gVo,*_solution,1.0); + for(int i=0;i<iK;i++){ + if((*_AInner)(iK, i)!=0.0){ + _currentInput->axpy(gVi,*_K[i],(*_AInner)(iK, i)*localDt*2);} + if((*_AOuter)(iK, i)!=0.0) + _currentInput->axpy(gVo,*_K[i],(*_AOuter)(iK, i)*localDt*2); + } // We need to update input for the neighboring elements with bigger time step. // if there is no corresponding K to be computed if( (iK>0 && iK<3) ){ @@ -783,43 +783,43 @@ void dgRungeKuttaMultirateConservative::computeInputForK(int iK,int exponent,boo } } } - } - - if(!isBuffer){ - switch(iK){ - case 0: - computeInputForK(0,exponent+1,true,iK); - break; - case 1: - computeInputForK(3,exponent+1,true,iK); - break; - } - } - else{ - computeInputForK(iK%2,exponent,false,iK); - } - - if(exponent==0){ - computeK(iK, exponent, false); - switch(iK){ - case 0: - for(int i=1;i<3;i++){ - computeInputForK(i,exponent+1,true,iK); - } - break; - case 1: - updateSolution(exponent, false); - break; - } - } - - if(isBuffer && exponent>0){ - computeK(iK%2, exponent, false); - computeK(iK, exponent, true); - if(iK%2==1) - updateSolution(exponent, false); - if(iK==3) - updateSolution(exponent, true); + } + + if(!isBuffer){ + switch(iK){ + case 0: + computeInputForK(0,exponent+1,true,iK); + break; + case 1: + computeInputForK(3,exponent+1,true,iK); + break; + } + } + else{ + computeInputForK(iK%2,exponent,false,iK); + } + + if(exponent==0){ + computeK(iK, exponent, false); + switch(iK){ + case 0: + for(int i=1;i<3;i++){ + computeInputForK(i,exponent+1,true,iK); + } + break; + case 1: + updateSolution(exponent, false); + break; + } + } + + if(isBuffer && exponent>0){ + computeK(iK%2, exponent, false); + computeK(iK, exponent, true); + if(iK%2==1) + updateSolution(exponent, false); + if(iK==3) + updateSolution(exponent, true); switch(iK%2){ case 0: for(int i=1;i<3;i++){ @@ -836,150 +836,150 @@ void dgRungeKuttaMultirateConservative::updateSolution(int exponent,bool isBuffe printf("\t"); printf("Updating solution at level %d %s\n",exponent,isBuffer?"Buffer":"Bulk"); #endif - double localDt=_dt/pow(2.0,(double)exponent); - if(isBuffer){ - std::vector<dgGroupOfElements *>&gVi=_innerBufferGroupsOfElements[exponent].first; - std::vector<dgGroupOfElements *>&gVo=_outerBufferGroupsOfElements[exponent].first; - for(int i=0;i<4;i++){ - if((*_bInner)(0, i)!=0.0) - _solution->axpy(gVi,*_K[i],(*_bInner)(0, i)*localDt*2); - if((*_bOuter)(0, i)!=0.0) - _solution->axpy(gVo,*_K[i],(*_bOuter)(0, i)*localDt*2); - } - } - else{ - std::vector<dgGroupOfElements *>&gV=_bulkGroupsOfElements[exponent].first; - for(int i=0;i<2;i++){ - if((*_b)(0, i)!=0.0) - _solution->axpy(gV,*_K[i],(*_b)(0, i)*localDt); - } - } + double localDt=_dt/pow(2.0,(double)exponent); + if(isBuffer){ + std::vector<dgGroupOfElements *>&gVi=_innerBufferGroupsOfElements[exponent].first; + std::vector<dgGroupOfElements *>&gVo=_outerBufferGroupsOfElements[exponent].first; + for(int i=0;i<4;i++){ + if((*_bInner)(0, i)!=0.0) + _solution->axpy(gVi,*_K[i],(*_bInner)(0, i)*localDt*2); + if((*_bOuter)(0, i)!=0.0) + _solution->axpy(gVo,*_K[i],(*_bOuter)(0, i)*localDt*2); + } + } + else{ + std::vector<dgGroupOfElements *>&gV=_bulkGroupsOfElements[exponent].first; + for(int i=0;i<2;i++){ + if((*_b)(0, i)!=0.0) + _solution->axpy(gV,*_K[i],(*_b)(0, i)*localDt); + } + } } dgRungeKuttaMultirateConservative* dgRungeKuttaMultirateConservative::new44(dgGroupCollection *gc, dgConservationLaw *law){ - Msg::Error("---- Generic Multirate of Constantinescu doesn't work yet for this standard Butcher tables --------"); - fullMatrix<double> *A=new fullMatrix<double>(4, 4); - fullMatrix<double> *b=new fullMatrix<double>(1, 4); - fullMatrix<double> *c=new fullMatrix<double>(1, 4); + Msg::Error("---- Generic Multirate of Constantinescu doesn't work yet for this standard Butcher tables --------"); + fullMatrix<double> *A=new fullMatrix<double>(4, 4); + fullMatrix<double> *b=new fullMatrix<double>(1, 4); + fullMatrix<double> *c=new fullMatrix<double>(1, 4); double At[4][4]={ - {0, 0, 0, 0}, - {1.0/2.0, 0, 0, 0}, - {0, 1.0/2.0, 0, 0}, - {0, 0, 1, 0} - }; + {0, 0, 0, 0}, + {1.0/2.0, 0, 0, 0}, + {0, 1.0/2.0, 0, 0}, + {0, 0, 1, 0} + }; double bt[4]={1.0/6.0, 1.0/3.0, 1.0/3.0, 1.0/6.0}; - double ct[4]={0, 1.0/2.0, 1.0/2.0, 1}; - - for(int i=0; i<4; i++){ - for (int j=0; j<4; j++){ - (*A)(i, j)=At[i][j]; - } - (*b)(0, i)=bt[i]; - (*c)(0, i)=ct[i]; - } + double ct[4]={0, 1.0/2.0, 1.0/2.0, 1}; + + for(int i=0; i<4; i++){ + for (int j=0; j<4; j++){ + (*A)(i, j)=At[i][j]; + } + (*b)(0, i)=bt[i]; + (*c)(0, i)=ct[i]; + } - return new dgRungeKuttaMultirateConservative(gc, law, A, b, c); + return new dgRungeKuttaMultirateConservative(gc, law, A, b, c); } dgRungeKuttaMultirateConservative* dgRungeKuttaMultirateConservative::new43(dgGroupCollection *gc, dgConservationLaw *law){ - Msg::Error("---- Generic Multirate of Constantinescu doesn't work yet for this standard Butcher tables --------"); - fullMatrix<double> *A=new fullMatrix<double>(4, 4); - fullMatrix<double> *b=new fullMatrix<double>(1, 4); - fullMatrix<double> *c=new fullMatrix<double>(1, 4); + Msg::Error("---- Generic Multirate of Constantinescu doesn't work yet for this standard Butcher tables --------"); + fullMatrix<double> *A=new fullMatrix<double>(4, 4); + fullMatrix<double> *b=new fullMatrix<double>(1, 4); + fullMatrix<double> *c=new fullMatrix<double>(1, 4); double At[4][4]={ - {0, 0, 0, 0}, - {1.0/2.0, 0, 0, 0}, - {-1.0/6.0, 2.0/3.0, 0, 0}, - {1.0/3.0, -1.0/3.0, 1, 0} - }; + {0, 0, 0, 0}, + {1.0/2.0, 0, 0, 0}, + {-1.0/6.0, 2.0/3.0, 0, 0}, + {1.0/3.0, -1.0/3.0, 1, 0} + }; double bt[4]={1.0/6.0, 1.0/3.0, 1.0/3.0, 1.0/6.0}; - double ct[4]={0, 1.0/2.0, 1.0/2.0, 1}; - - for(int i=0; i<4; i++){ - for (int j=0; j<4; j++){ - (*A)(i, j)=At[i][j]; - } - (*b)(0, i)=bt[i]; - (*c)(0, i)=ct[i]; - } + double ct[4]={0, 1.0/2.0, 1.0/2.0, 1}; + + for(int i=0; i<4; i++){ + for (int j=0; j<4; j++){ + (*A)(i, j)=At[i][j]; + } + (*b)(0, i)=bt[i]; + (*c)(0, i)=ct[i]; + } - return new dgRungeKuttaMultirateConservative(gc, law, A, b, c); + return new dgRungeKuttaMultirateConservative(gc, law, A, b, c); } dgRungeKuttaMultirateConservative* dgRungeKuttaMultirateConservative::new2a(dgGroupCollection *gc, dgConservationLaw *law){ - - fullMatrix<double> *A=new fullMatrix<double>(2, 2); - fullMatrix<double> *b=new fullMatrix<double>(1, 2); - fullMatrix<double> *c=new fullMatrix<double>(1, 2); + + fullMatrix<double> *A=new fullMatrix<double>(2, 2); + fullMatrix<double> *b=new fullMatrix<double>(1, 2); + fullMatrix<double> *c=new fullMatrix<double>(1, 2); double At[2][2]={ - {0, 0}, - {1, 0} - }; + {0, 0}, + {1, 0} + }; double bt[2]={0.5, 0.5}; - double ct[2]={0, 1}; - - for(int i=0; i<2; i++){ - for (int j=0; j<2; j++){ - (*A)(i, j)=At[i][j]; - } - (*b)(0, i)=bt[i]; - (*c)(0, i)=ct[i]; - } + double ct[2]={0, 1}; + + for(int i=0; i<2; i++){ + for (int j=0; j<2; j++){ + (*A)(i, j)=At[i][j]; + } + (*b)(0, i)=bt[i]; + (*c)(0, i)=ct[i]; + } - return new dgRungeKuttaMultirateConservative(gc, law, A, b, c); + return new dgRungeKuttaMultirateConservative(gc, law, A, b, c); } dgRungeKuttaMultirateConservative* dgRungeKuttaMultirateConservative::new2b(dgGroupCollection *gc, dgConservationLaw *law){ - - fullMatrix<double> *A=new fullMatrix<double>(2, 2); - fullMatrix<double> *b=new fullMatrix<double>(1, 2); - fullMatrix<double> *c=new fullMatrix<double>(1, 2); + + fullMatrix<double> *A=new fullMatrix<double>(2, 2); + fullMatrix<double> *b=new fullMatrix<double>(1, 2); + fullMatrix<double> *c=new fullMatrix<double>(1, 2); double At[2][2]={ - {0, 0}, - {1.0/2.0, 0} - }; + {0, 0}, + {1.0/2.0, 0} + }; double bt[2]={0, 1}; - double ct[2]={0, 1.0/2.0}; - - for(int i=0; i<2; i++){ - for (int j=0; j<2; j++){ - (*A)(i, j)=At[i][j]; - } - (*b)(0, i)=bt[i]; - (*c)(0, i)=ct[i]; - } + double ct[2]={0, 1.0/2.0}; + + for(int i=0; i<2; i++){ + for (int j=0; j<2; j++){ + (*A)(i, j)=At[i][j]; + } + (*b)(0, i)=bt[i]; + (*c)(0, i)=ct[i]; + } - return new dgRungeKuttaMultirateConservative(gc, law, A, b, c); + return new dgRungeKuttaMultirateConservative(gc, law, A, b, c); } void dgRungeKuttaMultirateConservative::registerBindings(binding *b) { - classBinding *cb = b->addClass<dgRungeKuttaMultirateConservative>("dgRungeKuttaMultirateConservative"); - cb->setDescription("Multirate explicit Runge-Kutta with Constantinescu n (base method) stages 2nd order method"); - methodBinding *cm; - cm = cb->setConstructor<dgRungeKuttaMultirateConservative,dgGroupCollection*,dgConservationLaw* , fullMatrix<double>*, fullMatrix<double>*, fullMatrix<double>* >(); - cm->setArgNames("groupCollection","law","A","b","c",NULL); - cm->setDescription("A new multirate explicit runge kutta, pass parameters to the iterate function"); - cm = cb->addMethod("splitForMultirate",&dgRungeKuttaMultirateConservative::splitForMultirate); - cm->setArgNames("maxLevels","solution",NULL); - cm->setDescription("Split Groups for Multirate based on CFL condition, with appropriate buffer sizes, and build the corresponding Groups of Interfaces"); - cm = cb->addMethod("iterate",&dgRungeKuttaMultirateConservative::iterate); - cm->setArgNames("dt","solution",NULL); - cm->setDescription("update the solution by doing a multirate RK constructed from the given Butcher tables (from Constantinescu and Sandu, 'Update on Multirate Timestepping Methods for Hyperbolic Conservation Laws', Computer Sciance Technical Report, 2007) step of base time step dt for the conservation law"); - cm = cb->addMethod("new44", &dgRungeKuttaMultirateConservative::new43); - cm->setDescription("Creates a new Conservative Runge-Kutta scheme based on the base method RK44"); - cm->setArgNames("groupCollection", "law", NULL); - cm = cb->addMethod("new43", &dgRungeKuttaMultirateConservative::new43); - cm->setDescription("Creates a new Conservative Runge-Kutta scheme based on the base method RK43"); - cm->setArgNames("groupCollection", "law", NULL); - cm = cb->addMethod("new2a", &dgRungeKuttaMultirateConservative::new2a); - cm->setDescription("Creates a new Conservative Runge-Kutta scheme based on the base method RK2a"); - cm->setArgNames("groupCollection", "law", NULL); - cm = cb->addMethod("new2b", &dgRungeKuttaMultirateConservative::new2b); - cm->setDescription("Creates a new Conservative Runge-Kutta scheme based on the base method RK2b"); - cm->setArgNames("groupCollection", "law", NULL); - cm = cb->addMethod("printButcher", &dgRungeKuttaMultirateConservative::printButcher); - cm->setDescription("Print the Butcher Tables for Buffers"); - cm->setArgNames(NULL); + classBinding *cb = b->addClass<dgRungeKuttaMultirateConservative>("dgRungeKuttaMultirateConservative"); + cb->setDescription("Multirate explicit Runge-Kutta with Constantinescu n (base method) stages 2nd order method"); + methodBinding *cm; + cm = cb->setConstructor<dgRungeKuttaMultirateConservative,dgGroupCollection*,dgConservationLaw* , fullMatrix<double>*, fullMatrix<double>*, fullMatrix<double>* >(); + cm->setArgNames("groupCollection","law","A","b","c",NULL); + cm->setDescription("A new multirate explicit runge kutta, pass parameters to the iterate function"); + cm = cb->addMethod("splitForMultirate",&dgRungeKuttaMultirateConservative::splitForMultirate); + cm->setArgNames("maxLevels","solution",NULL); + cm->setDescription("Split Groups for Multirate based on CFL condition, with appropriate buffer sizes, and build the corresponding Groups of Interfaces"); + cm = cb->addMethod("iterate",&dgRungeKuttaMultirateConservative::iterate); + cm->setArgNames("dt","solution",NULL); + cm->setDescription("update the solution by doing a multirate RK constructed from the given Butcher tables (from Constantinescu and Sandu, 'Update on Multirate Timestepping Methods for Hyperbolic Conservation Laws', Computer Sciance Technical Report, 2007) step of base time step dt for the conservation law"); + cm = cb->addMethod("new44", &dgRungeKuttaMultirateConservative::new43); + cm->setDescription("Creates a new Conservative Runge-Kutta scheme based on the base method RK44"); + cm->setArgNames("groupCollection", "law", NULL); + cm = cb->addMethod("new43", &dgRungeKuttaMultirateConservative::new43); + cm->setDescription("Creates a new Conservative Runge-Kutta scheme based on the base method RK43"); + cm->setArgNames("groupCollection", "law", NULL); + cm = cb->addMethod("new2a", &dgRungeKuttaMultirateConservative::new2a); + cm->setDescription("Creates a new Conservative Runge-Kutta scheme based on the base method RK2a"); + cm->setArgNames("groupCollection", "law", NULL); + cm = cb->addMethod("new2b", &dgRungeKuttaMultirateConservative::new2b); + cm->setDescription("Creates a new Conservative Runge-Kutta scheme based on the base method RK2b"); + cm->setArgNames("groupCollection", "law", NULL); + cm = cb->addMethod("printButcher", &dgRungeKuttaMultirateConservative::printButcher); + cm->setDescription("Print the Butcher Tables for Buffers"); + cm->setArgNames(NULL); } diff --git a/Solver/dgRungeKuttaMultirate.h b/Solver/dgRungeKuttaMultirate.h index 9aadec32caada764abbb4cb28f525283d2579111..41947fd6cad22ed31bfedcfa6a4ba0b5c4aebbd4 100644 --- a/Solver/dgRungeKuttaMultirate.h +++ b/Solver/dgRungeKuttaMultirate.h @@ -2,7 +2,7 @@ class dgRungeKuttaMultirate: public dgRungeKutta{ protected: - bool _init; + bool _init; int _maxExponent; int _minExponent; double _dt; diff --git a/Solver/dgSystemOfEquations.cpp b/Solver/dgSystemOfEquations.cpp index 5debcc304d61940db20345a5519a9927d1f70c4e..fb6aba7feed0666a1a1809c291bfe45f5c4a4fe0 100644 --- a/Solver/dgSystemOfEquations.cpp +++ b/Solver/dgSystemOfEquations.cpp @@ -99,8 +99,8 @@ void dgSystemOfEquations::L2Projection (const function *f){ // ok, we can setup the groups and create solution vectors void dgSystemOfEquations::setup(){ if (!_claw) throw; - _groups.buildGroupsOfElements(_gm,_dimension,_order, NULL); - _groups.buildGroupsOfInterfaces(); + _groups.buildGroupsOfElements(_gm,_dimension,_order, NULL); + _groups.buildGroupsOfInterfaces(); _solution = new dgDofContainer(&_groups,_claw->getNbFields()); _rightHandSide = new dgDofContainer(&_groups,_claw->getNbFields()); } diff --git a/Solver/dgTransformNodalValue.cpp b/Solver/dgTransformNodalValue.cpp index a590808a4fb0ec49acbac455a8d62a6c65bc53f7..c8ddbda33310181157845da61b716d84e2d02f2b 100644 --- a/Solver/dgTransformNodalValue.cpp +++ b/Solver/dgTransformNodalValue.cpp @@ -18,19 +18,19 @@ int dgSupraTransformNodalValue::apply ( dgDofContainer *solution) fullMatrix<double> Temp; for (int iElement=0 ; iElement<group.getNbElements() ; ++iElement) { Temp.setAsProxy(sol, nbFields*iElement, nbFields ); - int fSize = Temp.size1(); + int fSize = Temp.size1(); for (int k=0; k<nbFields; ++k) { - for (int i=0; i<fSize; ++i) { - if (Temp(i,k)<0) Temp(i,k) = - pow(fabs(Temp(i,k)),1/n_supra); - else Temp(i,k) = pow(fabs(Temp(i,k)),1/n_supra); - // Temp(i,k) = Temp(i,k)*0.5; + for (int i=0; i<fSize; ++i) { + if (Temp(i,k)<0) Temp(i,k) = - pow(fabs(Temp(i,k)),1/n_supra); + else Temp(i,k) = pow(fabs(Temp(i,k)),1/n_supra); + // Temp(i,k) = Temp(i,k)*0.5; } } } } - + } int dgSupraTransformNodalValue::apply_Inverse ( dgDofContainer *solution) @@ -43,20 +43,20 @@ int dgSupraTransformNodalValue::apply_Inverse ( dgDofContainer *solution) fullMatrix<double> Temp; for (int iElement=0 ; iElement<group.getNbElements() ; ++iElement) { Temp.setAsProxy(sol, nbFields*iElement, nbFields ); - int fSize = Temp.size1(); + int fSize = Temp.size1(); for (int k=0; k<nbFields; ++k) { - + for (int i=0; i<fSize; ++i) { - if (Temp(i,k)<0) Temp(i,k) =- pow(fabs(Temp(i,k)),n_supra); - else Temp(i,k) = pow(fabs(Temp(i,k)),n_supra); + if (Temp(i,k)<0) Temp(i,k) =- pow(fabs(Temp(i,k)),n_supra); + else Temp(i,k) = pow(fabs(Temp(i,k)),n_supra); //Temp(i,k) = 2*Temp(i,k); - + } } } - } + } } diff --git a/Solver/diagBCTerm.h b/Solver/diagBCTerm.h index 6e13dfd2f30d5b828fc435f3bc3f1f2d5d25a5e0..322d118513c575aff77b8ca2f0f08d8d0d030770 100644 --- a/Solver/diagBCTerm.h +++ b/Solver/diagBCTerm.h @@ -45,8 +45,8 @@ class diagBCTerm : public femTerm<double> { const int nbNodes = e->getNumVertices(); for (int j = 0; j < nbNodes; j++){ for (int k = 0; k < nbNodes; k++) { - m(j,k) = 0.0; - m(k,j) = 0.0; + m(j,k) = 0.0; + m(k,j) = 0.0; } MVertex *v = e->getVertex(j); if( v->onWhat()->dim() < 2 ) m(j,j) = 1.0; diff --git a/Solver/eigenSolver.cpp b/Solver/eigenSolver.cpp index 57f3534520fd0e51e496f84a33cd6c205d800c36..a260641cae21cd0a50f7fe336b02b5cdbd0dcfe0 100644 --- a/Solver/eigenSolver.cpp +++ b/Solver/eigenSolver.cpp @@ -117,7 +117,7 @@ bool eigenSolver::solve(int numEigenValues, std::string which) _try(MatGetVecs(A, PETSC_NULL, &xr)); _try(MatGetVecs(A, PETSC_NULL, &xi)); Msg::Info(" Re[EigenValue] Im[EigenValue]" - " Relative error"); + " Relative error"); for (int i = 0; i < nconv; i++){ PetscScalar kr, ki; _try(EPSGetEigenpair(eps, i, &kr, &ki, xr, xi)); @@ -131,7 +131,7 @@ bool eigenSolver::solve(int numEigenValues, std::string which) PetscReal im = ki; #endif Msg::Info("EIG %03d %s%.16e %s%.16e %3.6e", - i, (re < 0) ? "" : " ", re, (im < 0) ? "" : " ", im, error); + i, (re < 0) ? "" : " ", re, (im < 0) ? "" : " ", im, error); // store eigenvalues and eigenvectors _eigenValues.push_back(std::complex<double>(re, im)); @@ -141,9 +141,9 @@ bool eigenSolver::solve(int numEigenValues, std::string which) std::vector<std::complex<double> > ev(N); for(int i = 0; i < N; i++){ #if defined(PETSC_USE_COMPLEX) - ev[i] = tmpr[i]; + ev[i] = tmpr[i]; #else - ev[i] = std::complex<double>(tmpr[i], tmpi[i]); + ev[i] = std::complex<double>(tmpr[i], tmpi[i]); #endif } _eigenVectors.push_back(ev); diff --git a/Solver/function.cpp b/Solver/function.cpp index 8045f47e878d03f73796a4801788f9ead1ba625b..d6025f5df954895b4d54453b951235239677f9f8 100644 --- a/Solver/function.cpp +++ b/Solver/function.cpp @@ -276,7 +276,7 @@ class functionStructuredGridFile : public function { int id[3]; for(int i=0;i<3;i++){ id[i]=(int)((coord(pt,i)-_fun->o[i])/_fun->d[i]); - int a=id[i]; + int a=id[i]; id[i]=std::max(0,std::min(_fun->n[i]-1,id[i])); xi[i]=(coord(pt,i)-_fun->o[i]-id[i]*_fun->d[i])/_fun->d[i]; xi[i]=std::min(1.,std::max(0.,xi[i])); @@ -414,10 +414,10 @@ public: solEl.setAsProxy(sol,index*_dofContainer->getNbFields(),_dofContainer->getNbFields()); int fSize = group->getNbNodes(); for (int k=0;k<_dofContainer->getNbFields();k++){ - _value(i,k) = 0.0; - for (int j=0;j<fSize;j++){ - _value(i,k) += solEl(j,k)*fs[j]; - } + _value(i,k) = 0.0; + for (int j=0;j<fSize;j++){ + _value(i,k) += solEl(j,k)*fs[j]; + } } } } diff --git a/Solver/groupOfElements.cpp b/Solver/groupOfElements.cpp index a0984909cb836a5e67fcbcc1fbb21a60b858c00a..2ca9fe4c3994d4f62784b269339ff6be99b70824 100644 --- a/Solver/groupOfElements.cpp +++ b/Solver/groupOfElements.cpp @@ -18,7 +18,7 @@ void groupOfElements::addElementary(GEntity *ge, const elementFilter &filter){ } void groupOfElements::addPhysical(int dim, int physical, - const elementFilter &filter){ + const elementFilter &filter){ std::map<int, std::vector<GEntity*> > groups[4]; GModel::current()->getPhysicalGroups(groups); std::vector<GEntity*> &ent = groups[dim][physical]; diff --git a/Solver/multiscaleLaplace.cpp b/Solver/multiscaleLaplace.cpp index adbfdf1b2e2ee68e823a50966db34513d0619591..18d3749fb0fdab05279a4f463326cf2e18c08439 100644 --- a/Solver/multiscaleLaplace.cpp +++ b/Solver/multiscaleLaplace.cpp @@ -54,8 +54,8 @@ struct sort_pred { //-------------------------------------------------------------- static int intersection_segments_b (SPoint2 &p1, SPoint2 &p2, - SPoint2 &q1, SPoint2 &q2, - double x[2]){ + SPoint2 &q1, SPoint2 &q2, + double x[2]){ double P1[2] = {p1.x(),p1.y()}; double P2[2] = {p2.x(),p2.y()}; double Q1[2] = {q1.x(),q1.y()}; @@ -70,9 +70,9 @@ static int intersection_segments_b (SPoint2 &p1, SPoint2 &p2, } //-------------------------------------------------------------- static void recur_connect (MVertex *v, - std::multimap<MVertex*,MEdge> &v2e, - std::set<MEdge,Less_Edge> &group, - std::set<MVertex*> &touched){ + std::multimap<MVertex*,MEdge> &v2e, + std::set<MEdge,Less_Edge> &group, + std::set<MVertex*> &touched){ if (touched.find(v) != touched.end())return; @@ -88,16 +88,16 @@ static void recur_connect (MVertex *v, } //-------------------------------------------------------------- static void connected_bounds (std::vector<MElement*> &elements, - std::vector<std::vector<MEdge> > &boundaries){ + std::vector<std::vector<MEdge> > &boundaries){ std::vector<MEdge> bEdges; for(unsigned int i = 0; i < elements.size(); i++){ for(int j = 0; j < elements[i]->getNumEdges(); j++){ MEdge me = elements[i]->getEdge(j); if(std::find(bEdges.begin(), bEdges.end(), me) == bEdges.end()) - bEdges.push_back(me); + bEdges.push_back(me); else - bEdges.erase(std::find(bEdges.begin(), bEdges.end(),me)); + bEdges.erase(std::find(bEdges.begin(), bEdges.end(),me)); } } @@ -149,7 +149,7 @@ static double getSizeBB(std::vector<MEdge> &me){ } //-------------------------------------------------------------- static void ordering_dirichlet(std::vector<MElement*> &elements, - std::vector<std::pair<MVertex*,double> > &dirichletNodes){ + std::vector<std::pair<MVertex*,double> > &dirichletNodes){ //finding all boundaries std::vector<std::vector<MEdge> > boundaries; @@ -175,8 +175,8 @@ static void ordering_dirichlet(std::vector<MElement*> &elements, MVertex *v0 = dirichletEdges[i].getVertex(0); MVertex *v1 = dirichletEdges[i].getVertex(1); double len = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + - (v0->y() - v1->y()) * (v0->y() - v1->y()) + - (v0->z() - v1->z()) * (v0->z() - v1->z())) ; + (v0->y() - v1->y()) * (v0->y() - v1->y()) + + (v0->z() - v1->z()) * (v0->z() - v1->z())) ; tot_length += len; temp.push_back(dirichletEdges[i]); } @@ -191,26 +191,26 @@ static void ordering_dirichlet(std::vector<MElement*> &elements, MVertex *v0 = itl->getVertex(0); MVertex *v1 = itl->getVertex(1); if(v0 == current_v){ - found = true; - current_v = v1; - temp.erase(itl); - double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + - (v0->y() - v1->y()) * (v0->y() - v1->y()) + - (v0->z() - v1->z()) * (v0->z() - v1->z())); - double iLength = dirichletNodes[dirichletNodes.size()-1].second + (length / tot_length); - dirichletNodes.push_back(std::make_pair(v0,iLength)); - break; + found = true; + current_v = v1; + temp.erase(itl); + double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + + (v0->y() - v1->y()) * (v0->y() - v1->y()) + + (v0->z() - v1->z()) * (v0->z() - v1->z())); + double iLength = dirichletNodes[dirichletNodes.size()-1].second + (length / tot_length); + dirichletNodes.push_back(std::make_pair(v0,iLength)); + break; } else if(v1 == current_v){ - found = true; - current_v = v0; - temp.erase(itl); - double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + - (v0->y() - v1->y()) * (v0->y() - v1->y()) + - (v0->z() - v1->z()) * (v0->z() - v1->z())); - double iLength = dirichletNodes[dirichletNodes.size()-1].second + (length / tot_length); - dirichletNodes.push_back(std::make_pair(v1,iLength)); - break; + found = true; + current_v = v0; + temp.erase(itl); + double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + + (v0->y() - v1->y()) * (v0->y() - v1->y()) + + (v0->z() - v1->z()) * (v0->z() - v1->z())); + double iLength = dirichletNodes[dirichletNodes.size()-1].second + (length / tot_length); + dirichletNodes.push_back(std::make_pair(v1,iLength)); + break; } } if(!found) return ; @@ -220,8 +220,8 @@ static void ordering_dirichlet(std::vector<MElement*> &elements, } //-------------------------------------------------------------- static int intersection_segments (SPoint2 &p1, SPoint2 &p2, - SPoint2 &q1, SPoint2 &q2, - double x[2]){ + SPoint2 &q1, SPoint2 &q2, + double x[2]){ double A[2][2]; A[0][0] = p2.x()-p1.x(); A[0][1] = q1.x()-q2.x(); @@ -231,14 +231,14 @@ static int intersection_segments (SPoint2 &p1, SPoint2 &p2, sys2x2(A,b,x); return (x[0] >= 0.0 && x[0] <= 1. && - x[1] >= 0.0 && x[1] <= 1.); + x[1] >= 0.0 && x[1] <= 1.); } //-------------------------------------------------------------- static void recur_compute_centers_ (double R, double a1, double a2, - multiscaleLaplaceLevel * root, int &nbElems ){ + multiscaleLaplaceLevel * root, int &nbElems ){ nbElems += root->elements.size(); @@ -258,10 +258,10 @@ static void recur_compute_centers_ (double R, double a1, double a2, centers.push_back(std::make_pair(m->center,m)); m->radius = 0.0; for (std::map<MVertex*,SPoint2>::iterator it = m->coordinates.begin(); - it != m->coordinates.end() ; ++it){ + it != m->coordinates.end() ; ++it){ SPoint2 p = it->second; m->radius = std::max(m->radius,sqrt ((m->center.x() - p.x())*(m->center.x() - p.x())+ - (m->center.y() - p.y())*(m->center.y() - p.y()))); + (m->center.y() - p.y())*(m->center.y() - p.y()))); } centersChild.push_back(m->center); } @@ -278,34 +278,36 @@ static void recur_compute_centers_ (double R, double a1, double a2, SPoint2 c(0.0,0.0); double rad = 0.0; for(int j= 0; j< me.size(); j++){ - MVertex *v = me[j].getVertex(0); - std::map<MVertex *, SPoint2>::iterator it0 = root->coordinates.find(v); - c += it0->second; + MVertex *v = me[j].getVertex(0); + std::map<MVertex *, SPoint2>::iterator it0 = root->coordinates.find(v); + c += it0->second; } c *= 1./((double)me.size()); for(int j= 0; j< me.size(); j++){ - SPoint2 p = root->coordinates[me[j].getVertex(0)]; - rad = std::max(rad,sqrt ((c.x() - p.x())*(c.x() - p.x())+ - (c.y() - p.y())*(c.y() - p.y()))); + SPoint2 p = root->coordinates[me[j].getVertex(0)]; + rad = std::max(rad,sqrt ((c.x() - p.x())*(c.x() - p.x())+ + (c.y() - p.y())*(c.y() - p.y()))); } //check if the center has not been added bool newCenter = true; for (std::vector<SPoint2>::iterator it2 = centersChild.begin(); it2 != centersChild.end(); it2++){ - SPoint2 p = *it2; - double dist = sqrt ((c.x() - p.x())*(c.x() - p.x())+ - (c.y() - p.y())*(c.y() - p.y())); - if (dist < 0.5*rad) newCenter = false;//0.6 + SPoint2 p = *it2; + double dist = sqrt ((c.x() - p.x())*(c.x() - p.x())+ + (c.y() - p.y())*(c.y() - p.y())); + if (dist < 0.5*rad) newCenter = false;//0.6 } if (std::abs(rad/root->radius) < 0.65 && std::abs(rad) < 0.95 && newCenter){//0.6 - added++; - centers.push_back(std::make_pair(c,zero)); + added++; + centers.push_back(std::make_pair(c,zero)); } } } if (added != toadd && root->children.size()> 0) { - printf("!!!!!!!! ARG added =%d != %d (bounds=%d, child=%d)\n", added, boundaries.size()-1- root->children.size(), boundaries.size(), root->children.size()); + printf("!!!!!!!! ARG added = %d != %d (bounds=%d, child=%d)\n", added, + (int)(boundaries.size() - 1 - root->children.size()), (int)boundaries.size(), + (int)root->children.size()); //exit(1); } @@ -328,12 +330,12 @@ static void recur_compute_centers_ (double R, double a1, double a2, } //-------------------------------------------------------------- static void recur_cut_edges_ (multiscaleLaplaceLevel * root, - std::multimap<MEdge,MElement*,Less_Edge> &e2e, - std::map<MEdge,MVertex*,Less_Edge> &cutEdges, - std::set<MVertex*> &cutVertices){ + std::multimap<MEdge,MElement*,Less_Edge> &e2e, + std::map<MEdge,MVertex*,Less_Edge> &cutEdges, + std::set<MVertex*> &cutVertices){ std::set<MEdge,Less_Edge> allEdges; for (std::multimap <MEdge,MElement*,Less_Edge>::iterator it = e2e.begin(); - it != e2e.end() ; ++it){ + it != e2e.end() ; ++it){ allEdges.insert(it->first); } @@ -344,26 +346,26 @@ static void recur_cut_edges_ (multiscaleLaplaceLevel * root, SPoint2 p1 = centers[i].first; SPoint2 p2 = centers[i+1].first; for (std::set <MEdge,Less_Edge>::iterator it = allEdges.begin(); - it != allEdges.end() ; ++it){ + it != allEdges.end() ; ++it){ if(e2e.count(*it) == 2 && cutEdges.find(*it) == cutEdges.end()){ - std::map<MVertex *, SPoint2>::iterator it0 = root->coordinates.find(it->getVertex(0)); - std::map<MVertex *, SPoint2>::iterator it1 = root->coordinates.find(it->getVertex(1)); - if (it0 != root->coordinates.end() && it1 != root->coordinates.end()){ - SPoint2 q1 = root->coordinates[it->getVertex(0)]; - SPoint2 q2 = root->coordinates[it->getVertex(1)]; - double x[2]; - int inters = intersection_segments (p1,p2,q1,q2,x); - if (inters && x[1] > EPS && x[1] < 1.-EPS){ - // printf("%g %g -- %g %g -- %g %g -- %g %g\n",p1.x(),p1.y(),p2.x(),p2.y(),q1.x(),q1.y(),q2.x(),q2.y()); - MVertex *newv = new MVertex ((1.-x[1])*it->getVertex(0)->x() + x[1]*it->getVertex(1)->x(), - (1.-x[1])*it->getVertex(0)->y() + x[1]*it->getVertex(1)->y(), - (1.-x[1])*it->getVertex(0)->z() + x[1]*it->getVertex(1)->z()); - cutEdges[*it] = newv; - root->coordinates[newv] = q1*(1.-x[1]) + q2*x[1] ; - } - else if (inters && x[1] <= EPS)cutVertices.insert(it->getVertex(0)); - else if (inters && x[1] >= 1.-EPS)cutVertices.insert(it->getVertex(1)); - } + std::map<MVertex *, SPoint2>::iterator it0 = root->coordinates.find(it->getVertex(0)); + std::map<MVertex *, SPoint2>::iterator it1 = root->coordinates.find(it->getVertex(1)); + if (it0 != root->coordinates.end() && it1 != root->coordinates.end()){ + SPoint2 q1 = root->coordinates[it->getVertex(0)]; + SPoint2 q2 = root->coordinates[it->getVertex(1)]; + double x[2]; + int inters = intersection_segments (p1,p2,q1,q2,x); + if (inters && x[1] > EPS && x[1] < 1.-EPS){ + // printf("%g %g -- %g %g -- %g %g -- %g %g\n",p1.x(),p1.y(),p2.x(),p2.y(),q1.x(),q1.y(),q2.x(),q2.y()); + MVertex *newv = new MVertex ((1.-x[1])*it->getVertex(0)->x() + x[1]*it->getVertex(1)->x(), + (1.-x[1])*it->getVertex(0)->y() + x[1]*it->getVertex(1)->y(), + (1.-x[1])*it->getVertex(0)->z() + x[1]*it->getVertex(1)->z()); + cutEdges[*it] = newv; + root->coordinates[newv] = q1*(1.-x[1]) + q2*x[1] ; + } + else if (inters && x[1] <= EPS)cutVertices.insert(it->getVertex(0)); + else if (inters && x[1] >= 1.-EPS)cutVertices.insert(it->getVertex(1)); + } } } } @@ -376,10 +378,10 @@ static void recur_cut_edges_ (multiscaleLaplaceLevel * root, } //-------------------------------------------------------------- static void recur_cut_elements_ (multiscaleLaplaceLevel * root, - std::map<MEdge,MVertex*,Less_Edge> &cutEdges, - std::set<MVertex*> &cutVertices, - std::set<MEdge,Less_Edge> &theCut, - std::vector<MElement*> &_all){ + std::map<MEdge,MVertex*,Less_Edge> &cutEdges, + std::set<MVertex*> &cutVertices, + std::set<MEdge,Less_Edge> &theCut, + std::vector<MElement*> &_all){ std::vector<std::pair<SPoint2,multiscaleLaplaceLevel*> > ¢ers = root->cut; std::vector<MElement*> newElements; @@ -388,11 +390,11 @@ static void recur_cut_elements_ (multiscaleLaplaceLevel * root, for (int j=0;j<3;j++){ MEdge ed = root->elements[i]->getEdge(j); // if (cutVertices.find (ed.getVertex(0)) != cutVertices.end() && - // cutVertices.find (ed.getVertex(1)) != cutVertices.end() )theCut.insert(ed); + // cutVertices.find (ed.getVertex(1)) != cutVertices.end() )theCut.insert(ed); std::map<MEdge,MVertex*,Less_Edge> :: iterator it = cutEdges.find(ed); if (it != cutEdges.end()){ - c[j] = it->second; + c[j] = it->second; } } if (c[0] && c[1]){ @@ -421,33 +423,33 @@ static void recur_cut_elements_ (multiscaleLaplaceLevel * root, newElements.push_back(new MTriangle (root->elements[i]->getVertex(0),c[0],root->elements[i]->getVertex(2))); newElements.push_back(new MTriangle (root->elements[i]->getVertex(2),c[0],root->elements[i]->getVertex(1))); if (cutVertices.find (root->elements[i]->getVertex(0)) != cutVertices.end()) - theCut.insert(MEdge(c[0],root->elements[i]->getVertex(0))); - else if (cutVertices.find (root->elements[i]->getVertex(1)) != cutVertices.end()) - theCut.insert(MEdge(c[0],root->elements[i]->getVertex(1))); + theCut.insert(MEdge(c[0],root->elements[i]->getVertex(0))); + else if (cutVertices.find (root->elements[i]->getVertex(1)) != cutVertices.end()) + theCut.insert(MEdge(c[0],root->elements[i]->getVertex(1))); else - theCut.insert(MEdge(c[0],root->elements[i]->getVertex(2))); + theCut.insert(MEdge(c[0],root->elements[i]->getVertex(2))); //delete root->elements[i]; } else if (c[1]){ newElements.push_back(new MTriangle (root->elements[i]->getVertex(1),c[1],root->elements[i]->getVertex(0))); newElements.push_back(new MTriangle (root->elements[i]->getVertex(0),c[1],root->elements[i]->getVertex(2))); if (cutVertices.find (root->elements[i]->getVertex(1)) != cutVertices.end()) - theCut.insert(MEdge(c[1],root->elements[i]->getVertex(1))); - else if (cutVertices.find (root->elements[i]->getVertex(2)) != cutVertices.end()) - theCut.insert(MEdge(c[1],root->elements[i]->getVertex(2))); + theCut.insert(MEdge(c[1],root->elements[i]->getVertex(1))); + else if (cutVertices.find (root->elements[i]->getVertex(2)) != cutVertices.end()) + theCut.insert(MEdge(c[1],root->elements[i]->getVertex(2))); else - theCut.insert(MEdge(c[1],root->elements[i]->getVertex(0))); + theCut.insert(MEdge(c[1],root->elements[i]->getVertex(0))); //delete root->elements[i]; } else if (c[2]){ newElements.push_back(new MTriangle (root->elements[i]->getVertex(0),c[2],root->elements[i]->getVertex(1))); newElements.push_back(new MTriangle (root->elements[i]->getVertex(1),c[2],root->elements[i]->getVertex(2))); if (cutVertices.find (root->elements[i]->getVertex(0)) != cutVertices.end()) - theCut.insert(MEdge(c[2],root->elements[i]->getVertex(0))); - else if (cutVertices.find (root->elements[i]->getVertex(2)) != cutVertices.end()) - theCut.insert(MEdge(c[2],root->elements[i]->getVertex(2))); + theCut.insert(MEdge(c[2],root->elements[i]->getVertex(0))); + else if (cutVertices.find (root->elements[i]->getVertex(2)) != cutVertices.end()) + theCut.insert(MEdge(c[2],root->elements[i]->getVertex(2))); else - theCut.insert(MEdge(c[2],root->elements[i]->getVertex(1))); + theCut.insert(MEdge(c[2],root->elements[i]->getVertex(1))); //delete root->elements[i]; } else newElements.push_back(root->elements[i]); @@ -463,17 +465,17 @@ static void recur_cut_elements_ (multiscaleLaplaceLevel * root, } //-------------------------------------------------------------- static void recur_split_ (MElement *e, - std::multimap<MEdge,MElement*,Less_Edge> &e2e, - std::set<MElement*> &group, - std::set<MEdge,Less_Edge> &theCut){ + std::multimap<MEdge,MElement*,Less_Edge> &e2e, + std::set<MElement*> &group, + std::set<MEdge,Less_Edge> &theCut){ if (group.find(e) != group.end())return; group.insert(e); for (int i=0;i<e->getNumEdges();i++){ MEdge ed = e->getEdge(i); if (theCut.find(ed) == theCut.end()){ for (std::multimap <MEdge,MElement*,Less_Edge>::iterator it = e2e.lower_bound(ed); - it != e2e.upper_bound(ed) ; ++it){ - if (it->second != e)recur_split_ (it->second,e2e,group,theCut); + it != e2e.upper_bound(ed) ; ++it){ + if (it->second != e)recur_split_ (it->second,e2e,group,theCut); } } } @@ -483,13 +485,13 @@ static void recur_split_ (MElement *e, // starting form a list of elements, returns // lists of lists that are all simply connected static void recur_connect (const MEdge &e, - std::multimap<MEdge,MElement*,Less_Edge> &e2e, - std::set<MElement*> &group, - std::set<MEdge,Less_Edge> &touched){ + std::multimap<MEdge,MElement*,Less_Edge> &e2e, + std::set<MElement*> &group, + std::set<MEdge,Less_Edge> &touched){ if (touched.find(e) != touched.end())return; touched.insert(e); for (std::multimap <MEdge,MElement*,Less_Edge>::iterator it = e2e.lower_bound(e); - it != e2e.upper_bound(e) ; ++it){ + it != e2e.upper_bound(e) ; ++it){ group.insert(it->second); for (int i=0;i<it->second->getNumEdges();++i){ recur_connect (it->second->getEdge(i),e2e,group,touched); @@ -499,7 +501,7 @@ static void recur_connect (const MEdge &e, //-------------------------------------------------------------- static void connectedRegions (std::vector<MElement*> &elements, - std::vector<std::vector<MElement*> > ®ions) + std::vector<std::vector<MElement*> > ®ions) { std::multimap<MEdge,MElement*,Less_Edge> e2e; for (unsigned int i = 0; i < elements.size(); ++i){ @@ -520,18 +522,18 @@ static void connectedRegions (std::vector<MElement*> &elements, } //-------------------------------------------------------------- static void recur_cut_ (double R, double a1, double a2, - multiscaleLaplaceLevel * root, - std::vector<MElement *> &left, - std::vector<MElement *> &right){ + multiscaleLaplaceLevel * root, + std::vector<MElement *> &left, + std::vector<MElement *> &right){ SPoint2 PL (R*cos(a1),R*sin(a1)); SPoint2 PR (R*cos(a2),R*sin(a2)); std::vector<std::pair<SPoint2,multiscaleLaplaceLevel*> > centers = root->cut; double d = sqrt((PL.x()-PR.x())*(PL.x()-PR.x())+ - (PL.y()-PR.y())*(PL.y()-PR.y())); + (PL.y()-PR.y())*(PL.y()-PR.y())); SPoint2 farLeft (0.5*(PL.x()+PR.x()) - (PR.y()-PL.y())/d , - 0.5*(PL.y()+PR.y()) + (PR.x()-PL.x())/d ); + 0.5*(PL.y()+PR.y()) + (PR.x()-PL.x())/d ); for (unsigned int i = 0; i < root->elements.size(); i++){ SPoint2 pp (0,0); @@ -564,7 +566,7 @@ static void recur_cut_ (double R, double a1, double a2, //-------------------------------------------------------------- static void connected_left_right (std::vector<MElement *> &left, - std::vector<MElement *> &right ){ + std::vector<MElement *> &right ){ //connected left @@ -577,8 +579,8 @@ static void connected_left_right (std::vector<MElement *> &left, for (int i=1;i< subRegionsL.size() ; i++){ int size = subRegionsL[i].size(); if(size > maxSize){ - maxSize = size; - indexL = i; + maxSize = size; + indexL = i; } } } @@ -601,8 +603,8 @@ static void connected_left_right (std::vector<MElement *> &left, for (int i=1;i< subRegionsR.size() ; i++){ int size = subRegionsR[i].size(); if(size > maxSize){ - maxSize = size; - indexR = i; + maxSize = size; + indexR = i; } } } @@ -649,7 +651,7 @@ static void printLevel(const char* fn, SPoint2 p = (coordinates) ? (*coordinates)[*it] : SPoint2(0,0); if (coordinates) fprintf(fp, "%d %g %g 0\n", (*it)->getIndex(), p.x(), p.y()); else fprintf(fp, "%d %g %g %g\n", (*it)->getIndex(), - (*it)->x(), (*it)->y(), (*it)->z()); + (*it)->x(), (*it)->y(), (*it)->z()); } fprintf(fp, "$EndNodes\n"); @@ -707,8 +709,8 @@ static void one2OneMap(std::vector<MElement *> &elements, std::map<MVertex*,SPoi // std::map<MVertex*,SPoint2> vCoord; // for (int j=0; j < vTri.size(); j++){ // for (int k= 0; k < vTri[j]->getNumVertices(); k++){ -// MVertex *vk = vTri[j]->getVertex(k); -// vCoord[vk] = solution(vk); +// MVertex *vk = vTri[j]->getVertex(k); +// vCoord[vk] = solution(vk); // } // } // bool badCavity = closedCavity(v,vTri) ? checkCavity(vTri, vCoord) : false; @@ -734,7 +736,7 @@ static void one2OneMap(std::vector<MElement *> &elements, std::map<MVertex*,SPoi } //-------------------------------------------------------------- static bool checkOrientation(std::vector<MElement *> &elements, - std::map<MVertex*,SPoint2> &solution, int iter) { + std::map<MVertex*,SPoint2> &solution, int iter) { double a_old = 0, a_new; bool oriented = true; @@ -776,7 +778,7 @@ static bool checkOrientation(std::vector<MElement *> &elements, //-------------------------------------------------------------- multiscaleLaplace::multiscaleLaplace (std::vector<MElement *> &elements, - std::map<MVertex*, SPoint3> &allCoordinates) + std::map<MVertex*, SPoint3> &allCoordinates) { //To go through this execute gmsh with the option -optimize_hom @@ -861,7 +863,7 @@ multiscaleLaplace::multiscaleLaplace (std::vector<MElement *> &elements, // fprintf(f2,"View\"\"{\n"); // for ( ; itc != theCut.end();++itc){ // fprintf(f2,"SL(%g,%g,%g,%g,%g,%g){1.0,1.0};\n",itc->getVertex(0)->x(),itc->getVertex(0)->y(),itc->getVertex(0)->z(), -// itc->getVertex(1)->x(),itc->getVertex(1)->y(),itc->getVertex(1)->z()); +// itc->getVertex(1)->x(),itc->getVertex(1)->y(),itc->getVertex(1)->z()); // } // fprintf(f2,"};\n"); // fclose(f2); @@ -882,9 +884,9 @@ multiscaleLaplace::multiscaleLaplace (std::vector<MElement *> &elements, } void multiscaleLaplace::fillCoordinates (multiscaleLaplaceLevel & level, - std::map<MVertex*, SPoint3> &allCoordinates, - std::vector<double> &iScale, - std::vector<SPoint2> &iCenter){ + std::map<MVertex*, SPoint3> &allCoordinates, + std::vector<double> &iScale, + std::vector<SPoint2> &iCenter){ iScale.push_back(level.scale); iCenter.push_back(level.center); @@ -895,7 +897,7 @@ void multiscaleLaplace::fillCoordinates (multiscaleLaplaceLevel & level, MVertex *v = e->getVertex(j); SPoint2 coord = level.coordinates[v]; for (int k= iScale.size()-1; k > 0; k--){ - coord = coord*iScale[k] + iCenter[k]; + coord = coord*iScale[k] + iCenter[k]; } allCoordinates[v] = SPoint3(coord.x(), coord.y(), 0.0); } @@ -959,8 +961,8 @@ void multiscaleLaplace::parametrize (multiscaleLaplaceLevel & level){ for (int i=1;i< regGoodSize.size() ; i++){ int size = regGoodSize[i].size(); if(size > maxSize){ - index = i; - maxSize = size; + index = i; + maxSize = size; } } goodSize.clear(); @@ -995,7 +997,7 @@ void multiscaleLaplace::parametrize (multiscaleLaplaceLevel & level){ // totArea += area; double local_size = localSize(e,solution); if (local_size < 5.e-6 * global_size) //1.e-7 - really_small_elements = true; + really_small_elements = true; } //center *= (1./regions_[i].size()); if(really_small_elements ){ @@ -1021,10 +1023,10 @@ void multiscaleLaplace::parametrize (multiscaleLaplaceLevel & level){ // double dist = sqrt((ec.x()-c.x())*(ec.x()-c.x()) + (ec.y()-c.y())*(ec.y()-c.y())); // std::vector<MElement*>::iterator itp; // if (dist > 0.5*rad ) { -// goodSize.push_back(e); -// itp = it; -// it++; -// regions[i].erase(itp); +// goodSize.push_back(e); +// itp = it; +// it++; +// regions[i].erase(itp); // } // } // std::vector<std::vector<MElement*> > connRegions ; @@ -1034,17 +1036,17 @@ void multiscaleLaplace::parametrize (multiscaleLaplaceLevel & level){ // for (int j=1;j< connRegions.size() ; j++){ // int size = connRegions[i].size(); // if(size > maxSize){ -// maxSize = size; -// index = j; +// maxSize = size; +// index = j; // } // } // for (int j=0;j< connRegions.size() ; j++){ // if (j == index){ -// regions[i].clear(); -// regions[i].insert(regions[i].begin(), connRegions[j].begin(), connRegions[j].end()); +// regions[i].clear(); +// regions[i].insert(regions[i].begin(), connRegions[j].begin(), connRegions[j].end()); // } // else{ -// goodSize.insert(goodSize.begin(), connRegions[j].begin(), connRegions[j].end()); +// goodSize.insert(goodSize.begin(), connRegions[j].begin(), connRegions[j].end()); // } // } // } @@ -1078,7 +1080,7 @@ void multiscaleLaplace::parametrize (multiscaleLaplaceLevel & level){ for (int k=0; k<regions[i].size() ; k++){ MElement *e = regions[i][k]; for(unsigned int j = 0; j<e->getNumVertices(); ++j){ - tooSmallv.insert(e->getVertex(j)); + tooSmallv.insert(e->getVertex(j)); } } @@ -1101,7 +1103,7 @@ void multiscaleLaplace::parametrize (multiscaleLaplaceLevel & level){ for(std::set<MVertex *>::iterator itv = tooSmallv.begin(); itv !=tooSmallv.end() ; ++itv){ MVertex *v = *itv; if (goodSizev.find(v) != goodSizev.end()){ - nextLevel->coordinates[v] = (solution[v]-nextLevel->center)*(1./nextLevel->scale); + nextLevel->coordinates[v] = (solution[v]-nextLevel->center)*(1./nextLevel->scale); } } // recursively continue if tooSmall is not empty @@ -1115,9 +1117,9 @@ void multiscaleLaplace::parametrize (multiscaleLaplaceLevel & level){ } void multiscaleLaplace::parametrize_method (multiscaleLaplaceLevel & level, - std::set<MVertex*> &allNodes, - std::map<MVertex*,SPoint2> &solution, - typeOfMapping tom) + std::set<MVertex*> &allNodes, + std::map<MVertex*,SPoint2> &solution, + typeOfMapping tom) { solution.clear(); @@ -1127,7 +1129,7 @@ void multiscaleLaplace::parametrize_method (multiscaleLaplaceLevel & level, dofManager<double> myAssembler(_lsys); for(std::map<MVertex*,SPoint2>::iterator it = level.coordinates.begin(); - it != level.coordinates.end(); ++it){ + it != level.coordinates.end(); ++it){ MVertex *v = it->first; myAssembler.fixVertex(v, 0, 1, it->second[step]); } diff --git a/Solver/multiscaleLaplace.h b/Solver/multiscaleLaplace.h index 5e205190019714b61dd1930036fdeb588913b5b7..47e79eab36c77626352379a160a09d7c0af76865 100644 --- a/Solver/multiscaleLaplace.h +++ b/Solver/multiscaleLaplace.h @@ -26,21 +26,21 @@ struct multiscaleLaplaceLevel { class multiscaleLaplace{ public: multiscaleLaplace (std::vector<MElement *> &elements, - std::map<MVertex*, SPoint3> &allCoordinates); + std::map<MVertex*, SPoint3> &allCoordinates); void cut (std::vector<MElement *> &elements); typedef enum {HARMONIC=1,CONFORMAL=2, CONVEXCOMBINATION=3} typeOfMapping; linearSystem<double> *_lsys; multiscaleLaplaceLevel* root; void fillCoordinates (multiscaleLaplaceLevel & level, - std::map<MVertex*, SPoint3> &allCoordinates, - std::vector<double> &iScale, - std::vector<SPoint2> &iCenter); + std::map<MVertex*, SPoint3> &allCoordinates, + std::vector<double> &iScale, + std::vector<SPoint2> &iCenter); void parametrize (multiscaleLaplaceLevel &); void parametrize_method (multiscaleLaplaceLevel & level, - std::set<MVertex*> &allNodes, - std::map<MVertex*,SPoint2> &solution, - typeOfMapping tom); + std::set<MVertex*> &allNodes, + std::map<MVertex*,SPoint2> &solution, + typeOfMapping tom); }; diff --git a/Solver/terms.h b/Solver/terms.h index 36cc38f7cca5867fd7685d0396a7941fbe18f2b9..9db711b3df1067e84601e05f25480d25159c1292 100644 --- a/Solver/terms.h +++ b/Solver/terms.h @@ -221,7 +221,7 @@ class IsotropicElasticTerm : public BilinearTerm<SVector3,SVector3> for (int i = 0; i < npts; i++) { const double u = GP[i].pt[0]; const double v = GP[i].pt[1]; const double w = GP[i].pt[2]; - if (ele->getParent()) ele=ele->getParent(); + if (ele->getParent()) ele=ele->getParent(); const double weight = GP[i].weight; const double detJ = ele->getJacobian(u, v, w, jac); std::vector<TensorialTraits<SVector3>::GradType> Grads; BilinearTerm<SVector3,SVector3>::space1.gradf(ele,u, v, w, Grads); // a optimiser ?? diff --git a/benchmarks/bugs/test_problem_point_set_search.cpp b/benchmarks/bugs/test_problem_point_set_search.cpp index 67d8025308ccc8efbc608cc7814d0969aabffcef..586c3663a1cf2433918768a28c16c5b3860c1dcb 100644 --- a/benchmarks/bugs/test_problem_point_set_search.cpp +++ b/benchmarks/bugs/test_problem_point_set_search.cpp @@ -20,7 +20,7 @@ class MVertexLessThanLexicographic{ bool operator()(const MVertex *v1, const MVertex *v2) const { printf("v1 = %.16g, %.16g, %.16g +++ v2 = %.16g, %.16g, %.16g\n", - v1->x(), v1->y(), v1->z(), v2->x(), v2->y(), v2->z()); + v1->x(), v1->y(), v1->z(), v2->x(), v2->y(), v2->z()); if(v1->x() < v2->x() - tolerance) return true; if(v1->x() > v2->x() + tolerance) return false; if(v1->y() < v2->y() - tolerance) return true; diff --git a/utils/api_demos/mainCartesian.cpp b/utils/api_demos/mainCartesian.cpp index 070242780e270bab7a4c0b60524e42df8c108e54..be30ed48a5801cf88110b7038131e15cb2ee7fbf 100644 --- a/utils/api_demos/mainCartesian.cpp +++ b/utils/api_demos/mainCartesian.cpp @@ -18,8 +18,8 @@ void insertBoxes ( double x, double y, double z, double EP, cartesianBox<double> for (int i=i1;i<=i2;i++){ for (int j=j1;j<=j2;j++){ for (int k=k1;k<=k2;k++){ - int id = box.element_index(i,j,k); - box.insert(id); + int id = box.element_index(i,j,k); + box.insert(id); } } } @@ -105,14 +105,14 @@ int main (int argc,char *argv[]){ int NZ =FACT*range.z()/range.x(); printf("%g %g %g -- %g %g %g -- %d %d %d\n",bb.min().x(),bb.min().y(),bb.min().z(), - bb.max().x(),bb.max().y(),bb.max().z(),NX,NY,NZ); + bb.max().x(),bb.max().y(),bb.max().z(),NX,NY,NZ); cartesianBox<double> box ( bb.min().x(),bb.min().y(),bb.min().z(), - SVector3(range.x(),0,0), - SVector3(0,range.y(),0), - SVector3(0,0,range.z()), - NX,NY,NZ); + SVector3(range.x(),0,0), + SVector3(0,range.y(),0), + SVector3(0,0,range.z()), + NX,NY,NZ); box.points() = POINTS; box.normals() = NORMALS; @@ -164,17 +164,17 @@ int main (int argc,char *argv[]){ SVector3 NN (crossprod(P2-P1,P3-P1)); // printf("N1 %g %g %g N2 %g %g %g -- %g %g %g -- %g %g %g -- %g %g %g\n",N.x(),N.y(),N.z(),NN.x(),NN.y(),NN.z(), - // p1.x(),p1.y(),p1.z(),p2.x(),p2.y(),p2.z(),p3.x(),p3.y(),p3.z()); + // p1.x(),p1.y(),p1.z(),p2.x(),p2.y(),p2.z(),p3.x(),p3.y(),p3.z()); if (dot(NN, N) > 0) - signedDistancesPointsTriangle (localdist,NODES,P1,P2,P3); + signedDistancesPointsTriangle (localdist,NODES,P1,P2,P3); else - signedDistancesPointsTriangle (localdist,NODES,P2,P1,P3); + signedDistancesPointsTriangle (localdist,NODES,P2,P1,P3); if(1){ - if (dist.empty())dist=localdist; - else - for (int j=0;j<localdist.size();j++) - dist[j] = (fabs(dist[j]) < fabs(localdist[j])) ? dist[j] : localdist[j]; + if (dist.empty())dist=localdist; + else + for (int j=0;j<localdist.size();j++) + dist[j] = (fabs(dist[j]) < fabs(localdist[j])) ? dist[j] : localdist[j]; } } III++; diff --git a/utils/api_demos/mainElasticity.cpp b/utils/api_demos/mainElasticity.cpp index 03fb945db9581bb86f5755fbddf701a72e682cf6..82b965550271e62f5e41a98e27333e153ccada17 100644 --- a/utils/api_demos/mainElasticity.cpp +++ b/utils/api_demos/mainElasticity.cpp @@ -26,7 +26,7 @@ int main (int argc, char* argv[]){ PView *pv = mySolver.buildDisplacementView("displacement"); pv->getData()->writeMSH("disp.msh", false); delete pv; - + // stop gmsh GmshFinalize(); diff --git a/utils/api_demos/mainOcc.cpp b/utils/api_demos/mainOcc.cpp index 733fc8f7e9437bbb38140f7e9d7eb7b8c77af5b4..bb3f1524d6d759cac31bddd66ae0dba65a0ff52f 100644 --- a/utils/api_demos/mainOcc.cpp +++ b/utils/api_demos/mainOcc.cpp @@ -38,10 +38,10 @@ public: if(level == "Fatal" || level == "Error"){ GEntity *e = _model->getCurrentMeshEntity(); if(e){ - printf("error occurred while meshing entity:\n"); - printf(" tag=%d\n", e->tag()); - printf(" dimension=%d\n", e->dim()); - printf(" native pointer=%p\n", e->getNativePtr()); + printf("error occurred while meshing entity:\n"); + printf(" tag=%d\n", e->tag()); + printf(" dimension=%d\n", e->dim()); + printf(" native pointer=%p\n", e->getNativePtr()); } } if(level == "Fatal") throw "Fatal error in Gmsh"; @@ -80,8 +80,8 @@ int main(int argc, char **argv) MElement *e = f->getMeshElement(i); printf(" element %d:", e->getNum()); for(unsigned int j = 0; j < e->getNumVertices(); j++){ - MVertex *v = e->getVertex(j); - printf(" %d (%g,%g,%g)", v->getNum(), v->x(), v->y(), v->z()); + MVertex *v = e->getVertex(j); + printf(" %d (%g,%g,%g)", v->getNum(), v->x(), v->y(), v->z()); } printf("\n"); } diff --git a/utils/converters/autocad/dxf2geo.cpp b/utils/converters/autocad/dxf2geo.cpp index 9ec8cf81d09ea51192f94a967e3a7517e6233600..6a87693d875844b61badd8ae520aaed51db3fce7 100644 --- a/utils/converters/autocad/dxf2geo.cpp +++ b/utils/converters/autocad/dxf2geo.cpp @@ -53,7 +53,7 @@ class Point xx += THETRANSX; yy += THETRANSY; fprintf(outfile, "Point (%d) = {%g *u, %g *u, %g *u, lc} ;\n", - num, xx, yy, z); + num, xx, yy, z); } }; @@ -82,7 +82,7 @@ class Curve break; case GEOCIRCLE: fprintf(outfile, "Circle (%d) = {%d, %d, %d} ;\n", - num, a, b, c); + num, a, b, c); break; } } @@ -585,6 +585,6 @@ stopit: printf("bounding box [%g,%g] [%g,%g] [%g,%g]\n", min_x, max_x, min_y, max_y, min_z, max_z); printf("tolerance %g: %d points / %d curves / %ld degenerate entities removed\n", - THETOL, Point_T.size(), Curve_T.size(), degenerates); + THETOL, Point_T.size(), Curve_T.size(), degenerates); exit(0); } diff --git a/utils/converters/brl-cad/BRLFile.cpp b/utils/converters/brl-cad/BRLFile.cpp index 63456272c826806bab3d2a3239f233597da063a1..fd896e56fb2995e826c2845f225ae30f5e23b630 100644 --- a/utils/converters/brl-cad/BRLFile.cpp +++ b/utils/converters/brl-cad/BRLFile.cpp @@ -55,8 +55,8 @@ BRLTopo::BRLTopo(struct rt_arb_internal *arb) { TopoDS_Vertex v[8]; for(int i=0;i<8;i++) - v[i]=BRepBuilderAPI_MakeVertex( - gp_Pnt( + v[i]=BRepBuilderAPI_MakeVertex( + gp_Pnt( scale*arb->pt[i][0], scale*arb->pt[i][1], scale*arb->pt[i][2] @@ -65,49 +65,49 @@ BRLTopo::BRLTopo(struct rt_arb_internal *arb) int arbn; if(!BRepTools::Compare(v[6],v[7])) - arbn=8; + arbn=8; else if(!BRepTools::Compare(v[4],v[5])) - arbn=7; + arbn=7; else if(!BRepTools::Compare(v[5],v[6])) - arbn=6; + arbn=6; else if(!BRepTools::Compare(v[0],v[3])) - arbn=5; + arbn=5; else - arbn=4; + arbn=4; switch(arbn) { case 8: { - TopoDS_Edge e[12]; - for(int i=0;i<4;i++) { - e[i]=BRepBuilderAPI_MakeEdge(v[i],v[(i+1)%4]); - e[i+4]=BRepBuilderAPI_MakeEdge(v[i+4],v[(i+1)%4+4]); - e[i+8]=BRepBuilderAPI_MakeEdge(v[i],v[(i+4)%8]); - } - - TopoDS_Wire w[6]; - w[0]=BRepBuilderAPI_MakeWire(e[0],e[1],e[2],e[3]); - w[1]=BRepBuilderAPI_MakeWire(e[4],e[5],e[6],e[7]); - w[2]=BRepBuilderAPI_MakeWire(e[0],e[9],e[4],e[8]); - w[3]=BRepBuilderAPI_MakeWire(e[1],e[10],e[5],e[9]); - w[4]=BRepBuilderAPI_MakeWire(e[2],e[11],e[6],e[10]); - w[5]=BRepBuilderAPI_MakeWire(e[3],e[8],e[7],e[11]); - - BRep_Builder BB; - TopoDS_Shell shell; - BB.MakeShell(shell); - for(int i=0;i<6;i++) { - TopoDS_Face f=BRepBuilderAPI_MakeFace(w[i]); - BB.Add(shell,i? f.Reversed():f); - } - TopoDS_Solid solid; - BB.MakeSolid(solid); - BB.Add(solid,shell); - ShapeFix_Solid sf(solid); - sf.Perform(); - shape=sf.Solid(); - } break; + TopoDS_Edge e[12]; + for(int i=0;i<4;i++) { + e[i]=BRepBuilderAPI_MakeEdge(v[i],v[(i+1)%4]); + e[i+4]=BRepBuilderAPI_MakeEdge(v[i+4],v[(i+1)%4+4]); + e[i+8]=BRepBuilderAPI_MakeEdge(v[i],v[(i+4)%8]); + } + + TopoDS_Wire w[6]; + w[0]=BRepBuilderAPI_MakeWire(e[0],e[1],e[2],e[3]); + w[1]=BRepBuilderAPI_MakeWire(e[4],e[5],e[6],e[7]); + w[2]=BRepBuilderAPI_MakeWire(e[0],e[9],e[4],e[8]); + w[3]=BRepBuilderAPI_MakeWire(e[1],e[10],e[5],e[9]); + w[4]=BRepBuilderAPI_MakeWire(e[2],e[11],e[6],e[10]); + w[5]=BRepBuilderAPI_MakeWire(e[3],e[8],e[7],e[11]); + + BRep_Builder BB; + TopoDS_Shell shell; + BB.MakeShell(shell); + for(int i=0;i<6;i++) { + TopoDS_Face f=BRepBuilderAPI_MakeFace(w[i]); + BB.Add(shell,i? f.Reversed():f); + } + TopoDS_Solid solid; + BB.MakeSolid(solid); + BB.Add(solid,shell); + ShapeFix_Solid sf(solid); + sf.Perform(); + shape=sf.Solid(); + } break; case 6: { - TopoDS_Edge e[9]; + TopoDS_Edge e[9]; e[0]=BRepBuilderAPI_MakeEdge(v[0],v[1]); e[1]=BRepBuilderAPI_MakeEdge(v[1],v[2]); e[2]=BRepBuilderAPI_MakeEdge(v[2],v[3]); @@ -118,38 +118,38 @@ BRLTopo::BRLTopo(struct rt_arb_internal *arb) e[7]=BRepBuilderAPI_MakeEdge(v[3],v[6]); e[8]=BRepBuilderAPI_MakeEdge(v[4],v[6]); - TopoDS_Wire w[5]; - w[0]=BRepBuilderAPI_MakeWire(e[0],e[1],e[2],e[3]); - w[1]=BRepBuilderAPI_MakeWire(e[0],e[4],e[5]); - w[2]=BRepBuilderAPI_MakeWire(e[2],e[6],e[7]); - w[3]=BRepBuilderAPI_MakeWire(e[3],e[4],e[8],e[7]); - w[4]=BRepBuilderAPI_MakeWire(e[1],e[5],e[8],e[6]); + TopoDS_Wire w[5]; + w[0]=BRepBuilderAPI_MakeWire(e[0],e[1],e[2],e[3]); + w[1]=BRepBuilderAPI_MakeWire(e[0],e[4],e[5]); + w[2]=BRepBuilderAPI_MakeWire(e[2],e[6],e[7]); + w[3]=BRepBuilderAPI_MakeWire(e[3],e[4],e[8],e[7]); + w[4]=BRepBuilderAPI_MakeWire(e[1],e[5],e[8],e[6]); - BRep_Builder BB; + BRep_Builder BB; #if 0 - TopoDS_Compound result; - BB.MakeCompound(result); - for(int i=0;i<5;i++) { + TopoDS_Compound result; + BB.MakeCompound(result); + for(int i=0;i<5;i++) { BB.Add(result,BRepBuilderAPI_MakeFace(w[i])); - } - shape=result; + } + shape=result; #else - TopoDS_Shell shell; - BB.MakeShell(shell); - for(int i=0;i<5;i++) { - TopoDS_Face f=BRepBuilderAPI_MakeFace(w[i]); - BB.Add(shell,f); //i? f:f.Reversed()); - } - TopoDS_Solid solid; - BB.MakeSolid(solid); - BB.Add(solid,shell); - ShapeFix_Solid sf(solid); - sf.Perform(); - shape=sf.Solid(); + TopoDS_Shell shell; + BB.MakeShell(shell); + for(int i=0;i<5;i++) { + TopoDS_Face f=BRepBuilderAPI_MakeFace(w[i]); + BB.Add(shell,f); //i? f:f.Reversed()); + } + TopoDS_Solid solid; + BB.MakeSolid(solid); + BB.Add(solid,shell); + ShapeFix_Solid sf(solid); + sf.Perform(); + shape=sf.Solid(); #endif - } break; + } break; default: - cerr << "Unhandled arb8 type n=" << arbn << '\n'; + cerr << "Unhandled arb8 type n=" << arbn << '\n'; } } @@ -178,9 +178,9 @@ BRLTopo::BRLTopo(struct rt_tgc_internal *tgc) scale*(v.Coord(3)-tgc->b[2])); Handle(Geom_Ellipse) top; if(v.SquareDistance(a)<v.SquareDistance(b)) - top=GC_MakeEllipse(b, aa, v); + top=GC_MakeEllipse(b, aa, v); else - top=GC_MakeEllipse(a, b, v); + top=GC_MakeEllipse(a, b, v); TopoDS_Edge e_t[4]; e_t[0]=BRepBuilderAPI_MakeEdge(top,a,b); e_t[1]=BRepBuilderAPI_MakeEdge(top,b,aa); @@ -209,9 +209,9 @@ BRLTopo::BRLTopo(struct rt_tgc_internal *tgc) scale*(h.Coord(3)-tgc->d[2])); Handle(Geom_Ellipse) bottom; if(h.SquareDistance(c)<h.SquareDistance(d)) - bottom=GC_MakeEllipse(d, cc, h); + bottom=GC_MakeEllipse(d, cc, h); else - bottom=GC_MakeEllipse(c, d, h); + bottom=GC_MakeEllipse(c, d, h); TopoDS_Edge e_b[4]; e_b[0]=BRepBuilderAPI_MakeEdge(bottom,c,d); e_b[1]=BRepBuilderAPI_MakeEdge(bottom,d,cc); @@ -229,8 +229,8 @@ BRLTopo::BRLTopo(struct rt_tgc_internal *tgc) TopoDS_Compound result; BB.MakeCompound(result); for(int i=0;i<4;i++) { - BB.Add(result,e_t[i]); - BB.Add(result,e_b[i]); + BB.Add(result,e_t[i]); + BB.Add(result,e_b[i]); } shape=result; #endif @@ -273,7 +273,7 @@ BRLTopo::BRLTopo(struct rt_ell_internal *ell) TopoDS_Solid sph=BRepPrimAPI_MakeSphere(v,ell->a[0]); TopoDS_Face init; for(TopExp_Explorer p(sph,TopAbs_FACE); p.More(); p.Next()) - init=TopoDS::Face(p.Current()); + init=TopoDS::Face(p.Current()); BRepFill_Filling face1; //face1.LoadInitSurface(init); face1.Add(e_ab[0],GeomAbs_C0); @@ -340,7 +340,7 @@ BRLFile::BRLFile(char *filename, int v) /* build a wdbp structure for convenient read/write */ wdbp = wdb_dbopen(dbip, RT_WDB_TYPE_DB_DISK); - if (db_dirbuild(dbip) < 0) { /* create directory database contents */ + if (db_dirbuild(dbip) < 0) { /* create directory database contents */ bu_log("Error building directory for %s\n", filename); exit(-1); } @@ -358,8 +358,8 @@ int BRLFile::AddModel(char const *name) db_functree(dbip, dp, CsgCombine, CsgLeaf, &rt_uniresource, this); while(construction.size()>0) { - Add(construction.front()); - construction.pop_front(); + Add(construction.front()); + construction.pop_front(); } return 0; } @@ -369,23 +369,23 @@ TopoDS_Shape BRLFile::PerformBoolean(union tree *tp) TopoDS_Shape left, right, result; if(tp->tr_op==OP_UNION || tp->tr_op==OP_INTERSECT || tp->tr_op==OP_SUBTRACT ) { - left=PerformBoolean(tp->tr_b.tb_left); - right=PerformBoolean(tp->tr_b.tb_right); + left=PerformBoolean(tp->tr_b.tb_left); + right=PerformBoolean(tp->tr_b.tb_right); } if(verbose&BRL) { - switch(tp->tr_op) { - case OP_UNION: - case OP_INTERSECT: - case OP_SUBTRACT: - cout<< " Bool " << *tp; - break; - case OP_DB_LEAF: - if(verbose&BRL) - cout << " Leaf " << tp->tr_l.tl_name; - break; - } - cout << " remaining " << construction.size() << '\n'; + switch(tp->tr_op) { + case OP_UNION: + case OP_INTERSECT: + case OP_SUBTRACT: + cout<< " Bool " << *tp; + break; + case OP_DB_LEAF: + if(verbose&BRL) + cout << " Leaf " << tp->tr_l.tl_name; + break; + } + cout << " remaining " << construction.size() << '\n'; } switch(tp->tr_op) { @@ -393,12 +393,12 @@ TopoDS_Shape BRLFile::PerformBoolean(union tree *tp) case OP_INTERSECT:return BRepAlgoAPI_Common(left,right); case OP_SUBTRACT: return BRepAlgoAPI_Cut(left,right); case OP_DB_LEAF: - result=construction.back(); - construction.pop_back(); - return result; + result=construction.back(); + construction.pop_back(); + return result; default: - std::cerr << "Invalid boolean operation in " << __FUNCTION__ << '\n'; - return result; + std::cerr << "Invalid boolean operation in " << __FUNCTION__ << '\n'; + return result; } } @@ -410,7 +410,7 @@ void BRLFile::CsgCombine(struct db_i *dbip, struct directory *dp, genptr_t ptr) if(rt_db_get_internal(&ip, dp, dbip, NULL, &rt_uniresource)!=ID_COMBINATION ) { std::cerr << "Combination is not a combination in " - << __FUNCTION__ << '\n'; + << __FUNCTION__ << '\n'; exit(1); } diff --git a/utils/converters/brl-cad/BRLFile.h b/utils/converters/brl-cad/BRLFile.h index e0106875ee5b65efd12637feb9a1e3a1aeae5543..7fc5c445928b8f83fb13afdc9bea8d74029e2df7 100644 --- a/utils/converters/brl-cad/BRLFile.h +++ b/utils/converters/brl-cad/BRLFile.h @@ -8,8 +8,8 @@ /* BRL-CAD ************************************************************/ #include "common.h" -#include "vmath.h" /* vector math macros */ -#include "raytrace.h" /* librt interface definitions */ +#include "vmath.h" /* vector math macros */ +#include "raytrace.h" /* librt interface definitions */ #include "rtgeom.h" #include "wdb.h" diff --git a/utils/converters/brl-cad/g-brep.cpp b/utils/converters/brl-cad/g-brep.cpp index 81c32f9af8bccaba7b2981afc73a6abdd73b1137..257733c34e20da92a6fbbdb7d14e9ce04a6373e7 100644 --- a/utils/converters/brl-cad/g-brep.cpp +++ b/utils/converters/brl-cad/g-brep.cpp @@ -30,9 +30,9 @@ main(int argc, char **argv) return 1; } } else if(solid.AddModel(argv[i])) { - cerr << "Cannot find model " << argv[i] << '\n'; - return 1; - } + cerr << "Cannot find model " << argv[i] << '\n'; + return 1; + } } if(connect) solid.Connect(); @@ -42,11 +42,11 @@ main(int argc, char **argv) std::string newname=argv[1]; int start=newname.find(".g"); if(start==std::string::npos) { - newname+=".brep"; - std::cerr << "Cannot find the .g extension, writing to: " - << newname << std::endl; + newname+=".brep"; + std::cerr << "Cannot find the .g extension, writing to: " + << newname << std::endl; } else - newname.replace(start,newname.length(),".brep"); + newname.replace(start,newname.length(),".brep"); solid.SaveBRep(newname.c_str()); //solid.Dump(cout); } diff --git a/utils/converters/brl-cad/printing.h b/utils/converters/brl-cad/printing.h index 86f1b416c14db286acf86093ca0bfc7de516a5f9..539fd51db940f72b0756e7fce607bbb1f5636a97 100644 --- a/utils/converters/brl-cad/printing.h +++ b/utils/converters/brl-cad/printing.h @@ -18,23 +18,23 @@ std::ostream &operator <<(std::ostream &o,rt_comb_internal const &c) { o << " unsigned long magic " << c.magic << '\n'; o << " union tree * tree " << c.tree << '\n'; - o << " char region_flag " << (int)c.region_flag << '\n'; - o << " char is_fastgen " << (int)c.is_fastgen << '\n'; + o << " char region_flag " << (int)c.region_flag << '\n'; + o << " char is_fastgen " << (int)c.is_fastgen << '\n'; /* Begin GIFT compatability */ - o << " long region_id " << c.region_id << '\n'; - o << " long aircode " << c.aircode << '\n'; - o << " long GIFTmater " << c.GIFTmater << '\n'; - o << " long los " << c.los << '\n'; + o << " long region_id " << c.region_id << '\n'; + o << " long aircode " << c.aircode << '\n'; + o << " long GIFTmater " << c.GIFTmater << '\n'; + o << " long los " << c.los << '\n'; /* End GIFT compatability */ - o << " char rgb_valid " << (int)c.rgb_valid << '\n'; - o << " unsigned char rgb[3] " << (int)c.rgb[0] << ',' - << (int)c.rgb[1] << ',' << (int)c.rgb[2] << '\n'; - o << " float temperature " << c.temperature << '\n'; + o << " char rgb_valid " << (int)c.rgb_valid << '\n'; + o << " unsigned char rgb[3] " << (int)c.rgb[0] << ',' + << (int)c.rgb[1] << ',' << (int)c.rgb[2] << '\n'; + o << " float temperature " << c.temperature << '\n'; //cout << " struct bu_vls shader " << c.shader << '\n'; //cout << " struct bu_vls material " << c.material << '\n'; - o << " char inherit " << (int)c.inherit << '\n'; + o << " char inherit " << (int)c.inherit << '\n'; return o; } diff --git a/utils/converters/brl-cad/tprintf.h b/utils/converters/brl-cad/tprintf.h index bacecff9a52f0e0966fa2bf88c1b5840967f4713..6a41b2589672b3937161da7c3f7b14bf5390b361 100644 --- a/utils/converters/brl-cad/tprintf.h +++ b/utils/converters/brl-cad/tprintf.h @@ -5,26 +5,26 @@ #include <stdio.h> class tprintf { - char *buffer; + char *buffer; public: - tprintf(const char *fmt, ...); - ~tprintf() { delete buffer; } - operator const char* () const { return buffer; } + tprintf(const char *fmt, ...); + ~tprintf() { delete buffer; } + operator const char* () const { return buffer; } }; inline tprintf::tprintf(const char *fmt, ...) { - va_list ap; - int size=100; - for(;;) { - buffer=new char[size]; - va_start(ap,fmt); - int new_size=vsnprintf(buffer,size,fmt,ap); - va_end(ap); - if(new_size<size) - break; - size=new_size+1; - delete buffer; - } + va_list ap; + int size=100; + for(;;) { + buffer=new char[size]; + va_start(ap,fmt); + int new_size=vsnprintf(buffer,size,fmt,ap); + va_end(ap); + if(new_size<size) + break; + size=new_size+1; + delete buffer; + } } #endif // TPRINTF_H_INCLUDED diff --git a/utils/converters/stl_to_cartesian/mesh.h b/utils/converters/stl_to_cartesian/mesh.h index 7ee4296fa4048ac71215515c5c73fc85d6902f12..9c8df731af426f8be49555f444b5846e0ee9f6da 100644 --- a/utils/converters/stl_to_cartesian/mesh.h +++ b/utils/converters/stl_to_cartesian/mesh.h @@ -21,9 +21,9 @@ typedef struct typedef struct { - FILE *fp; - msh_node *node_start; - msh_element *element_start; - msh_stats stats; + FILE *fp; + msh_node *node_start; + msh_element *element_start; + msh_stats stats; }msh_data; diff --git a/utils/converters/stl_to_cartesian/stl.h b/utils/converters/stl_to_cartesian/stl.h index d0a17042f879853d1171d982753e8d476f8b1428..533d377db11461f15ccd205e55f855310fb1b7a3 100644 --- a/utils/converters/stl_to_cartesian/stl.h +++ b/utils/converters/stl_to_cartesian/stl.h @@ -1,10 +1,10 @@ -#define LABEL_SIZE 80 -#define NUM_FACET_SIZE 4 -#define HEADER_SIZE 84 -#define STL_MIN_FILE_SIZE 134 -#define ASCII_LINES_PER_FACET 7 -#define SIZEOF_EDGE_SORT 24 +#define LABEL_SIZE 80 +#define NUM_FACET_SIZE 4 +#define HEADER_SIZE 84 +#define STL_MIN_FILE_SIZE 134 +#define ASCII_LINES_PER_FACET 7 +#define SIZEOF_EDGE_SORT 24 typedef struct { @@ -26,7 +26,7 @@ typedef enum {BINARY, ASCII} stl_type; typedef struct { - long file_size; + long file_size; char header[81]; stl_type type; int number_of_facets; @@ -46,9 +46,9 @@ typedef struct typedef struct { - FILE *fp; - stl_facet *facet_start; - stl_stats stats; + FILE *fp; + stl_facet *facet_start; + stl_stats stats; }stl_data; typedef struct diff --git a/utils/misc/untabify.sh b/utils/misc/untabify.sh index 906951801a4566156cecf858543477112887445f..40625e01a38886dc3f36cd3ed68fbb242a6ed31e 100755 --- a/utils/misc/untabify.sh +++ b/utils/misc/untabify.sh @@ -1,14 +1,11 @@ #!/bin/sh -if [ $# -lt 1 ] ; then - echo "Usage: untabify files" 1>&2 - exit 1 -else - for file in $@; do - echo Modifying $file - mv $file $file~ - expand $file~ > $file - done -fi +files=`find ../.. \( -name "*.cpp" -or -name "*.h" \) -and -not -path "*contrib*"` +echo $files +for file in $files; do + echo Untabifying $file + expand $file > $file~ + mv -f $file~ $file +done diff --git a/utils/misc/update_copyright.sh b/utils/misc/update_copyright.sh index fe3b2d18cdbc74fd2d284a1943f3b48746927100..719830ce3563d728b816a83db38f61af02a53be7 100755 --- a/utils/misc/update_copyright.sh +++ b/utils/misc/update_copyright.sh @@ -2,7 +2,7 @@ files=`find ../.. -not -path "*.svn*" -and -not -path "*lib*" -and -not -path "*bin*" -and -not -name "update_copyright.sh" | xargs grep 'Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle' -sl` -echo $files +# echo $files for file in $files do diff --git a/utils/solvers/c++/interactive.cpp b/utils/solvers/c++/interactive.cpp index 11824056bd8a1e2c973066eca1eac4f7820e2cf1..87ff098ea124d74e2850f6cae1a20792c5594bda 100644 --- a/utils/solvers/c++/interactive.cpp +++ b/utils/solvers/c++/interactive.cpp @@ -38,37 +38,37 @@ class GmshInteractiveClient{ if(!ptr) break; // if the command line is not empty if(strlen(ptr)){ - // add the command in the stack - add_history(ptr); - if(!strcmp(ptr, "q") || !strcmp(ptr, "quit")){ - // exit interactive if q or quit - free(ptr); - break; - } - else if(ptr[0] == '!'){ - // direct system calls - system(&ptr[1]); - } - else if(!strcmp(ptr, "argh")){ - // test speed of string sending with a 1Mb view - char *dat = new char[1200000]; - strcpy(dat, "View \"test\" {\n"); - int n = strlen(dat); - for(int i = 0; i < 100; i++){ - for(int j = 0; j < 200; j++){ - n += sprintf(&dat[n], "SQ(%d,%d,0,%d,%d,0,%d,%d,0,%d,%d,0){%d,%d,%d,%d};\n", - i, j, i+1, j, i+1, j+1, i, j+1, i, i+1, j, j+1); - } - } - strcat(dat, "};"); - printf("n=%d\n", n); - _client.ParseString(dat); - delete [] dat; - } - else{ - // pass any other command to gmsh - _client.ParseString(ptr); - } + // add the command in the stack + add_history(ptr); + if(!strcmp(ptr, "q") || !strcmp(ptr, "quit")){ + // exit interactive if q or quit + free(ptr); + break; + } + else if(ptr[0] == '!'){ + // direct system calls + system(&ptr[1]); + } + else if(!strcmp(ptr, "argh")){ + // test speed of string sending with a 1Mb view + char *dat = new char[1200000]; + strcpy(dat, "View \"test\" {\n"); + int n = strlen(dat); + for(int i = 0; i < 100; i++){ + for(int j = 0; j < 200; j++){ + n += sprintf(&dat[n], "SQ(%d,%d,0,%d,%d,0,%d,%d,0,%d,%d,0){%d,%d,%d,%d};\n", + i, j, i+1, j, i+1, j+1, i, j+1, i, i+1, j, j+1); + } + } + strcat(dat, "};"); + printf("n=%d\n", n); + _client.ParseString(dat); + delete [] dat; + } + else{ + // pass any other command to gmsh + _client.ParseString(ptr); + } } free(ptr); } diff --git a/utils/solvers/c++/solver.cpp b/utils/solvers/c++/solver.cpp index 2060e1d29c7735b35fdee4851b600bc27bb88b24..b52b0ffb4fe009d9c00ebbb9d48ac691c0caaae2 100644 --- a/utils/solvers/c++/solver.cpp +++ b/utils/solvers/c++/solver.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) if(argv[i][0] == '-') { if(!strcmp(argv[i] + 1, "socket")) { i++; - if(argv[i]) socket = argv[i++]; + if(argv[i]) socket = argv[i++]; } else if(!strcmp(argv[i] + 1, "options")) { i++; @@ -78,17 +78,17 @@ int main(int argc, char *argv[]) client.Info("Done computing curve"); FILE *file = fopen("solver.pos", "w"); if(!file) - client.Error("Unable to open output file"); + client.Error("Unable to open output file"); else { - fprintf(file, "View.Type = 2;\n"); - fprintf(file, "View.Axes = 3;\n"); - fprintf(file, "Delete View[0];\n"); - fprintf(file, "View \"%s\"{\n", option); - for(int j = 0; j < 100; j++) - fprintf(file, "SP(%d,0,0){%g};\n", j,sin(j*i*M_PI/10.)); - fprintf(file, "};\n"); - fclose(file); - client.MergeFile("solver.pos"); + fprintf(file, "View.Type = 2;\n"); + fprintf(file, "View.Axes = 3;\n"); + fprintf(file, "Delete View[0];\n"); + fprintf(file, "View \"%s\"{\n", option); + for(int j = 0; j < 100; j++) + fprintf(file, "SP(%d,0,0){%g};\n", j,sin(j*i*M_PI/10.)); + fprintf(file, "};\n"); + fclose(file); + client.MergeFile("solver.pos"); } } client.Info("Done!");