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

luis at geodynamics.org luis at geodynamics.org
Tue Dec 9 18:15:02 PST 2008


Author: luis
Date: 2008-12-09 18:15:01 -0800 (Tue, 09 Dec 2008)
New Revision: 13581

Modified:
   cs/cigma/trunk/src/DofHandler.cpp
   cs/cigma/trunk/src/FE.cpp
   cs/cigma/trunk/src/Function.cpp
   cs/cigma/trunk/src/Quadrature.cpp
   cs/cigma/trunk/src/cli_compare_cmd.cpp
   cs/cigma/trunk/src/core_compare_op.cpp
Log:
Logging of info parameters

Modified: cs/cigma/trunk/src/DofHandler.cpp
===================================================================
--- cs/cigma/trunk/src/DofHandler.cpp	2008-12-10 02:14:57 UTC (rev 13580)
+++ cs/cigma/trunk/src/DofHandler.cpp	2008-12-10 02:15:01 UTC (rev 13581)
@@ -19,6 +19,7 @@
 
     if (dofs_path)
     {
+        TRI_LOG(dofs_path);
         dofs = shared_ptr<DofHandler>(new DofHandler);
         dofs->setPath(dofs_path);
     }

Modified: cs/cigma/trunk/src/FE.cpp
===================================================================
--- cs/cigma/trunk/src/FE.cpp	2008-12-10 02:14:57 UTC (rev 13580)
+++ cs/cigma/trunk/src/FE.cpp	2008-12-10 02:15:01 UTC (rev 13581)
@@ -156,6 +156,7 @@
     }
 
     quadrature->setPath2(p_weights, p_points);
+
 }
 
 

Modified: cs/cigma/trunk/src/Function.cpp
===================================================================
--- cs/cigma/trunk/src/Function.cpp	2008-12-10 02:14:57 UTC (rev 13580)
+++ cs/cigma/trunk/src/Function.cpp	2008-12-10 02:15:01 UTC (rev 13581)
@@ -12,7 +12,7 @@
 
 shared_ptr<Function> Function::New(std::string fn_name)
 {
-    TRI_LOG_STR("Function::New");
+    TRI_LOG_STR("Function::New()");
     TRI_LOG(fn_name);
 
     FunctionInfo info;
@@ -22,7 +22,8 @@
 
 shared_ptr<Function> Function::NewFunction(const FunctionInfo& fn_info)
 {
-    TRI_LOG_STR("Function::NewFunction");
+    TRI_LOG_STR("Function::NewFunction()");
+    TRI_LOG(fn_info);
 
     // XXX: if not found, try to instantiate Explicit, or load from shared library
 

Modified: cs/cigma/trunk/src/Quadrature.cpp
===================================================================
--- cs/cigma/trunk/src/Quadrature.cpp	2008-12-10 02:14:57 UTC (rev 13580)
+++ cs/cigma/trunk/src/Quadrature.cpp	2008-12-10 02:15:01 UTC (rev 13581)
@@ -143,39 +143,30 @@
 shared_ptr<Quadrature> Quadrature::New(const QuadratureInfo& q_info)
 {
     TRI_LOG_STR("Quadrature::New");
+    TRI_LOG(q_info);
 
     shared_ptr<Quadrature> Q;
 
     if (q_info.p_quadrature)
     {
-        //TRI_LOG(q_info.p_quadrature);
         Q = shared_ptr<Quadrature>(new Quadrature);
+        Q->cell_type = Cell::string2type(q_info.cell_type_name);
         Q->setPath(q_info.p_quadrature);
-        if (Q->cell_type == Cell::NONE)
-        {
-            Q->cell_type = Cell::string2type(q_info.cell_type_name);
-        }
         return Q;
     }
 
     if (q_info.p_weights && q_info.p_points)
     {
-        //TRI_LOG(q_info.p_weights);
-        //TRI_LOG(q_info.p_points);
         Q = shared_ptr<Quadrature>(new Quadrature);
+        Q->cell_type = Cell::string2type(q_info.cell_type_name);
         Q->setPath2(q_info.p_weights, q_info.p_points);
-        Q->cell_type = Cell::string2type(q_info.cell_type_name);
         return Q;
     }
 
     if (q_info.cell_type_name != "")
     {
-        //TRI_LOG(q_info.cell_type_name);
         Cell::type cell_type = Cell::string2type(q_info.cell_type_name);
-        if (cell_type != Cell::NONE)
-        {
-            Q = Quadrature::default_rule(cell_type);
-        }
+        Q = Quadrature::default_rule(cell_type);
     }
 
     return Q;
@@ -292,7 +283,8 @@
     if (wx == 0)
     {
         std::ostringstream stream;
-        stream << "Failed to read quadrature from path '" << p_quad << "'" << std::ends;
+        stream << "Failed to read quadrature from path '"
+               << p_quad << "'" << std::ends;
         throw cigma::Exception("Quadrature::setPath", stream.str());
     }
 
@@ -309,8 +301,17 @@
             this->setPoint(q, j, wx->data(q, 1+j));
         }
     }
+    delete wx;
 
-    delete wx;
+    // check points
+    if (!points_in_cell())
+    {
+        std::ostringstream stream;
+        stream << "Quadrature points not compatible with cell '";
+        stream << Cell::type2string(cell_type);
+        stream << "'" << std::ends;
+        throw cigma::Exception("Quadrature::setPath", stream.str());
+    }
 }
 
 void Quadrature::setPath2(const DataPath& p_weights, const DataPath& p_points)
