Commit 4ff08700 by Amaury Johnen

Merge branch 'master' into fixBamg

parents dbdb64e6 bbbdc9be
Pipeline #229 passed with stage
in 8 minutes 52 seconds
......@@ -1545,7 +1545,7 @@ void Msg::Barrier()
#include <omp.h>
int Msg::GetNumThreads(){ return omp_get_num_threads(); }
void Msg::SetNumThreads(int num){ printf("Setting num threads = %d", num); omp_set_num_threads(num); }
void Msg::SetNumThreads(int num){ omp_set_num_threads(num); }
int Msg::GetMaxThreads(){ return omp_get_max_threads(); }
int Msg::GetThreadNum(){ return omp_get_thread_num(); }
......
......@@ -1600,12 +1600,13 @@ void GFace::setMeshMaster(GFace* master, const std::vector<double>& tfo)
GVertex* l_vertex = NULL;
double dist_min = 1.e22;
std::set<GVertex*>::iterator lvIter = l_vertices.begin();
for (;lvIter!=l_vertices.end(); ++lvIter) {
SPoint3 xyz((*lvIter)->x(),(*lvIter)->y(),(*lvIter)->z());
SVector3 dist = xyz - xyzTfo;
dist_min = std::min(dist_min,dist.norm());
if (dist.norm() < CTX::instance()->geom.tolerance * CTX::instance()->lc) {
l_vertex = *lvIter;
break;
......@@ -1615,8 +1616,9 @@ void GFace::setMeshMaster(GFace* master, const std::vector<double>& tfo)
if (l_vertex==NULL) {
Msg::Error("Was not able to find corresponding node %d "
"for periodic connection of surface %d to %d "
"using the specified transformation",
m_vertex->tag(),master->tag(),tag());
"using the specified transformation"
"Minimum distance is %g with a tolerance of %g",
m_vertex->tag(),master->tag(),tag(),dist_min, CTX::instance()->geom.tolerance * CTX::instance()->lc);
return;
}
gVertexCounterparts[l_vertex] = m_vertex;
......
......@@ -324,9 +324,9 @@ SMetric3 BGM_MeshMetric(GEntity *ge,
Field *f = fields->get(fields->getBackgroundField());
if(f) {
SMetric3 l4;
if (!f->isotropic()) (*f)(X, Y, Z, l4, ge);
if (!f->isotropic()){(*f)(X, Y, Z, l4, ge);}
else {
const double L = (*f)(X, Y, Z, ge);
const double L = (*f)(X, Y, Z, ge);
l4 = SMetric3(1/(L*L));
}
m1 = intersection(l4, m0);
......
......@@ -1499,6 +1499,7 @@ class PostViewField : public Field
}
double operator() (double x, double y, double z, GEntity *ge=0)
{
PView *v = getView();
if(!v) return MAX_LC;
if(update_needed){
......@@ -1528,7 +1529,7 @@ class PostViewField : public Field
// of finding an element
if(!octree->searchTensorWithTol(x, y, z, l, 0, 0, 0.05))
Msg::Info("No tensor element found containing point (%g,%g,%g)", x, y, z);
if(crop_negative_values){
if(0 && crop_negative_values){
if(l[0] <= 0 && l[1] <= 0 && l[2] <= 0 &&
l[3] <= 0 && l[4] <= 0 && l[5] <= 0 &&
l[6] <= 0 && l[7] <= 0 && l[8] <= 0){
......@@ -1540,6 +1541,7 @@ class PostViewField : public Field
}
}
}
// printf("%g %g %g %g %g %g %g %g %g\n",l[0],l[1], l[2],l[3],l[4], l[5],l[6],l[7], l[8]);
metr(0, 0) = l[0]; metr(0, 1) = l[1]; metr(0, 2) = l[2];
metr(1, 0) = l[3]; metr(1, 1) = l[4]; metr(1, 2) = l[5];
metr(2, 0) = l[6]; metr(2, 1) = l[7]; metr(2, 2) = l[8];
......
......@@ -145,9 +145,6 @@ static double F_Lc_aniso(GEdge *ge, double t)
bool blf = false;
#endif
//printf("coucou\n");
GPoint p = ge->point(t);
SMetric3 lc_here;
......@@ -617,7 +614,8 @@ void meshGEdge::operator() (GEdge *ge)
SVector3 der = ge->firstDer(pt.t);
pt.xp = der.norm();
}
a = smoothPrimitive(ge, sqrt(CTX::instance()->mesh.smoothRatio), Points);
if (CTX::instance()->mesh.algo2d != ALGO_2D_BAMG)
a = smoothPrimitive(ge, sqrt(CTX::instance()->mesh.smoothRatio), Points);
filterMinimumN = ge->minimumMeshSegments() + 1;
N = std::max(filterMinimumN, (int)(a + 1.99));
}
......@@ -709,10 +707,10 @@ void meshGEdge::operator() (GEdge *ge)
// vv.insert(vv.end(), _addEnd.rend(), _addEnd.rbegin());
mesh_vertices = vv;
}
if (CTX::instance()->mesh.algo2d != ALGO_2D_BAMG &&
_addBegin.empty() && _addEnd.empty())
filterPoints(ge, filterMinimumN - 2);
if (CTX::instance()->mesh.algo2d != ALGO_2D_BAMG)
if (_addBegin.empty() && _addEnd.empty())
filterPoints(ge, filterMinimumN - 2);
for(unsigned int i = 0; i < mesh_vertices.size() + 1; i++){
MVertex *v0 = (i == 0) ?
......
......@@ -430,6 +430,10 @@ bool OctreePost::_getValue(void *in, int dim, int nbNod, int nbComp,
double *X = (double*)in, *Y = &X[nbNod], *Z = &X[2*nbNod], *V = &X[3*nbNod], U[3];
// for (int i=0;i<3*9*3;i++)printf("%g ", X[i]);
// printf("\n");
elementFactory factory;
element *e = factory.create(nbNod, dim, X, Y, Z);
if(!e) return false;
......@@ -451,9 +455,10 @@ bool OctreePost::_getValue(void *in, int dim, int nbNod, int nbComp,
}
else{
for(int j = 0; j < nbComp; j++){
if(!grad)
values[j] = e->interpolate(&V[nbNod * nbComp * step + j],
U[0], U[1], U[2], nbComp);
if(!grad){
values[j] = e->interpolate(&V[nbNod * nbComp * step + j],
U[0], U[1], U[2], nbComp);
}
else
e->interpolateGrad(&V[nbNod * nbComp * step + j], U[0], U[1], U[2],
&values[3 * j], nbComp);
......
/*********************************************************************
*
* Gmsh tutorial 17
*
* Anisotropic background mesh
*
*********************************************************************/
// Characteristic lengths can be specified very accuractely by providing a
// background mesh, i.e., a post-processing view that contains the target mesh
// sizes. Here, the background mesh is represented as a metric tensor field
// defined on a square. One should use bamg as 2d mesh generator to enable
// anisotropic meshes in 2D.
// --> the square
Point(1) = {-1, -1, 0, 1.0};
Point(2) = {1, -1, 0, 1.0};
Point(3) = {1, 1, 0, 1.0};
Point(4) = {-1, 1, 0, 1.0};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line Loop(1) = {1, 2, 3, 4};
Plane Surface(1) = {1};
// Merge a post-processing view containing the target anisotropic mesh sizes
Merge "t17.pos";
// Apply the view as the current background mesh
Background Mesh View[0];
// Use bamg
Mesh.Algorithm=7;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment