Exemplo n.º 1
0
  MEField<> *FieldReg::RegisterField(const std::string &name, const MEFamily &mef,
				     UInt obj_type, const Context &ctxt, 
				     UInt dim, bool out, 
				     bool interp,
				     const _fieldTypeBase &ftype)
  {

    if (is_committed)
      Throw() << "FieldReg is already committed when registering:" << name;

    FMapType::iterator fi = fmap.lower_bound(name);

    MEField<> *nf;
    if (fi == fmap.end() || fi->first != name) {
      // Create the new field
      nf = new MEField<>(name, mef, obj_type, ctxt, dim, out, interp, ftype);
      fmap.insert(fi, std::make_pair(name, nf));
      Fields.push_back(nf);
    } else {
      // Check. If specs match, then just return the fields, otherwise
      // throw error.
      nf = fi->second;
    
      // TODO: a more thourough check of specs (context, etc...)
      if (obj_type != nf->ObjType() || dim != nf->dim())
	Throw() << "MEField name:" << name << " already registered, with different specs";
    }

    return nf;
  }
Exemplo n.º 2
0
// MEField<SField> specialization
MEField<SField>::MEField(MEField<_field> &rhs) :
MEFieldBase(rhs.name(), rhs.GetMEFamily(), rhs.ObjType(), rhs.GetContext(), rhs.dim(), false, false, rhs.FType()),
primaryfield(NULL),
f(rhs),
dof_buffer(0)
{
  primaryfield = new SField(*rhs.Getfield());
  
  MEFieldBase::ordinal = rhs.ordinal;
  
}