After talking to Paul and looking at our first crack at the code, it's starting to become apparent that these two classes ought to be template-parameter-distinguished versions of the *same* class. There's just a ton of redundant code otherwise.
What we'd be doing would look something like template <typename OutputType> class FEGenericBase {...}; typedef FEGenericBase<Real> FEBase; typedef FEGenericBase<RealGradient> FEVectorBase; Which would then allow us to add a default template parameter to FE giving something like template <unsigned int Dim, FEFamily T, typename OutputType=FEGenericBase<OutputOf<T>::type> class FE : public FEBase {...}; We'd need a few helper metafunctions to get things like typeof(GradientOf<Real>::type) == typeof(Gradient) correct, so instead of e.g., dphi being a vector<vector<RealGradient> > in one case and vec<vec<RealTensor> > in another, we'd have: std::vector<std::vector<GradientOf<OutputType>::type> > dphi; And we'd use an if/else metafunction to make sure that data arrays which only make sense for vector-valued types don't take up any space in scalar-valued elements: IfElse<IsVector<T>::value, std::vector<std::vector<OutputType> >, NullType> curl_phi; Thoughts? The main advantage of this design is that it ought to save us a lot of code copy-and-paste-and-tweak, and may also make some of the library projection type codes simpler. It would also make it much easier to add tensor-valued, symmetric-tensor-valued, etc. elements if people want to do fancy solid mechanics formulations some day. The main disadvantage is that it would make for uglier FE error messages in gdb. Only *slightly* uglier, at that - I used the word "metafunction" above, but anyone familiar with metaprogramming for PECOS should be reassured that for libMesh I'm talking about simple idioms like we already have in our numerics/ classes, not any of that recursive functional compile-time algorithm stuff that produces eldritch compiler error messages. --- Roy ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel