[cig-commits] r13716 - cs/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Dec 17 02:31:57 PST 2008


Author: luis
Date: 2008-12-17 02:31:57 -0800 (Wed, 17 Dec 2008)
New Revision: 13716

Modified:
   cs/cigma/trunk/src/core_extract_op.cpp
Log:
Updates to ExtractOp

 * More logging
 * Use &MeshPart::New and &Quadrature::New object factories

Modified: cs/cigma/trunk/src/core_extract_op.cpp
===================================================================
--- cs/cigma/trunk/src/core_extract_op.cpp	2008-12-17 10:31:56 UTC (rev 13715)
+++ cs/cigma/trunk/src/core_extract_op.cpp	2008-12-17 10:31:57 UTC (rev 13716)
@@ -23,12 +23,19 @@
 void ExtractOp::configure()
 {
     TRI_LOG_STR("ExtractOp::configure()");
+    TRI_LOG(mesh_info);
+    TRI_LOG(quadrature_info);
 
     if (!mesh)
     {
         //mesh = ReadMeshPart(mesh_info);
+
+        /*
         mesh = shared_ptr<MeshPart>(new MeshPart);
         mesh->setPath(mesh_info.p_mesh);
+        */
+
+        mesh = MeshPart::New(mesh_info);
     }
     if (!mesh)
     {
@@ -42,25 +49,56 @@
     if (!quadrature)
     {
         //quadrature = ReadQuadrature(quadrature_info);
+
+        /*
         quadrature = shared_ptr<Quadrature>(new Quadrature);
 
         if (quadrature_info.cell_type_name == "")
         {
+            quadrature->setCellType(mesh->getCellType());
             quadrature->setPath(quadrature_info.p_quadrature);
-            quadrature->setCellType(mesh->getCellType());
         }
         else
         {
             quadrature->setCell(quadrature_info.cell_type_name);
+        }*/
+
+        if (quadrature_info.cell_type_name == "")
+        {
+            quadrature_info.cell_type_name = Cell::type2string(mesh->getCellType());
         }
+        quadrature = Quadrature::New(quadrature_info);
     }
     if (!quadrature)
     {
         string msg("Uninitialized quadrature");
+
+        if (mesh->getCellType() == Cell::NONE)
+        {
+            msg = "No mesh cell type was specified";
+        }
+
         throw cigma::Exception("ExtractOp::configure", msg);
     }
     assert(quadrature);
 
+    if (mesh->getCellType() == Cell::NONE)
+    {
+        mesh->setCellType(quadrature->getCellType());
+    }
+
+    if (mesh->getCellType() != quadrature->getCellType())
+    {
+        std::ostringstream stream;
+        string mcell = Cell::type2string(mesh->getCellType());
+        string qcell = Cell::type2string(quadrature->getCellType());
+        if (mcell == "") { mcell = "none"; }
+        if (qcell == "") { qcell = "none"; }
+        stream << "Mismatch between mesh cell type "
+               << "(" << mcell << ") and quadrature cell type "
+               << "(" << qcell << ")" << std::ends;
+        throw cigma::Exception("ExtractOp::configure", stream.str());
+    }
     return;
 }
 
@@ -82,11 +120,21 @@
     const int nq = quadrature->n_points();
     const int q_ndim = quadrature->n_dim();
 
+    TRI_LOG(Cell::type2string(mesh->getCellType()));
+    TRI_LOG(Cell::type2string(quadrature->getCellType()));
+    TRI_LOG(mesh->coords->n_points());
+    TRI_LOG(mesh->coords->n_dim());
+    TRI_LOG(mesh->connect->n_cells());
+    TRI_LOG(mesh->connect->n_dofs());
+    TRI_LOG(quadrature->n_points());
+    TRI_LOG(quadrature->n_dim());
     assert(ndim == q_ndim);
 
     // allocate enough space for points & weights
     weights.reinit(nel*nq, 1);
     points.reinit(nel*nq, ndim);
+    TRI_LOG(points.n_points());
+    TRI_LOG(points.n_dim());
 
     //weights.init_value(1);
     //points.init_value(2);



More information about the CIG-COMMITS mailing list