[cig-commits] r14091 - in cs/cigma/trunk: . src tests/libcigma tests/system

luis at geodynamics.org luis at geodynamics.org
Wed Feb 18 08:14:51 PST 2009


Author: luis
Date: 2009-02-18 08:14:51 -0800 (Wed, 18 Feb 2009)
New Revision: 14091

Modified:
   cs/cigma/trunk/.gitignore
   cs/cigma/trunk/Makefile.am
   cs/cigma/trunk/cigma.proj
   cs/cigma/trunk/src/Quadrature.cpp
   cs/cigma/trunk/src/Residuals.cpp
   cs/cigma/trunk/src/cli_compare_cmd.cpp
   cs/cigma/trunk/src/core_compare_op.cpp
   cs/cigma/trunk/src/core_extract_op.cpp
   cs/cigma/trunk/src/loc_bbox.cpp
   cs/cigma/trunk/src/loc_bbox.h
   cs/cigma/trunk/tests/libcigma/LocatorTest.cpp
   cs/cigma/trunk/tests/system/200-eval.sh
Log:
Misc updates

Modified: cs/cigma/trunk/.gitignore
===================================================================
--- cs/cigma/trunk/.gitignore	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/.gitignore	2009-02-18 16:14:51 UTC (rev 14091)
@@ -35,24 +35,37 @@
 
 # Ignore some files under examples
 /examples/strikeslipnog
+/examples/laplace1/laplace
 /examples/laplace1/solution-*
 /examples/laplace2/laplace
 /examples/laplace2/solution-*
