52 ModuleKey ProcessAddCompositeID::className =
55 ProcessAddCompositeID::create,
56 "Add a field which contains the composite ID of each element");
71 if (
m_f->m_comm->GetRank() == 0)
73 cout <<
"ProcessAddCompositeID: Adding composite ID as a new field"
79 int NumHomogeneousDir = 0;
82 if (
m_f->m_fielddef.size())
84 nfields =
m_f->m_fielddef[0]->m_fields.size();
85 NumHomogeneousDir =
m_f->m_fielddef[0]->m_numHomogeneousDir;
87 m_f->m_exp.resize(nfields + 1);
88 exp =
m_f->AppendExpList(NumHomogeneousDir,
"Composite ID");
90 m_f->m_exp[nfields] = exp;
99 m_f->m_graph->GetComposites();
105 for (
int n = 0; n < exp->GetNumElmts(); ++n)
110 for (it = CompositeMap.begin(); it != CompositeMap.end(); ++it)
112 if (
find(it->second->begin(), it->second->end(), elmt->GetGeom()) !=
121 "Failed to find composite ID for element: " +
122 boost::lexical_cast<
string>(n));
125 int npts = elmt->GetTotPoints();
128 tmp = exp->UpdatePhys() + exp->GetPhys_Offset(n), 1);
132 exp->FwdTrans_IterPerExp(exp->GetPhys(), exp->UpdateCoeffs());
134 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
135 m_f->m_exp[0]->GetFieldDefinitions();
136 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
139 for (
int i = 0; i < nfields; ++i)
141 for (
int j = 0; j < FieldDef.size(); ++j)
143 FieldDef[j]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[i]);
144 m_f->m_exp[i]->AppendFieldData(FieldDef[j], FieldData[j]);
149 for (
int j = 0; j < FieldDef.size(); ++j)
151 FieldDef[j]->m_fields.push_back(
"compositeID");
152 m_f->m_exp[nfields]->AppendFieldData(FieldDef[j], FieldData[j]);
155 m_f->m_fielddef = FieldDef;
156 m_f->m_data = FieldData;
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
pair< ModuleType, string > ModuleKey
virtual void Process(po::variables_map &vm)
Write mesh to output file.
boost::shared_ptr< Field > FieldSharedPtr
std::map< int, Composite >::const_iterator CompositeMapConstIter
#define WARNINGL0(condition, msg)
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
boost::shared_ptr< Expansion > ExpansionSharedPtr
std::map< int, Composite > CompositeMap
virtual ~ProcessAddCompositeID()
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Abstract base class for processing modules.
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.