@@ -324,7 +325,8 @@
     if (wts == 0)
     {
         std::ostringstream stream;
-        stream << "Failed to read quadrature weights from path '" << p_weights << "'" << std::ends;
+        stream << "Failed to read quadrature weights from path '"
+               << p_weights << "'" << std::ends;
         throw cigma::Exception("Quadrature::setPath2", stream.str());
     }
     this->weights = wts->_data;
@@ -336,12 +338,23 @@
     if (pts == 0)
     {
         std::ostringstream stream;
-        stream << "Failed to read quadrature points from path '" << p_points << "'" << std::ends;
+        stream << "Failed to read quadrature points from path '"
+               << p_points << "'" << std::ends;
         throw cigma::Exception("Quadrature::setPath2", stream.str());
     }
     this->points = pts->_data;
     pts->_data = 0;
     delete pts;
+
+    // check points
+    if (!points_in_cell())
+    {
+        std::ostringstream stream;
+        stream << "Quadrature points not compatible with cell '";
+        stream << Cell::type2string(cell_type);
+        stream << "'" << std::ends;
+        throw cigma::Exception("Quadrature::setPath2", stream.str());
+    }
 }
 
 void Quadrature::setCell(string cell_name)
@@ -356,7 +369,23 @@
         shared_ptr<Quadrature> Q = Quadrature::default_rule(cell_type);
         this->reinit(Q->npts, Q->ndim);
         this->setData(Q->points, Q->weights);
+
+        // check points
+        if (!points_in_cell())
+        {
+            std::ostringstream stream;
+            stream << "Quadrature points not compatible with cell ";
+            stream << "'" << cell_name << "'" << std::ends;
+            throw cigma::Exception("Quadrature::setCell", stream.str());
+        }
     }
+    else
+    {
+        std::ostringstream stream;
+        stream << "Could not instantiate cell '" << cell_name;
+        stream << "'" << std::ends;
+        throw cigma::Exception("Quadrature::setCell", stream.str());
+    }
 }
 
 // ----------------------------------------------------------------------------

Modified: cs/cigma/trunk/src/cli_compare_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_compare_cmd.cpp	2008-12-10 02:14:57 UTC (rev 13580)
+++ cs/cigma/trunk/src/cli_compare_cmd.cpp	2008-12-10 02:15:01 UTC (rev 13581)
@@ -76,7 +76,7 @@
         TRI_LOG_OFF();
     }
 
-    TRI_LOG_STR("CompareCmd::configure");
+    TRI_LOG_STR("CompareCmd::configure()");
 
     if (vm.count("verbose"))
     {
@@ -158,11 +158,6 @@
     }
 
     TRI_LOG_STR("CompareCmd::run()");
-    TRI_LOG(first);
-    TRI_LOG(second);
-    TRI_LOG(mesh);
-    TRI_LOG(mesh1);
-    TRI_LOG(mesh2);
     TRI_LOG(outputfile);
 
     DataPath path(outputfile);

