MCPcopy Create free account
hub / github.com/FreeFem/FreeFem-sources / code2

Method code2

src/fflib/lgfem.cpp:5947–5984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5945 C_F0 code2(const basicAC_F0 &args) const;
5946 };
5947 C_F0 opDotR3::code2(const basicAC_F0 &args) const
5948 {
5949 bool ta =args[0].left()==atype<TransE_Array>();
5950 bool tb =args[1].left()==atype<E_Array>();
5951 ffassert(ta == !tb);
5952 const TransE_Array * tea=0;
5953 const E_Array * ea=0;
5954 C_F0 b= ta ? args[1] : args[0] ; // N
5955 if( ta) tea = dynamic_cast<const TransE_Array*>((Expression) args[0]);
5956 if( tb) ea = dynamic_cast<const E_Array*>((Expression) args[1]);
5957
5958 ffassert( ea || tea );
5959 const E_Array & a= ta ? *tea->v : *ea;
5960 int na=a.size();
5961 int nb=na;
5962 if(na <1 || na > 3 ) CompileError(" bad array [ ...]' ");
5963
5964 KN<CC_F0> A(na), B(nb);
5965
5966
5967 for (int i=0;i<na;++i)
5968 if(!ta) A(i) = a[i];
5969 else A(i) = TryConj(a[i]);
5970
5971 const char * xyz[] = { "x","y","z"};
5972 for (int i=0;i<nb;++i)
5973 B[i] = C_F0(b,xyz[i]);
5974
5975
5976 CC_F0 ab;
5977 ab = C_F0(TheOperators,"*",A[0],B[0]);
5978 for (int i=1;i<na;++i)
5979 ab = C_F0(TheOperators,"+",ab,C_F0(TheOperators,"*",A(i),B(i)));
5980
5981 return ab;
5982
5983
5984 }
5985 // Add FH ... mars 2020 for N'.x
5986
5987template< class Result, class A >

Callers 1

C_F0Method · 0.45

Calls 5

CompileErrorFunction · 0.85
TryConjFunction · 0.85
C_F0Class · 0.70
leftMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected