Ejemplo n.º 1
0
void curvature::applyFilter(RichParameterSet *pars)
{
	Eigen::MatrixXd V(mesh()->n_vertices(), 3);
	Eigen::MatrixXi F(mesh()->n_faces(), 3);

	Eigen::MatrixXd NV(mesh()->n_vertices(), 3);
	Eigen::MatrixXd NF(mesh()->n_faces(), 3);

	Vector3VertexProperty points = mesh()->vertex_coordinates();
	Vector3VertexProperty normals = mesh()->vertex_normals(true);
	Vector3FaceProperty fnormals = mesh()->face_normals(true);

	// Fill in vertices
	int vi = 0;
	foreach(Vertex v, mesh()->vertices()) { V.row(vi) = points[v]; NV.row(vi) = normals[v]; vi++; }
Ejemplo n.º 2
0
SpatialMarkup
SpatialConvex::triangleTest(uint64 id)
{
  SpatialMarkup mark;
//
// do the face test on the triangle

  mark =  testNode(V(NV(0)),V(NV(1)),V(NV(2)));

// do we have a final result code?
// if rEJECT, fULL then return

  if(mark > fULL) return mark;

  if(mark == fULL) {
      fillChildren(id); // propagate final result to children
      return mark;
  }

// if pARTIAL or dONTKNOW, then continue, test children,
//    but do not reach beyond the leaf nodes.
//    If Convex is fully contained within one (sWALLOWED),
//    we can stop looking further in another child

  if (NC(id,0)!=0) {
    triangleTest(NC(id,0));
    triangleTest(NC(id,1));
    triangleTest(NC(id,2));
    triangleTest(NC(id,3));
// we are at the leafnodes
// If we have to recurse further, calculate intersections one by one
// If not, just set the proper bit in partial_ or append id to plist_.
  } else {
    if(addlevel_) {
      // from now on, continue to build the triangles dynamically.
      // until maxlevel_ levels depth.
      testPartial(addlevel_, N(id).id_, V(NV(0)), V(NV(1)), V(NV(2)));

    } else {
      if(bitresult_)
	partial_->set((uint32)index_->leafNumberById(N(id).id_),true);
      else
	plist_->append(N(id).id_);
    }
  }

  return mark;
}
Ejemplo n.º 3
0
#include "tool_easysrc.h"
#include "tool_setopt.h"

#include "memdebug.h" /* keep this as LAST include */

/* Lookup tables for converting setopt values back to symbols */
/* For enums, values may be in any order. */
/* For bit masks, put combinations first, then single bits, */
/* and finally any "NONE" value. */

#define NV(e) {#e, e}
#define NV1(e, v) {#e, (v)}
#define NVEND {NULL, 0}         /* sentinel to mark end of list */

const NameValue setopt_nv_CURLPROXY[] = {
  NV(CURLPROXY_HTTP),
  NV(CURLPROXY_HTTP_1_0),
  NV(CURLPROXY_SOCKS4),
  NV(CURLPROXY_SOCKS5),
  NV(CURLPROXY_SOCKS4A),
  NV(CURLPROXY_SOCKS5_HOSTNAME),
  NVEND,
};

const NameValueUnsigned setopt_nv_CURLAUTH[] = {
  NV(CURLAUTH_ANY),             /* combination */
  NV(CURLAUTH_ANYSAFE),         /* combination */
  NV(CURLAUTH_BASIC),
  NV(CURLAUTH_DIGEST),
  NV(CURLAUTH_GSSNEGOTIATE),
  NV(CURLAUTH_NTLM),
Ejemplo n.º 4
0
int64 CountTriangles2(const PNGraph &Graph) {
  struct timeval start, end;
  float delta;
  TTmProfiler Profiler;
  int TimerId = Profiler.AddTimer("Profiler");
  const int NNodes = Graph->GetNodes();

  TIntV MapV(NNodes);
  TVec<TNGraph::TNodeI> NV(NNodes);
  NV.Reduce(0);

  Profiler.ResetTimer(TimerId);
  Profiler.StartTimer(TimerId);
  gettimeofday(&start, NULL);

  int MxId = -1;
  int ind = 0;
  for (TNGraph::TNodeI NI = Graph->BegNI(); NI < Graph->EndNI(); NI++)   {
    NV.Add(NI);
    int Id = NI.GetId();
    if (Id > MxId) {
      MxId = Id;
    }
    MapV[ind] = Id;
    ind++;
  }

  TIntV IndV(MxId+1);

  for (int j = 0; j < NNodes; j++) {
    IndV[MapV[j]] = j;
  }

  gettimeofday(&end, NULL);
  Profiler.StopTimer(TimerId);
  delta = ((end.tv_sec  - start.tv_sec) * 1000000u +
          end.tv_usec - start.tv_usec) / 1.e6;
  printf("__nodemap__\ttime %7.3f\tcpu %8.3f\n", delta, Profiler.GetTimerSec(TimerId));

  Profiler.ResetTimer(TimerId);
  Profiler.StartTimer(TimerId);
  gettimeofday(&start, NULL);

  ind = MapV.Len();

  Profiler.ResetTimer(TimerId);
  Profiler.StartTimer(TimerId);
  gettimeofday(&start, NULL);

  TVec<TIntV> HigherDegNbrV(ind);

  for (int i = 0; i < ind; i++) {
    HigherDegNbrV[i] = TVec<TInt>();
    HigherDegNbrV[i].Reserve(NV[i].GetDeg());
    HigherDegNbrV[i].Reduce(0);
  }

  gettimeofday(&end, NULL);
  Profiler.StopTimer(TimerId);
  delta = ((end.tv_sec  - start.tv_sec) * 1000000u +
            end.tv_usec - start.tv_usec) / 1.e6;
  printf("__valloc__\ttime %7.3f\tcpu %8.3f\n", delta, Profiler.GetTimerSec(TimerId));

  Profiler.ResetTimer(TimerId);
  Profiler.StartTimer(TimerId);
  gettimeofday(&start, NULL);

#pragma omp parallel for schedule(dynamic)
  for (TInt i = 0; i < ind; i++) {
    TNGraph::TNodeI NI = NV[i];
    //HigherDegNbrV[i] = TVec<TInt>();
    //HigherDegNbrV[i].Reserve(NI.GetDeg());
    //HigherDegNbrV[i].Reduce(0);

    GetMergeSortedV(HigherDegNbrV[i], NI);

    int k = 0;
    for (TInt j = 0; j < HigherDegNbrV[i].Len(); j++) {
      TInt Vert = HigherDegNbrV[i][j];
      TInt Deg = NV[IndV[Vert]].GetDeg();
      if (Deg > NI.GetDeg() ||
         (Deg == NI.GetDeg() && Vert > NI.GetId())) {
        HigherDegNbrV[i][k] = Vert;
        k++;
      }
    }
    HigherDegNbrV[i].Reduce(k);
  }

  gettimeofday(&end, NULL);
  Profiler.StopTimer(TimerId);
  delta = ((end.tv_sec  - start.tv_sec) * 1000000u +
            end.tv_usec - start.tv_usec) / 1.e6;
  printf("__sort__\ttime %7.3f\tcpu %8.3f\n", delta, Profiler.GetTimerSec(TimerId));

  Profiler.ResetTimer(TimerId);
  Profiler.StartTimer(TimerId);
  gettimeofday(&start, NULL);

  int64 cnt = 0;
#pragma omp parallel for schedule(dynamic) reduction(+:cnt)
  for (TInt i = 0; i < HigherDegNbrV.Len(); i++) {
    for (TInt j = 0; j < HigherDegNbrV[i].Len(); j++) {
      //TInt NbrInd = H.GetDat(HigherDegNbrV[i][j]);
      TInt NbrInd = IndV[HigherDegNbrV[i][j]];

      int64 num = GetCommon(HigherDegNbrV[i], HigherDegNbrV[NbrInd]);
      cnt += num;
    }
  }

  gettimeofday(&end, NULL);
  Profiler.StopTimer(TimerId);
  delta = ((end.tv_sec  - start.tv_sec) * 1000000u +
            end.tv_usec - start.tv_usec) / 1.e6;
  printf("__count__\ttime %7.3f\tcpu %8.3f\n", delta, Profiler.GetTimerSec(TimerId));

  return cnt;
}
Ejemplo n.º 5
0
/////////////TRIANGLETEST/////////////////////////////////
// testTrixel: this is the main test of a triangle vs a Convex.  It
// will properly mark up the flags for the triangular node[index], and
// all its children
SpatialMarkup
RangeConvex::testTrixel(uint64 id)
{
  SpatialMarkup mark;
  uint64 childID;
  uint64 tid;

  // const struct SpatialIndex::QuadNode &indexNode = index_->nodes_[id];
  const struct SpatialIndex::QuadNode *indexNode = &index_->nodes_[id];

  //
  // do the face test on the triangle

  // was: mark =  testNode(V(NV(0)),V(NV(1)),V(NV(2)));
  // changed to by Gyorgy Fekete. Overall Speedup approx. 2%

  mark = testNode(id); // was:(indexNode or  id);


  switch(mark){
  case fULL:
    tid = N(id).id_;

    saveTrixel(tid);  //was:  plist_->push_back(tid);
    // fillChildren(id); // [ed:NEW]

    return mark;
  case rEJECT:
    tid = N(id).id_;
    return mark;
  default:
    // if pARTIAL or dONTKNOW, then continue, test children,
    //    but do not reach beyond the leaf nodes.
    //    If Convex is fully contained within one (sWALLOWED),
    //    we can stop looking further in another child

    // #define NC(n,m)	index_->nodes_[(n)].childID_[(m)]	// the children n->m
    // childID = index_->nodes_[id].childID_[0];

    // Test how many of the four children are rejected?
    //
    // [ed:algo]
    //
    break;
  }

  // NEW NEW algorithm  Disabled when enablenew is 0
  //
  {
    childID = indexNode->childID_[0];
    if ( childID != 0){
      ////////////// [ed:split]
      tid = N(id).id_;
      childID = indexNode->childID_[0];  testTrixel(childID);
      childID = indexNode->childID_[1];  testTrixel(childID);
      childID = indexNode->childID_[2];  testTrixel(childID);
      childID = indexNode->childID_[3];  testTrixel(childID);
    } else { /// No children...
      if (addlevel_){
	testPartial(addlevel_, N(id).id_, V(NV(0)), V(NV(1)), V(NV(2)), 0);
      } else {
	saveTrixel(N(id).id_); // was: plist_->push_back(N(id).id_);
      }
    }
  } ///////////////////////////// END OF NEW ALGORITHM returns mark below;



  /* NEW NEW NEW
     If rejected, then we return [done]
     If full, then we list the id (propagate to children) [done]

     If partial, then we look ahead to see how many children are rejected.
     But ah, next iteration could benefit from having computed this already.

     If two chidlren are rejected, then we stop
     If one or 0 nodes are rejected, then we
  */
  return mark;
}
Ejemplo n.º 6
0
#include "tool_cfgable.h"
#include "tool_easysrc.h"
#include "tool_setopt.h"

#include "memdebug.h" /* keep this as LAST include */

/* Lookup tables for converting setopt values back to symbols */
/* For enums, values may be in any order. */
/* For bit masks, put combinations first, then single bits, */
/* and finally any "NONE" value. */

#define NV(e) {#e, e}
#define NVEND {NULL, 0}         /* sentinel to mark end of list */

const NameValue setopt_nv_CURLPROXY[] = {
  NV(CURLPROXY_HTTP),
  NV(CURLPROXY_HTTP_1_0),
  NV(CURLPROXY_SOCKS4),
  NV(CURLPROXY_SOCKS5),
  NV(CURLPROXY_SOCKS4A),
  NV(CURLPROXY_SOCKS5_HOSTNAME),
  NVEND,
};

const NameValue setopt_nv_CURLAUTH[] = {
  NV(CURLAUTH_ANY),             /* combination */
  NV(CURLAUTH_ANYSAFE),         /* combination */
  NV(CURLAUTH_BASIC),
  NV(CURLAUTH_DIGEST),
  NV(CURLAUTH_GSSNEGOTIATE),
  NV(CURLAUTH_NTLM),