Skip to content
Snippets Groups Projects

Extractors

Merged Boman Romain requested to merge extractors into master
Files
7
+ 64
10
@@ -24,11 +24,45 @@ Post::~Post()
std::cout << "~Post()\n";
}
/// rebuild solution vectors for gmsh and add views
/// rebuild solution vectors for gmsh and add views:
///
/// X
/// Y
/// Z
/// displacement_vector
/// force_vector
/// stress_tensor
/// stress_xx
/// stress_yy
/// stress_zz
/// stress_xy
/// stress_xz
/// stress_yz
/// strain_tensor
/// strain_xx
/// strain_yy
/// strain_zz
/// strain_xy
/// strain_xz
/// strain_yz
/// smooth_stress_tensor
/// smooth_stress_xx
/// smooth_stress_yy
/// smooth_stress_zz
/// smooth_stress_xy
/// smooth_stress_xz
/// smooth_stress_yz
/// smooth_strain_tensor
/// smooth_strain_xx
/// smooth_strain_yy
/// smooth_strain_zz
/// smooth_strain_xy
/// smooth_strain_xz
/// smooth_strain_yz
void Post::build_views()
{
std::cout << "creating views...\n";
std::cout << "creating views..." << std::endl;
// nodal dofs
add_dofs_view(solver.pbl, solver.dofs, solver.X, solver.dofPart, solver.dofIdx);
@@ -330,6 +364,19 @@ Post::probe(std::string const &name, std::string const &grpname)
// get physical group from grpname
Group *grp = solver.pbl.groups_by_name.at(grpname); // TODO: better handling of errors
std::vector<std::size_t> nodeTags;
std::vector<double> coord;
gmsh::model::mesh::getNodesForPhysicalGroup(grp->dim, grp->tag, nodeTags, coord);
// j'ai essayé de boucler sur les entités du groupe et faire un getNode de l'entité
// mais ça ne me retourne rien (?)
// std::cout << "nodeTags.size()=" << nodeTags.size() << '\n';
// retourne les coordonnées des noeuds du groupe si demandé
if(name=="coords")
{
return coord;
}
// get the view
auto it = views.find(name);
if (it == views.end())
@@ -339,14 +386,6 @@ Post::probe(std::string const &name, std::string const &grpname)
// probe values
std::vector<double> all_values;
std::vector<std::size_t> nodeTags;
std::vector<double> coord;
gmsh::model::mesh::getNodesForPhysicalGroup(grp->dim, grp->tag, nodeTags, coord);
// j'ai essayé de boucler sur les entités du groupe et faire un getNode de l'entité
// mais ça ne me retourne rien (?)
// std::cout << "nodeTags.size()=" << nodeTags.size() << '\n';
for (size_t i = 0; i < nodeTags.size(); ++i)
{
std::vector<double> values;
@@ -365,6 +404,21 @@ Post::probe(std::string const &name, std::string const &grpname)
// std::cout << "\tgot from gmsh: " << values << '\n';
// std::cout << "\tdistance = " << distance << std::endl;
if(values.size() == 9) // tensor -> compute j2
{
// xx, xy, xz, yx, yy, yz, zx, zy, zz
// 0, 1, 2, 3, 4, 5, 6, 7, 8
double xx = values[0];
double yy = values[4];
double zz = values[8];
double xy = values[1];
double zx = values[6];
double yz = values[5];
double j2 = sqrt( ((xx-yy)*(xx-yy) + (yy-zz)*(yy-zz) + (zz-xx)*(zz-xx) )/2 + 3*(xy*xy+yz*yz+zx*zx) );
values.clear();
values.push_back(j2);
}
all_values.insert(all_values.end(), values.begin(), values.end());
}
Loading