Modified: cs/cigma/trunk/src/core_compare_op.cpp
===================================================================
--- cs/cigma/trunk/src/core_compare_op.cpp	2008-12-10 02:14:57 UTC (rev 13580)
+++ cs/cigma/trunk/src/core_compare_op.cpp	2008-12-10 02:15:01 UTC (rev 13581)
@@ -27,13 +27,16 @@
 
 void CompareOp::configure()
 {
-    TRI_LOG_STR("CompareOp::configure");
+    TRI_LOG_STR("CompareOp::configure()");
+    TRI_LOG(first_info);
+    TRI_LOG(second_info);
+    TRI_LOG(domain_info);
 
     // Read first function
     if (!first)
     {
+        TRI_LOG_STR(">> Configuring first function");
         first = Function::NewFunction(first_info);
-
         if (!first)
         {
             string msg("First field not specified");
@@ -44,8 +47,8 @@
     // Read second function
     if (!second)
     {
+        TRI_LOG_STR(">> Configuring second function");
         second = Function::NewFunction(second_info);
-
         if (!second)
         {
             string msg("Second field not specified");
@@ -57,33 +60,35 @@
     // Read integration mesh
     if (!domain)
     {
+        TRI_LOG_STR(">> Configuring integration mesh");
         if (domain_info)
         {
             domain = Field::NewField(domain_info);
         }
         else
         {
-            domain = shared_ptr<Field>(new Field);
-
+            TRI_LOG_STR(">>> No mesh information was given");
             if (dynamic_cast<cigma::Field*>(&(*first)))
             {
-                // steal mesh from first
-                TRI_LOG_STR(">> domain->mesh = first->mesh");
+                TRI_LOG_STR(">>> Taking mesh from first Field");
                 Field *field = static_cast<Field*>(&(*first));
+                domain = shared_ptr<Field>(new Field);
                 domain->mesh = field->mesh;
-                domain->fe = FE::New(first_info.field_info.fe_info);
+                domain->fe = field->fe;
+                //domain->fe = FE::New(first_info.field_info.fe_info); // XXX
             }
             else if (dynamic_cast<cigma::Field*>(&(*second)))
             {
-                // steal mesh from second
-                TRI_LOG_STR(">> domain->mesh = second->mesh");
+                TRI_LOG_STR(">>> Taking mesh from second Field");
                 Field *field = static_cast<Field*>(&(*second));
+                domain = shared_ptr<Field>(new Field);
                 domain->mesh = field->mesh;
-                domain->fe = FE::New(second_info.field_info.fe_info);
+                domain->fe = field->fe;
+                //domain->fe = FE::New(second_info.field_info.fe_info);
             }
         }
 
-        if (!(domain->mesh))
+        if (!domain || !(domain->mesh))
         {
             string msg("Integration mesh not specified");
             throw cigma::Exception("CompareOp::configure", msg);
@@ -91,7 +96,7 @@
 
         if (!(domain->fe))
         {
-            string msg("Cell type for integration mesh not specified");
+            string msg("Cell type for integration mesh was not specified");
             throw cigma::Exception("CompareOp::configure", msg);
         }
     }
@@ -106,13 +111,13 @@
     // Special cases for first function
     if (dynamic_cast<cigma::ZeroFn*>(&(*first)))
     {
-        TRI_LOG_STR("-- First function is a cigma::ZeroFn");
+        TRI_LOG_STR(">> First function is a cigma::ZeroFn");
         ZeroFn *fn = static_cast<ZeroFn*>(&(*first));
         fn->setShape(second->n_dim(), second->n_rank());
     }
     else if (dynamic_cast<cigma::UnitScalarFn*>(&(*first)))
     {
-        TRI_LOG_STR("-- First function is a cigma::UnitScalarFn");
+        TRI_LOG_STR(">> First function is a cigma::UnitScalarFn");
         UnitScalarFn *fn = static_cast<UnitScalarFn*>(&(*first));
         fn->setDim(second->n_dim());
     }
@@ -120,13 +125,13 @@
     // Special cases for second function
     if (dynamic_cast<cigma::ZeroFn*>(&(*second)))
     {
-        TRI_LOG_STR("-- Second function is a cigma::ZeroFn");
+        TRI_LOG_STR(">> Second function is a cigma::ZeroFn");
         ZeroFn *fn = static_cast<ZeroFn*>(&(*second));
         fn->setShape(first->n_dim(), first->n_rank());
     }
     else if (dynamic_cast<cigma::UnitScalarFn*>(&(*second)))
     {
-        TRI_LOG_STR("-- Second function is a cigma::UnitScalarFn");
+        TRI_LOG_STR(">> Second function is a cigma::UnitScalarFn");
         UnitScalarFn *fn = static_cast<UnitScalarFn*>(&(*second));
         fn->setDim(first->n_dim());
     }



More information about the CIG-COMMITS mailing list