[cig-commits] r13577 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Tue Dec 9 18:14:54 PST 2008
Author: luis
Date: 2008-12-09 18:14:54 -0800 (Tue, 09 Dec 2008)
New Revision: 13577
Modified:
cs/cigma/trunk/src/core_args.cpp
cs/cigma/trunk/src/core_args.h
Log:
Added operator<< to core_args classes
Modified: cs/cigma/trunk/src/core_args.cpp
===================================================================
--- cs/cigma/trunk/src/core_args.cpp 2008-12-10 02:14:53 UTC (rev 13576)
+++ cs/cigma/trunk/src/core_args.cpp 2008-12-10 02:14:54 UTC (rev 13577)
@@ -26,46 +26,30 @@
cell_type_name = other.cell_type_name;
}
-/*
-DataPath MeshInfo::get_nc_path() const
+MeshInfo::operator bool() const
{
- // allow override
- if (!p_nc.empty())
- {
- return p_nc;
- }
-
- DataPath path;
- if (!p_mesh.empty())
- {
- path.set_filename(p_mesh.filename());
- path.set_location(p_mesh.location() + "/coordinates");
- }
- return path;
+ return p_mesh || p_nc || p_eb || (cell_type_name != "");
}
-DataPath MeshInfo::get_eb_path() const
+
+std::ostream& operator<<(std::ostream& os, const MeshInfo& mesh_info)
{
- // allow override
- if (!p_eb.empty())
- {
- return p_eb;
- }
- DataPath path;
- if (!p_mesh.empty())
+ if (mesh_info)
{
- path.set_filename(p_mesh.filename());
- path.set_location(p_mesh.location() + "/connectivity");
+ os << "M(";
+ if (mesh_info.p_mesh)
+ {
+ os << mesh_info.p_mesh;
+ }
+ else
+ {
+ os << mesh_info.p_nc << "," << mesh_info.p_eb;
+ }
+ os << ")";
}
- return path;
+ return os;
}
-// */
-MeshInfo::operator bool() const
-{
- return p_mesh || p_nc || p_eb || (cell_type_name != "");
-}
-
// ----------------------------------------------------------------------------
QuadratureInfo::QuadratureInfo() {}
@@ -87,37 +71,32 @@
cell_type_name = other.cell_type_name;
}
-/*
-bool QuadratureInfo::single_source() const
+QuadratureInfo::operator bool() const
{
- const bool q = !p_quadrature.empty();
- const bool no_w = p_weights.empty();
- const bool no_x = p_points.empty();
- return q && (no_w || no_x);
+ return p_quadrature || p_weights || p_points || (cell_type_name != "");
}
-bool QuadratureInfo::double_source() const
+std::ostream& operator<<(std::ostream& os, const QuadratureInfo& q_info)
{
- const bool w = !p_weights.empty();
- const bool x = !p_points.empty();
- const bool no_q = p_quadrature.empty();
- return no_q && (w && x);
+ if (q_info)
+ {
+ os << "Q(";
+ os << "'" << q_info.cell_type_name << "'";
+ if (q_info.p_quadrature)
+ {
+ os << "," << q_info.p_quadrature;
+ }
+ else if (q_info.p_weights || q_info.p_points)
+ {
+ os << "," << q_info.p_weights;
+ os << "," << q_info.p_points;
+ }
+ os << ")";
+ }
+ return os;
}
-// */
-/*
-QuadratureInfo::operator bool() const
-{
- const bool s = this->single_source();
- const bool d = this->double_source();
- return (s && !d) || (!s && d);
-} // */
-QuadratureInfo::operator bool() const
-{
- return p_quadrature || p_weights || p_points || (cell_type_name != "");
-}
-
// ----------------------------------------------------------------------------
FE_Info::FE_Info() {}
@@ -142,6 +121,20 @@
return q_info || p_fe_basis || p_fe_basis_jet;
}
+std::ostream& operator<<(std::ostream& os, const FE_Info& fe_info)
+{
+ if (fe_info)
+ {
+ os << "FE(" << fe_info.q_info;
+ if (fe_info.p_fe_basis)
+ {
+ os << "," << fe_info.p_fe_basis;
+ }
+ os << ")";
+ }
+ return os;
+}
+
// ----------------------------------------------------------------------------
FieldInfo::FieldInfo() {}
@@ -166,6 +159,19 @@
return p_field || fe_info || mesh_info;
}
+std::ostream& operator<<(std::ostream& os, const FieldInfo& field_info)
+{
+ if (field_info)
+ {
+ os << "F(";
+ os << "'" << field_info.p_field << "'";
+ os << "," << field_info.mesh_info;
+ os << "," << field_info.fe_info;
+ os << ")";
+ }
+ return os;
+}
+
// ----------------------------------------------------------------------------
FunctionInfo::FunctionInfo() {}
@@ -183,4 +189,17 @@
field_info = other.field_info;
}
+std::ostream& operator<<(std::ostream& os, const FunctionInfo& function_info)
+{
+ if (function_info.fn_name != "")
+ {
+ os << function_info.fn_name;
+ }
+ else
+ {
+ os << function_info.field_info;
+ }
+ return os;
+}
+
// ----------------------------------------------------------------------------
Modified: cs/cigma/trunk/src/core_args.h
===================================================================
--- cs/cigma/trunk/src/core_args.h 2008-12-10 02:14:53 UTC (rev 13576)
+++ cs/cigma/trunk/src/core_args.h 2008-12-10 02:14:54 UTC (rev 13577)
@@ -1,6 +1,7 @@
#ifndef __CIGMA_CORE_ARGS_H__
#define __CIGMA_CORE_ARGS_H__
+#include <iostream>
#include "Exception.h"
#include "DataPath.h"
#include "Cell.h"
@@ -22,11 +23,6 @@
MeshInfo(const MeshInfo& other);
MeshInfo& operator=(const MeshInfo& other);
operator bool() const;
- //DataPath get_nc_path() const;
- //DataPath get_eb_path() const;
- //bool single_file() const;
- //FileReader::ReaderType get_nc_reader_type() const;
- //FileReader::ReaderType get_eb_reader_type() const;
};
@@ -42,12 +38,6 @@
QuadratureInfo(const QuadratureInfo& other);
QuadratureInfo& operator=(const QuadratureInfo& other);
operator bool() const;
- ////bool single_source() const;
- ////bool double_source() const;
- //DataPath get_weights_path() const;
- //DataPath get_points_path() const;
- //FileReader::ReaderType get_weights_reader_type() const;
- //FileReader::ReaderType get_points_reader_type() const;
};
@@ -91,5 +81,10 @@
}
+std::ostream& operator<<(std::ostream& os, const cigma::MeshInfo& mesh_info);
+std::ostream& operator<<(std::ostream& os, const cigma::QuadratureInfo& q_info);
+std::ostream& operator<<(std::ostream& os, const cigma::FE_Info& fe_info);
+std::ostream& operator<<(std::ostream& os, const cigma::FieldInfo& field_info);
+std::ostream& operator<<(std::ostream& os, const cigma::FunctionInfo& function_info);
#endif
More information about the CIG-COMMITS
mailing list