[cig-commits] r13559 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Tue Dec 9 18:14:19 PST 2008
Author: luis
Date: 2008-12-09 18:14:19 -0800 (Tue, 09 Dec 2008)
New Revision: 13559
Modified:
cs/cigma/trunk/src/core_compare_op.cpp
Log:
Removed comments, and using dynamic casts to check fn types
Modified: cs/cigma/trunk/src/core_compare_op.cpp
===================================================================
--- cs/cigma/trunk/src/core_compare_op.cpp 2008-12-10 02:14:18 UTC (rev 13558)
+++ cs/cigma/trunk/src/core_compare_op.cpp 2008-12-10 02:14:19 UTC (rev 13559)
@@ -27,78 +27,54 @@
void CompareOp::configure()
{
- TRI_LOG_STR("CompareOp::configure()");
+ TRI_LOG_STR("CompareOp::configure");
+ // Read integration mesh
+ if (!domain)
+ {
+ if (domain_info)
+ {
+ domain = Field::NewField(domain_info);
+ }
+ }
+
+ // Read first function
if (!first)
{
first = Function::NewFunction(first_info);
- /*
- if (first_name != "")
+ if (!first)
{
- first = Function::New(first_name.c_str());
+ string msg("First field not specified");
+ throw cigma::Exception("CompareOp::configure", msg);
}
- else
+
+ if (dynamic_cast<cigma::Field*>(&(*first)))
{
- //first = ReadField(first_info);
- shared_ptr<Field> field(new Field);
- field->setDofsPath(first_info.p_field);
- field->setMeshPath(first_info.mesh_info.p_mesh);
- field->setCell(first_info.fe_info.q_info.cell_type_name); // XXX: inherit from mesh
- first = field;
+ cout << "First function is a cigma::Field" << endl;
+ // XXX: if domain is not set, steal mesh from first
}
- // */
}
- if (!first)
- {
- string msg("First field not specified");
- throw cigma::Exception("CompareOp::configure", msg);
- }
-
if (!second)
{
second = Function::NewFunction(second_info);
- /*
- if (second_name != "")
+ if (!second)
{
- second = Function::New(second_name.c_str());
+ string msg("Second field not specified");
+ throw cigma::Exception("CompareOp::configure", msg);
}
- else
+
+ if (dynamic_cast<cigma::Field*>(&(*second)))
{
- //second = ReadField(second_info);
- shared_ptr<Field> field(new Field);
- field->setDofsPath(second_info.p_field);
- field->setMeshPath(second_info.mesh_info.p_mesh);
- field->setCell(second_info.fe_info.q_info.cell_type_name); // XXX: inherit from mesh?
- second = field;
+ cout << "Second function is a Field!" << endl;
+ // XXX: if domain is not set, steal mesh from second
}
- // */
}
- if (!second)
- {
- string msg("Second field not specified");
- throw cigma::Exception("CompareOp::configure", msg);
- }
if (!domain)
{
- // XXX: check first and second for a mesh object and assign from there
- //
-
- domain = Field::NewField(domain_info);
-
- /*
- //domain = ReadField(domain_info);
- shared_ptr<Field> field(new Field);
- field->setMeshPath(domain_info.mesh_info.p_mesh);
- field->setCell(domain_info.fe_info.q_info.cell_type_name);
- domain = field;
- */
- }
- if (!domain)
- {
string msg("Integration mesh not specified");
throw cigma::Exception("CompareOp::configure", msg);
}
@@ -110,24 +86,28 @@
assert(domain->fe->cell);
assert(domain->fe->quadrature);
- if (first_info.fn_name == "zero")
+ if (dynamic_cast<cigma::ZeroFunction*>(&(*first)))
{
+ cout << "First function is a cigma::ZeroFunction" << endl;
ZeroFunction *fn = static_cast<ZeroFunction*>(&(*first));
fn->setShape(second->n_dim(), second->n_rank());
}
- if (first_info.fn_name == "one")
+ else if (dynamic_cast<cigma::UnitScalarFn*>(&(*first)))
{
+ cout << "First function is a cigma::UnitScalarFn" << endl;
UnitScalarFn *fn = static_cast<UnitScalarFn*>(&(*first));
fn->setDim(second->n_dim());
}
- if (second_info.fn_name == "zero")
+ if (dynamic_cast<cigma::ZeroFunction*>(&(*second)))
{
+ cout << "Second function is a cigma::ZeroFunction" << endl;
ZeroFunction *fn = static_cast<ZeroFunction*>(&(*second));
fn->setShape(first->n_dim(), first->n_rank());
}
- if (second_info.fn_name == "one")
+ else if (dynamic_cast<cigma::UnitScalarFn*>(&(*second)))
{
+ cout << "Second function is a cigma::UnitScalarFn" << endl;
UnitScalarFn *fn = static_cast<UnitScalarFn*>(&(*second));
fn->setDim(first->n_dim());
}
More information about the CIG-COMMITS
mailing list