src/SubField/SubFieldAssign.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  *
00007  * Visit http://people.web.psi.ch/adelmann/ for more details
00008  *
00009  ***************************************************************************/
00010 
00011 #ifndef SUB_FIELD_ASSIGN_H
00012 #define SUB_FIELD_ASSIGN_H
00013 
00014 // include files
00015 #include "Field/Assign.h"
00016 
00017 // forward declarations
00018 template<class T, unsigned int Dim, class S> class SubBareField;
00019 
00020 
00021 /***************************************************************************
00022  Versions of the assign function used to assign values to a SubBareField
00023  in an expression.  SubFieldAssign uses information in SubFieldAssignDefs
00024  for specific definitions of for_each operations used in assign.
00025 
00026  So far, only the assign function for the simple case where everything is
00027  perfectly aligned is implemented ... to complete this, assign must handle
00028  assigments between non-conforming layouts which requires general
00029  communication.  Also, support will have to be added for:
00030    - Assigning single-element subfield's to scalars
00031    - Slice operations between fields of unequal dimension
00032  ***************************************************************************/
00033 
00034 
00036 // SubBareField = Expression 
00037 template<class T1, unsigned Dim, class S, class RHS, class OP>
00038 void
00039 assign(SubBareField<T1,Dim,S> a, RHS b, OP op, ExprTag<true>);
00040 
00041 
00043 // SubBareField = constant
00044 template<class T, unsigned D, class S, class OP>
00045 inline void
00046 assign(SubBareField<T,D,S> a, const T& b, OP op, ExprTag<true>) {
00047   assign(a, PETE_Scalar<T>(b), op, ExprTag<true>());
00048 }
00049 
00050 
00052 
00053 #define SUB_ASSIGNMENT_OPERATORS(FUNC,OP)                                \
00054                                                                          \
00055 template<class T, unsigned D, class S>                                   \
00056 inline void                                                              \
00057 FUNC(const SubBareField<T,D,S>& lhs, const T& rhs)                       \
00058 {                                                                        \
00059   assign(lhs,PETE_Scalar<T>(rhs), OP(),ExprTag<true>());                 \
00060 }
00061 
00062 
00063 SUB_ASSIGNMENT_OPERATORS(assign,OpAssign)
00064 SUB_ASSIGNMENT_OPERATORS(operator<<,OpAssign)
00065 SUB_ASSIGNMENT_OPERATORS(operator+=,OpAddAssign)
00066 SUB_ASSIGNMENT_OPERATORS(operator-=,OpSubtractAssign)
00067 SUB_ASSIGNMENT_OPERATORS(operator*=,OpMultipplyAssign)
00068 SUB_ASSIGNMENT_OPERATORS(operator/=,OpDivideAssign)
00069 SUB_ASSIGNMENT_OPERATORS(mineq,OpMinAssign)
00070 SUB_ASSIGNMENT_OPERATORS(maxeq,OpMaxAssign)
00071 
00072 #include "SubField/SubFieldAssign.cpp"
00073 
00074 #endif // SUB_FIELD_ASSIGN_H
00075 
00076 /***************************************************************************
00077  * $RCSfile: SubFieldAssign.h,v $   $Author: adelmann $
00078  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:33 $
00079  * IPPL_VERSION_ID: $Id: SubFieldAssign.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $ 
00080  ***************************************************************************/

Generated on Mon Jan 16 13:23:56 2006 for IPPL by  doxygen 1.4.6