-/examples/utils/triangle/triangle
-/examples/utils/triangle/showme
-/examples/utils/triangle/src
-/examples/utils/triangle/square1.*.*
-/examples/utils/triangle/square2.*.*
-/examples/utils/tetgen/tetgen1.4.2
-/examples/utils/tetgen/tetgen
-/examples/utils/tetgen/tetview-linux
-/examples/utils/tetgen/tet.*
-/examples/utils/tetgen/cube1.*.*
-/examples/utils/tetgen/cube2.*.*
-/examples/utils/tetgen/a.lua
-#/examples/utils/cubit
-#/examples/utils/cgal
+/examples/meshes/triangle/triangle
+/examples/meshes/triangle/showme
+/examples/meshes/triangle/src
+/examples/meshes/triangle/square1.*.*
+/examples/meshes/triangle/square2.*.*
+/examples/meshes/tetgen/tetgen1.4.2
+/examples/meshes/tetgen/tetgen
+/examples/meshes/tetgen/tetview-linux
+#/examples/meshes/tetgen/cube1.*.*
+#/examples/meshes/tetgen/cube2.*.*
+/examples/meshes/tetgen/*.*.edge
+/examples/meshes/tetgen/*.*.ele
+/examples/meshes/tetgen/*.*.face
+/examples/meshes/tetgen/*.*.neigh
+/examples/meshes/tetgen/*.*.node
+/examples/meshes/tetgen/*.*.vol
+/examples/meshes/tetgen/*.lua
+#/examples/meshes/cubit
+#/examples/meshes/cgal
 
+/examples/*.png
+/examples/pylith/ssnog-*
+/examples/pylith/results
+/examples/laplace1/res_*
+/examples/laplace1/cube*.vtk
+/examples/laplace1/square*.vtk
+
 # Autoconf patterns
 aclocal.m4
 configure

Modified: cs/cigma/trunk/Makefile.am
===================================================================
--- cs/cigma/trunk/Makefile.am	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/Makefile.am	2009-02-18 16:14:51 UTC (rev 14091)
@@ -5,6 +5,10 @@
 AUTOMAKE_OPTIONS = foreign
 ACLOCAL_AMFLAGS = -I ./config
 
+# Optimization flags
+CFLAGS='-g -O2'
+#CFLAGS='-g'
+
 # Main programs to build
 bin_PROGRAMS = cigma
 if COND_HDF5
@@ -154,8 +158,10 @@
 	src/Points.cpp \
 	src/Locator.h \
 	src/Locator.cpp \
-	src/AnnLocator.h \
-	src/AnnLocator.cpp \
+	src/loc_bbox.h \
+	src/loc_bbox.cpp \
+	src/loc_kdtree.h \
+	src/loc_kdtree.cpp \
 	src/Cell.h \
 	src/Cell.cpp \
 	src/fe_tet4.h \
@@ -216,6 +222,8 @@
 	src/io_text_writer.cpp \
 	src/core_args.h \
 	src/core_args.cpp \
+	src/core_info.h \
+	src/core_info.cpp \
 	src/core_misc.h \
 	src/core_misc.cpp \
 	src/core_readers.h \
@@ -314,10 +322,12 @@
 	src/cli_base_cmd.cpp \
 	src/cli_list_cmd.h \
 	src/cli_list_cmd.cpp \
-	src/cli_info_cmd.h \
-	src/cli_info_cmd.cpp \
 	src/cli_mesh_info_cmd.h \
 	src/cli_mesh_info_cmd.cpp \
+	src/cli_function_info_cmd.h \
+	src/cli_function_info_cmd.cpp \
+	src/cli_element_info_cmd.h \
+	src/cli_element_info_cmd.cpp \
 	src/cli_extract_cmd.h \
 	src/cli_extract_cmd.cpp \
 	src/cli_eval_cmd.h \
@@ -408,8 +418,6 @@
 	src/py_ElementBlock.cpp \
 	src/py_NodeCoordinates.h \
 	src/py_NodeCoordinates.cpp \
-	src/py_Locator.h \
-	src/py_Locator.cpp \
 	src/py_MeshPart.h \
 	src/py_MeshPart.cpp \
 	src/py_FE.h \

Modified: cs/cigma/trunk/cigma.proj
===================================================================
--- cs/cigma/trunk/cigma.proj	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/cigma.proj	2009-02-18 16:14:51 UTC (rev 14091)
@@ -4,9 +4,7 @@
   configure.ac
   Makefile.am
   quick.sh
-  completion.sh
-  compare.py
-  rules.py
+  bash_completion.sh
  }
  doc {
   TODO
@@ -69,10 +67,14 @@
    cli_command.h
    cli_compare_cmd.cpp
    cli_compare_cmd.h
+   cli_element_info_cmd.cpp
+   cli_element_info_cmd.h
    cli_eval_cmd.cpp
    cli_eval_cmd.h
    cli_extract_cmd.cpp
    cli_extract_cmd.h
+   cli_function_info_cmd.cpp
+   cli_function_info_cmd.h
    cli_info_cmd.cpp
    cli_info_cmd.h
    cli_list_cmd.cpp
@@ -82,34 +84,6 @@
    cli_skel_cmd.cpp
    cli_skel_cmd.h
   }
-  fn=. filter="fn_*" {
-   fn_disloc3d.cpp
-   fn_disloc3d.h
-   fn_explicit.cpp
-   fn_explicit.h
-   fn_gale2.cpp
-   fn_gale2.h
-   fn_one.cpp
-   fn_one.h
-   fn_test.cpp
-   fn_test.h
-   fn_zero.cpp
-   fn_zero.h
-  }
-  fe=. filter="fe_*" {
-   fe_hex8.cpp
-   fe_hex8.h
-   fe_quad4.cpp
-   fe_quad4.h
-   fe_tet10.cpp
-   fe_tet10.h
-   fe_tet4.cpp
-   fe_tet4.h
-   fe_tri3.cpp
-   fe_tri3.h
-   fe_tri6.cpp
-   fe_tri6.h
-  }
   io=. filter="io_*" {
    io_exo_reader.cpp
    io_exo_reader.h
@@ -142,6 +116,40 @@
    io_vtk_writer.cpp
    io_vtk_writer.h
   }
+  fn=. filter="fn_*" {
+   fn_disloc3d.cpp
+   fn_disloc3d.h
+   fn_explicit.cpp
+   fn_explicit.h
+   fn_gale2.cpp
+   fn_gale2.h
+   fn_one.cpp
+   fn_one.h
+   fn_test.cpp
+   fn_test.h
+   fn_zero.cpp
+   fn_zero.h
+  }
+  fe=. filter="fe_*" {
+   fe_hex8.cpp
+   fe_hex8.h
+   fe_quad4.cpp
+   fe_quad4.h
+   fe_tet10.cpp
+   fe_tet10.h
+   fe_tet4.cpp
+   fe_tet4.h
+   fe_tri3.cpp
+   fe_tri3.h
+   fe_tri6.cpp
+   fe_tri6.h
+  }
+  loc=. filter="loc_*" {
+   loc_bbox.cpp
+   loc_bbox.h
+   loc_kdtree.cpp
+   loc_kdtree.h
+  }
   core=. filter="core_*" {
    core_args.cpp
    core_args.h
@@ -155,6 +163,8 @@
    core_eval_op.h
    core_extract_op.cpp
    core_extract_op.h
+   core_info.cpp
+   core_info.h
    core_list_op.cpp
    core_list_op.h
    core_misc.cpp
@@ -165,8 +175,6 @@
    core_writers.h
   }
   core2 {
-   AnnLocator.cpp
-   AnnLocator.h
    Cell.cpp
    Cell.h
    CellIterator.h
@@ -250,9 +258,7 @@
    py_cigma_module.cpp
    py_cigma_setup.py
   }
-  all=src {
-   AnnLocator.cpp
-   AnnLocator.h
+  all=. {
    Cell.cpp
    Cell.h
    CellIterator.h
@@ -304,14 +310,20 @@
    cli_command.h
    cli_compare_cmd.cpp
    cli_compare_cmd.h
+   cli_element_info_cmd.cpp
+   cli_element_info_cmd.h
    cli_eval_cmd.cpp
    cli_eval_cmd.h
    cli_extract_cmd.cpp
    cli_extract_cmd.h
+   cli_function_info_cmd.cpp
+   cli_function_info_cmd.h
    cli_info_cmd.cpp
    cli_info_cmd.h
    cli_list_cmd.cpp
    cli_list_cmd.h
+   cli_mesh_info_cmd.cpp
+   cli_mesh_info_cmd.h
    cli_skel_cmd.cpp
    cli_skel_cmd.h
    core_args.cpp
@@ -326,6 +338,8 @@
    core_eval_op.h
    core_extract_op.cpp
    core_extract_op.h
+   core_info.cpp
+   core_info.h
    core_list_op.cpp
    core_list_op.h
    core_misc.cpp
@@ -340,10 +354,14 @@
    fe_hex8.h
    fe_quad4.cpp
    fe_quad4.h
+   fe_tet10.cpp
+   fe_tet10.h
    fe_tet4.cpp
    fe_tet4.h
    fe_tri3.cpp
    fe_tri3.h
+   fe_tri6.cpp
+   fe_tri6.h
    fn_disloc3d.cpp
    fn_disloc3d.h
    fn_explicit.cpp
@@ -388,6 +406,10 @@
    io_vtk_reader.h
    io_vtk_writer.cpp
    io_vtk_writer.h
+   loc_bbox.cpp
+   loc_bbox.h
+   loc_kdtree.cpp
+   loc_kdtree.h
    nc_array.cpp
    nc_array.h
    nullstream.hpp
@@ -431,11 +453,9 @@
    py_Residuals.h
    py_cigma_module.cpp
    py_cigma_setup.py
-   tags
    tri_logger.cpp
    tri_logger.hpp
    vtk-residuals.cpp
-   cscope.out
   }
  }
  tests=tests flags=r {

Modified: cs/cigma/trunk/src/Quadrature.cpp
===================================================================
--- cs/cigma/trunk/src/Quadrature.cpp	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/src/Quadrature.cpp	2009-02-18 16:14:51 UTC (rev 14091)
@@ -33,7 +33,7 @@
 
     shared_ptr<Quadrature> Q;
 
-    if (cell_type == Cell::TET4)
+    if ((cell_type == Cell::TET4) || (cell_type == Cell::TET10))
     {
         // tet4_qr(3)
         const int nno = 8;

Modified: cs/cigma/trunk/src/Residuals.cpp
===================================================================
--- cs/cigma/trunk/src/Residuals.cpp	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/src/Residuals.cpp	2009-02-18 16:14:51 UTC (rev 14091)
@@ -1,4 +1,5 @@
 #include "Residuals.h"
+#include <iostream>
 #include <cassert>
 #include <cmath>
 #include <limits>

Modified: cs/cigma/trunk/src/cli_compare_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_compare_cmd.cpp	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/src/cli_compare_cmd.cpp	2009-02-18 16:14:51 UTC (rev 14091)
@@ -55,8 +55,8 @@
         ("rule-weights", po::value<string>(&qw), "...integration weights on reference cell")
         ("rule-points", po::value<string>(&qx), "...integration points on reference cell")
         ("do-not-overwrite", "Do NOT overwrite existing data")
-        ("timer-frequency,f", po::value<int>(&(op.freq)), "Output frequency of timer")
-        ("threshold", po::value<double>(&threshold), "Threshold value for global residual")
+        ("timer-frequency,t", po::value<int>(&(op.freq)), "Output frequency of timer")
+        ("global-threshold,g", po::value<double>(&threshold), "Threshold value for global residual")
         ;
 
     // define positional arguments
@@ -92,13 +92,13 @@
         throw cigma::Exception("CompareCmd::configure", msg, 1);
     }
 
-    if (!vm.count("output"))
-    {
-        string msg("No output file for residuals was specified (use --output option)");
-        throw cigma::Exception("CompareCmd::configure", msg, 1);
-    }
+    //if (!vm.count("output"))
+    //{
+    //    string msg("No output file for residuals was specified (use --output option)");
+    //    throw cigma::Exception("CompareCmd::configure", msg, 1);
+    //}
 
-    if (!vm.count("threshold"))
+    if (!vm.count("global-threshold"))
     {
         threshold = std::numeric_limits<double>::infinity();
     }
@@ -139,6 +139,7 @@
     op.domain_info.mesh_info.p_nc = DataPath(nc);
     op.domain_info.mesh_info.p_eb = DataPath(eb);
     op.domain_info.mesh_info.cell_type_name = cell;
+    op.domain_info.mesh_info.use_locator = false;
     op.domain_info.fe_info.q_info.p_quadrature = DataPath(rule);
     op.domain_info.fe_info.q_info.p_weights = DataPath(qw);
     op.domain_info.fe_info.q_info.p_points = DataPath(qx);
@@ -162,6 +163,7 @@
     double L2 = op.residuals->L2();
     double relative_L2 = op.residuals->relative_L2();
     double volume = op.residuals->mesh->getVolume();
+    double L2_vol = L2/volume;
     double h = op.residuals->mesh->getMaxCellDiameter();
     //double h1 = op.first->getMaxCellDiameter();
     //double h2 = op.second->getMaxCellDiameter();
@@ -177,20 +179,30 @@
 
     if (op.verbose)
     {
-        // report errors
-        cout << setprecision(12) << endl;
+        cout << setprecision(12);
+
+        // report global error metrics
+        cout << endl;
         cout << "Summary of comparison: " << endl;
         cout << "  L2   = " << L2 << endl;
         cout << "  Linf = " << Linf << endl;
-        cout << "  sqrt((L2)^2/volume) = " << relative_L2 << endl;
-        cout << "  volume of domain    = " << volume << endl;
+        cout << "  L2/volume = " << L2_vol << endl;
+        cout << "  sqrt((L2)^2/volume)    = " << relative_L2 << endl;
+        cout << "  total volume of domain = " << volume << endl;
         cout << endl;
 
-        // write out data
-        cout << "Creating file " << path.filename() << endl;
     }
 
-    WriteResiduals(path, op.residuals, !vm.count("do-not-overwrite"));
+    if (vm.count("output"))
+    {
+        if (op.verbose)
+        {
+            // write out data
+            cout << "Creating file " << path.filename() << endl;
+        }
+        const bool normalize = false;
+        WriteResiduals(path, op.residuals, normalize, !vm.count("do-not-overwrite"));
+    }
 
     return status;
 }

Modified: cs/cigma/trunk/src/core_compare_op.cpp
===================================================================
--- cs/cigma/trunk/src/core_compare_op.cpp	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/src/core_compare_op.cpp	2009-02-18 16:14:51 UTC (rev 14091)
@@ -11,6 +11,7 @@
 #include <cassert>
 #include <string>
 #include <sstream>
+#include <valarray>
 #include <boost/shared_ptr.hpp>
 
 using namespace std;
@@ -62,28 +63,48 @@
     if (!domain)
     {
         TRI_LOG_STR(">> Configuring integration mesh");
+
         if (domain_info)
         {
             domain = Field::NewField(domain_info);
         }
-        else
+    
+        if (!domain || !(domain->mesh))
         {
-            TRI_LOG_STR(">>> No mesh information was given");
+            TRI_LOG_STR(">>> No integration mesh was given");
             if (dynamic_cast<cigma::Field*>(&(*first)))
             {
-                TRI_LOG_STR(">>> Taking mesh from first Field");
+                TRI_LOG_STR(">>> Taking integration mesh from first Field");
+                
                 Field *field = static_cast<Field*>(&(*first));
-                domain       = shared_ptr<Field>(new Field);
-                domain->mesh = field->mesh;
-                domain->fe   = shared_ptr<FE>(new FE(field->mesh->getCellType()));
+
+                if (!domain)
+                {
+                    domain = shared_ptr<Field>(new Field);
+                }
+                
+                if (!(domain->mesh))
+                {
+                    domain->mesh = field->mesh;
+                    domain->fe   = shared_ptr<FE>(new FE(field->mesh->getCellType()));
+                }
             }
             else if (dynamic_cast<cigma::Field*>(&(*second)))
             {
-                TRI_LOG_STR(">>> Taking mesh from second Field");
+                TRI_LOG_STR(">>> Taking integration mesh from second Field");
+
                 Field *field = static_cast<Field*>(&(*second));
-                domain       = shared_ptr<Field>(new Field);
-                domain->mesh = field->mesh;
-                domain->fe   = shared_ptr<FE>(new FE(field->mesh->getCellType()));
+                
+                if (!domain)
+                {
+                    domain = shared_ptr<Field>(new Field);
+                }
+
+                if (!(domain->mesh))
+                {
+                    domain->mesh = field->mesh;
+                    domain->fe   = shared_ptr<FE>(new FE(field->mesh->getCellType()));
+                }
             }
         }
 
@@ -171,8 +192,8 @@
     assert(domain->fe);
     assert(domain->fe->cell);
     assert(domain->fe->quadrature);
-    assert(domain->fe->jxw != 0);
-    assert(domain->fe->basis_tab != 0);
+    assert(domain->fe->jxw.size() != 0);
+    assert(domain->fe->basis_tab.size() != 0);
 
     // convenient references
     shared_ptr<MeshPart> mesh = domain->mesh;
@@ -194,9 +215,15 @@
     residuals->setMesh(domain->mesh);
     residuals->reset();
 
+    //if (mesh->volume.size() == 0)
+    //{
+    //    mesh->computeCellVolumes();
+    //}
+    //valarray<double>& vol = mesh->volume;
+
     if (verbose)
     {
-        cout << timer.header("elts");
+        cout << timer.header("cells");
         cout << setprecision(5);
         cout << timer.start(nel);
     }
@@ -226,8 +253,10 @@
         for (q = 0; q < nq; q++)
         {
             double *globalPoint = &qpts[q*3];
-            first->eval(globalPoint, &vals1[q*nval]);
-            second->eval(globalPoint, &vals2[q*nval]);
+            bool found1 = first->eval(globalPoint, &vals1[q*nval]);
+            bool found2 = second->eval(globalPoint, &vals2[q*nval]);
+            //cigma_assert(found1);
+            //cigma_assert(found2);
         }
 
         // calculate norms on local cell

Modified: cs/cigma/trunk/src/core_extract_op.cpp
===================================================================
--- cs/cigma/trunk/src/core_extract_op.cpp	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/src/core_extract_op.cpp	2009-02-18 16:14:51 UTC (rev 14091)
@@ -121,8 +121,8 @@
     fe->init(quadrature);
     assert(fe->cell);
     assert(fe->quadrature);
-    assert(fe->jxw != 0);
-    assert(fe->basis_tab != 0);
+    assert(fe->jxw.size() != 0);
+    assert(fe->basis_tab.size() != 0);
 
     int i,j;
     double *global_qpts = new double[nq * 3];

Modified: cs/cigma/trunk/src/loc_bbox.cpp
===================================================================
--- cs/cigma/trunk/src/loc_bbox.cpp	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/src/loc_bbox.cpp	2009-02-18 16:14:51 UTC (rev 14091)
@@ -7,12 +7,13 @@
 using namespace cigma;
 using boost::shared_ptr;
 
+int BoundingBoxLocator::nnk = 10;
+
 BoundingBoxLocator::BoundingBoxLocator()
 {
     TRI_LOG_STR("BoundingBoxLocator::BoundingBoxLocator()");
 
     //nnk = 8;
-    nnk = 10;
     //nnk = 20;
 
     epsilon = 0;

Modified: cs/cigma/trunk/src/loc_bbox.h
===================================================================
--- cs/cigma/trunk/src/loc_bbox.h	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/src/loc_bbox.h	2009-02-18 16:14:51 UTC (rev 14091)
@@ -25,9 +25,10 @@
     int n_idx() const;
     int idx(int i) const;
 
+public:
+    static int nnk;     /// number of nearest neighbors
 
-public:
-    int nnk;            /// number of nearest neighbors
+private:
     int npts;           /// number of "points" (bounding boxes)
     int ndim;           /// dimension of single point
     int ndim2;          /// dimension of bounding box

Modified: cs/cigma/trunk/tests/libcigma/LocatorTest.cpp
===================================================================
--- cs/cigma/trunk/tests/libcigma/LocatorTest.cpp	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/tests/libcigma/LocatorTest.cpp	2009-02-18 16:14:51 UTC (rev 14091)
@@ -1,11 +1,12 @@
 #include "LocatorTest.h"
 using namespace libcigma;
 
-#include "AnnLocator.h"
+#include "Cell.h"
 #include "MeshPart.h"
 #include "nc_array.h"
 #include "eb_array.h"
-#include "Cell.h"
+#include "loc_bbox.h"
+#include "loc_kdtree.h"
 #include "io_text_reader.h"
 #include "core_readers.h"
 using namespace cigma;
@@ -40,7 +41,7 @@
     //
     // Initialize Locator
     //
-    shared_ptr<AnnLocator> locator(new AnnLocator);
+    shared_ptr<BoundingBoxLocator> locator(new BoundingBoxLocator);
     locator->init(*mesh);
 
 

Modified: cs/cigma/trunk/tests/system/200-eval.sh
===================================================================
--- cs/cigma/trunk/tests/system/200-eval.sh	2009-02-18 16:14:49 UTC (rev 14090)
+++ cs/cigma/trunk/tests/system/200-eval.sh	2009-02-18 16:14:51 UTC (rev 14091)
@@ -5,6 +5,6 @@
 ./cigma eval \
     --output=$D/system/out/200.h5:/values \
     --points=$D/data/brick1/brick1.h5:/coordinates \
-    --field=test.cube \
+    --function=test.cube \
     $*
 



More information about the CIG-COMMITS mailing list