Skip to content
Snippets Groups Projects
Commit 5d525152 authored by Matti Pellika's avatar Matti Pellika
Browse files

Fixed orientation issue with overlapping chains.

parent 5d110a04
Branches
Tags
No related merge requests found
...@@ -648,22 +648,27 @@ int Chain::writeChainMSH(const std::string &name) ...@@ -648,22 +648,27 @@ int Chain::writeChainMSH(const std::string &name)
void Chain::createPView() void Chain::createPView()
{ {
std::vector<MElement*> elements; std::vector<MElement*> elements;
std::map<int, std::vector<double> > data; std::map<int, std::vector<double> > data;
MElementFactory factory;
for(citer cit = _cells.begin(); cit != _cells.end(); cit++){ for(citer cit = _cells.begin(); cit != _cells.end(); cit++){
Cell* cell = (*cit).first; Cell* cell = (*cit).first;
int coeff = (*cit).second; int coeff = (*cit).second;
MElement *e = cell->getImageMElement(); MElement* e = cell->getImageMElement();
cell->setDeleteImage(false); std::vector<MVertex*> v;
for(int i = 0; i < e->getNumVertices(); i++){
if(cell->getDim() > 0 && coeff < 0) e->revert(); // flip orientation v.push_back(e->getVertex(i));
for(int i = 0; i < abs(coeff); i++) elements.push_back(e); }
MElement* ne = factory.create(e->getTypeForMSH(), v);
if(cell->getDim() > 0 && coeff < 0) ne->revert(); // flip orientation
for(int i = 0; i < abs(coeff); i++) elements.push_back(ne);
std::vector<double> coeffs (1,abs(coeff)); std::vector<double> coeffs (1,abs(coeff));
data[e->getNum()] = coeffs; data[ne->getNum()] = coeffs;
} }
int max[4]; int max[4];
for(int i = 0; i < 4; i++) max[i] = _model->getMaxElementaryNumber(i); for(int i = 0; i < 4; i++) max[i] = _model->getMaxElementaryNumber(i);
int entityNum = *std::max_element(max,max+4) + 1; int entityNum = *std::max_element(max,max+4) + 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment