Skip to content
Snippets Groups Projects

Update waves

Merged Boman Romain requested to merge adrien into master
2 files
+ 36
16
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 34
16
@@ -200,9 +200,11 @@ void MshDeformation::initializeMoving(std::vector<Group *> bndGrp)
{
// Create vector of boundary nodes
for (auto bnd : bndGrp)
for (auto e : bnd->tag->elems)
for (auto e : bnd->tag->elems) {
movBndElems.push_back(e);
for (auto n : e->nodes)
movBndNodes.push_back(n);
}
// Get unique
std::sort(movBndNodes.begin(), movBndNodes.end());
auto iterator = std::unique(movBndNodes.begin(), movBndNodes.end());
@@ -217,12 +219,16 @@ void MshDeformation::initializeInternal(Link * intBndLnk)
{
// Temporary container for nodes
std::vector<Node *> nodes0, nodes1;
for(auto e : intBndLnk->tags[0]->elems)
for(auto e : intBndLnk->tags[0]->elems) {
intBndElems.push_back(e);
for(auto n : e->nodes)
nodes0.push_back(n);
for(auto e : intBndLnk->tags[1]->elems)
}
for(auto e : intBndLnk->tags[1]->elems) {
intBndElems.push_back(e);
for(auto n : e->nodes)
nodes1.push_back(n);
}
// Get unique
std::sort (nodes0.begin(), nodes0.end());
auto it = std::unique (nodes0.begin(), nodes0.end());
@@ -362,19 +368,31 @@ void MshDeformation::deform()
n->pos.x[m] -= q[nDim*(n->row)+m];
}
// Update element memory and check the Jacobian (only implemented for Tri3)
for (auto e : fldElems) {
if (e->type() == ELTYPE::TRI3){
Mem &m = e->getVMem();
m.update();
for (int k = 0; k < m.getGPn() ; k++) {
if (m.getDetJ(k) <= 0) {
std::stringstream err;
err << "Negative jacobian detected for element: " << *e << "\n";
throw std::runtime_error(err.str());
}
}
}
}
//for (auto e : fldElems) {
// if (e->type() == ELTYPE::TRI3){
// Mem &m = e->getVMem();
// m.update();
// for (int k = 0; k < m.getGPn() ; k++) {
// if (m.getDetJ(k) <= 0) {
// std::stringstream err;
// err << "Negative jacobian detected for element: " << *e << "\n";
// throw std::runtime_error(err.str());
// }
// }
// }
//}
//for (auto e : msh->elems) {
// if (e->type() == ELTYPE::TRI3 || e->type() == ELTYPE::LINE2){
// e->getVMem().update();
// }
//}
for (auto e : fldElems)
e->getVMem().update();
for (auto e : movBndElems)
e->getVMem().update();
for (auto e : intBndElems)
e->getVMem().update();
}
void MshDeformation::write(std::ostream &out) const
Loading