Skip to content
Snippets Groups Projects
Commit d0b4ede4 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

tweaks

parent 9d2ca6a1
No related branches found
No related tags found
No related merge requests found
......@@ -172,7 +172,7 @@ void GEdge::setVisibility(char val, bool recursive)
std::string GEdge::getAdditionalInfoString()
{
std::ostringstream sstream;
if(v0 && v1) sstream << "{" << v0->tag() << "," << v1->tag() << "}";
if(v0 && v1) sstream << "{" << v0->tag() << " " << v1->tag() << "}";
return sstream.str();
}
......
......@@ -614,8 +614,6 @@ void GFace::computeMeshSizeFieldAccuracy(double &avg,double &max_e, double &min_
min_e = std::min(min_e, lone);
}
#endif
//printf("Emi efficiency tau (%g) =%g nE=%d nT=%d \n", avg, 100*exp(avg/(double)nE), nE, getNumMeshElements());
}
double GFace::curvatureDiv(const SPoint2 &param) const
......@@ -902,7 +900,8 @@ class data_wrapper{
};
// Callback function for BFGS
void bfgs_callback(const alglib::real_1d_array& x, double& func, alglib::real_1d_array& grad, void* ptr)
void bfgs_callback(const alglib::real_1d_array& x, double& func,
alglib::real_1d_array& grad, void* ptr)
{
data_wrapper* w = static_cast<data_wrapper*>(ptr);
SPoint3 p = w->get_point();
......@@ -950,9 +949,11 @@ GPoint GFace::closestPoint(const SPoint3 &queryPoint, const double initialGuess[
// fprintf(F,"View \" \" {\n");
// fprintf(F,"SP(%g,%g,%g) {%g};\n",queryPoint.x(),queryPoint.y(),queryPoint.z(),0.0);
double initial_guesses = 10.0;
for(double u = uu.low(); u<=uu.high()+1.e-5; u+=(uu.high()-uu.low())/initial_guesses) {
for(double u = uu.low(); u <= uu.high() + 1.e-5;
u += (uu.high() - uu.low()) / initial_guesses) {
// printf("%f\n", u);
for(double v = vv.low(); v<=vv.high()+1.e-5; v+=(vv.high()-vv.low())/initial_guesses) {
for(double v = vv.low(); v <= vv.high() + 1.e-5;
v += (vv.high() - vv.low()) / initial_guesses) {
GPoint pnt = point(u, v);
SPoint3 spnt(pnt.x(), pnt.y(), pnt.z());
double dist = queryPoint.distance(spnt);
......@@ -1286,7 +1287,6 @@ bool GFace::fillPointCloud(double maxDist,
std::vector<SPoint2> *uvpoints,
std::vector<SVector3> *normals)
{
if(!points) return false;
if (buildSTLTriangulation()){
......
// Gmsh - Copyright (C) 1997-2013 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@geuz.org>.
......@@ -209,13 +209,10 @@ void GRegion::setVisibility(char val, bool recursive)
std::string GRegion::getAdditionalInfoString()
{
std::ostringstream sstream;
if(l_faces.size() > 20){
sstream << "{" << l_faces.front()->tag() << ",...," << l_faces.back()->tag() << "}";
}
else if(l_faces.size()){
if(l_faces.size()){
sstream << "{";
for(std::list<GFace*>::iterator it = l_faces.begin(); it != l_faces.end(); ++it){
if(it != l_faces.begin()) sstream << ",";
if(it != l_faces.begin()) sstream << " ";
sstream << (*it)->tag();
}
sstream << "}";
......@@ -292,8 +289,8 @@ void GRegion::replaceFaces (std::list<GFace*> &new_faces)
{
replaceFacesInternal(new_faces);
if (l_faces.size() != new_faces.size()){
Msg::Fatal("impossible to replace faces in region %d (%d vs %d)",tag(),
l_faces.size(),new_faces.size());
Msg::Error("Impossible to replace faces in region %d (%d vs %d)",
tag(), l_faces.size(), new_faces.size());
}
std::list<GFace*>::iterator it = l_faces.begin();
......@@ -323,7 +320,6 @@ double GRegion::computeSolidProperties (std::vector<double> cg,
double surface = 0;
cg[0] = cg[1] = cg[2] = 0.0;
for ( ; it != l_faces.end(); ++it,++itdir){
//printf("face %d dir %d %d elements\n",(*it)->tag(),*itdir,(int)(*it)->triangles.size());
for (unsigned int i = 0; i < (*it)->triangles.size(); ++i){
MTriangle *e = (*it)->triangles[i];
int npt;
......@@ -360,12 +356,7 @@ double GRegion::computeSolidProperties (std::vector<double> cg,
it = l_faces.begin();
itdir = l_dirs.begin();
inertia[0] =
inertia[1] =
inertia[2] =
inertia[3] =
inertia[4] =
inertia[5] = 0.0;
inertia[0] = inertia[1] = inertia[2] = inertia[3] = inertia[4] = inertia[5] = 0.0;
for ( ; it != l_faces.end(); ++it,++itdir){
for (unsigned int i = 0; i < (*it)->getNumMeshElements(); ++i){
......@@ -382,15 +373,20 @@ double GRegion::computeSolidProperties (std::vector<double> cg,
double detJ = e->getJacobian(pts[j].pt[0], pts[j].pt[1], pts[j].pt[2], jac);
SVector3 n(jac[2][0], jac[2][1], jac[2][2]);
n *= (double)*itdir;
inertia[0] += pts[j].weight*detJ*n.x()*(pt.x()-cg[0])*(pt.x()-cg[0])*(pt.x()-cg[0])/3.0;
inertia[1] += pts[j].weight*detJ*n.y()*(pt.y()-cg[1])*(pt.y()-cg[1])*(pt.y()-cg[1])/3.0;
inertia[2] += pts[j].weight*detJ*n.z()*(pt.z()-cg[2])*(pt.z()-cg[2])*(pt.z()-cg[2])/3.0;
inertia[3] += pts[j].weight*detJ*n.x()*(pt.y()-cg[1])*(pt.x()-cg[0])*(pt.x()-cg[0])/3.0;
inertia[4] += pts[j].weight*detJ*n.x()*(pt.z()-cg[2])*(pt.x()-cg[0])*(pt.x()-cg[0])/3.0;
inertia[5] += pts[j].weight*detJ*n.y()*(pt.z()-cg[2])*(pt.y()-cg[1])*(pt.y()-cg[1])/3.0;
inertia[0] += pts[j].weight * detJ * n.x() *
(pt.x() - cg[0]) * (pt.x() - cg[0]) * (pt.x() - cg[0]) / 3.0;
inertia[1] += pts[j].weight * detJ * n.y() *
(pt.y() - cg[1]) * (pt.y() - cg[1]) * (pt.y() - cg[1]) / 3.0;
inertia[2] += pts[j].weight * detJ * n.z() *
(pt.z() - cg[2]) * (pt.z() - cg[2]) * (pt.z() - cg[2]) / 3.0;
inertia[3] += pts[j].weight * detJ * n.x() *
(pt.y() - cg[1]) * (pt.x() - cg[0]) * (pt.x() - cg[0]) / 3.0;
inertia[4] += pts[j].weight * detJ * n.x() *
(pt.z() - cg[2]) * (pt.x() - cg[0]) * (pt.x() - cg[0]) / 3.0;
inertia[5] += pts[j].weight * detJ * n.y() *
(pt.z() - cg[2]) * (pt.y() - cg[1]) * (pt.y() - cg[1]) / 3.0;
}
}
}
return volume;
}
......@@ -77,7 +77,7 @@ std::string gmshEdge::getAdditionalInfoString()
std::ostringstream sstream;
sstream << "{";
for(int i = 0; i < List_Nbr(c->Control_Points); i++){
if(i) sstream << ",";
if(i) sstream << " ";
Vertex *v;
List_Read(c->Control_Points, i, &v);
sstream << v->Num;
......
......@@ -393,7 +393,7 @@ void meshGEdge::operator() (GEdge *ge)
N = std::max(ge->minimumMeshSegments() + 1, (int)(a + 1.99));
}
// force odd number of points for if blossom is used for recombination
// force odd number of points if blossom is used for recombination
if(ge->meshAttributes.Method != MESH_TRANSFINITE &&
CTX::instance()->mesh.algoRecombine == 1 && N % 2 == 0){
if(/* 1 ||*/ CTX::instance()->mesh.recombineAll){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment