[MOAB-dev] r5849 - MOAB/trunk/tools/mbcslam

iulian at mcs.anl.gov iulian at mcs.anl.gov
Thu Nov 1 22:55:37 CDT 2012


Author: iulian
Date: 2012-11-01 22:55:37 -0500 (Thu, 01 Nov 2012)
New Revision: 5849

Added:
   MOAB/trunk/tools/mbcslam/CslamUtils.cpp
   MOAB/trunk/tools/mbcslam/CslamUtils.hpp
   MOAB/trunk/tools/mbcslam/spec_visu_test.cpp
Removed:
   MOAB/trunk/tools/mbcslam/IntxUtils.cpp
   MOAB/trunk/tools/mbcslam/IntxUtils.hpp
Modified:
   MOAB/trunk/tools/mbcslam/Intx2Mesh.hpp
   MOAB/trunk/tools/mbcslam/Intx2MeshOnSphere.cpp
   MOAB/trunk/tools/mbcslam/Makefile.am
Log:
add utilities to create the visu mesh for a spectral element, also to 
project nodes on a sphere
rename IntxUtils as CslamUtils
add a dependency to mbcoupler because the spectral element is defined there.
it may move to a more central place.
 
add a test for this visu mesh

this visu mesh might evolve into a spectral element in moab (see yesterday
discusion). 

also, the way it was created is not the most efficient, but it is the easiest 
to implement. 
basically, compute the gl points, create nodes (for each gl point), mesh into
quads, and then MERGE :)

It would be probably more efficient to create "spectral" nodes on each edge 
first, then look at the orientation of each edge in each quad, create the 
interior nodes, and then mesh interior of each coarse quad.

It would avoid the merging step.

 


Added: MOAB/trunk/tools/mbcslam/CslamUtils.cpp
===================================================================
--- MOAB/trunk/tools/mbcslam/CslamUtils.cpp	                        (rev 0)
+++ MOAB/trunk/tools/mbcslam/CslamUtils.cpp	2012-11-02 03:55:37 UTC (rev 5849)
@@ -0,0 +1,580 @@
+/*
+ * CslamUtils.cpp
+ *
+ *  Created on: Oct 3, 2012
+ *      Author: iulian
+ */
+
+#include "CslamUtils.hpp"
+#include <math.h>
+// this is from mbcoupler; maybe it should be moved somewhere in moab src
+// right now, add a dependency to mbcoupler
+#include "ElemUtil.hpp"
+#include "moab/MergeMesh.hpp"
+
+namespace moab {
+// vec utilities that could be common between quads on a plane or sphere
+double dist2(double * a, double * b)
+{
+  double abx = b[0] - a[0], aby = b[1] - a[1];
+  return sqrt(abx * abx + aby * aby);
+}
+double area2D(double *a, double *b, double *c)
+{
+  // (b-a)x(c-a) / 2
+  return ((b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])) / 2;
+}
+int borderPointsOfXinY2(double * X, double * Y, int nsides, double * P, int side[4])
+{
+  // 2 triangles, 3 corners, is the corner of X in Y?
+  // Y must have a positive area
+  /*
+   */
+  int extraPoint = 0;
+  for (int i = 0; i < nsides; i++)
+  {
+    // compute twice the area of all 4 triangles formed by a side of Y and a corner of X; if one is negative, stop
+    double * A = X + 2 * i;
+
+    int inside = 1;
+    for (int j = 0; j < nsides; j++)
+    {
+      double * B = Y + 2 * j;
+
+      int j1 = (j + 1) % nsides;
+      double * C = Y + 2 * j1; // no copy of data
+


More information about the moab-dev mailing list