Esempio n. 1
0
int main(int argc, char *argv[]){
// code in the main program
char buf3[6];
char buf7[5];
char* cmd1[3];
char* cmd2[3];
cmd2[0] = buf3;
cmd2[1] = buf7;

strcpy(buf3, "hi");
strcpy(buf7, "ok");
char val[] = "ls|wc";
fa(buf3);
printf("fa(buf3) = %s\n", buf3);

fb(buf3);
printf("fb(buf3) = %s\n", buf3);

fc(buf3);
printf("fc(buf3) = %s\n", buf3);

fd(buf3);
printf("fd(buf3) = %s\n", buf3);

fe(buf3);
printf("fb(buf3) = %s\n", buf3);

fa(buf7);
printf("fa(buf7) = %s\n", buf7);

fb(buf7);
printf("fb(buf7) = %s\n", buf7);

fc(buf7);
printf("fc(buf7) = %s\n", buf7);

fd(buf7);
printf("fd(buf7) = %s\n", buf7);

fe(buf7);
printf("fb(buf7) = %s\n", buf7);

ff(cmd1, val);
printf("ff(cmd1[0], val) = %s\n", cmd1[0]);
printf("ff(cmd1, val) = %s\n", cmd1[1]);
fg(cmd1, val);
printf("fg(cmd1[0], val) = %s\n", cmd1[0]);
printf("fg(cmd1, val) = %s\n", cmd1[1]);
fh(cmd1, val);
printf("fh(cmd1[0], val) = %s\n", cmd1[0]);
printf("fh(cmd1, val) = %s\n", cmd1[1]);
fi(cmd1, val);
printf("fi(cmd1[0], val) = %s\n", cmd1[0]);
fj(cmd1, val);
printf("fj(cmd1[0], val) = %s\n", cmd1[0]);

ff(cmd2, val);
printf("ff(cmd2[0], val) = %s\n", cmd2[0]);
printf("ff(cmd2, val) = %s\n", cmd2[1]);
fg(cmd2, val);
printf("fg(cmd2[0], val) = %s\n", cmd2[0]);
printf("fg(cmd2, val) = %s\n", cmd2[1]);
fh(cmd2, val);
printf("fh(cmd2[0], val) = %s\n", cmd2[0]);
printf("fh(cmd2, val) = %s\n", cmd2[1]);
fi(cmd2, val);
printf("fi(cmd2[0], val) = %s\n", cmd2[0]);
fj(cmd2, val);
printf("fj(cmd2[0], val) = %s\n", cmd2[0]);

return 0;
}
Esempio n. 2
0
void FPairTensor::computeForces(Pairdist* pair, int force_index, int thread_no)
#endif
{

/*  M_PAIRCREATOR->createDistances();

  FOR_EACH_PAIR__PARALLEL
      (FPairTensor,
       m_cp, */

       if (this->m_cutoff > pair->abs())
       {
         tensor_t temp;

#ifdef ENABLE_PTHREADS
	 pair->firstPart()->lock();
	 pair->secondPart()->lock();
#endif
    this->m_pairFactor(&temp, &(*pair));

// 	 MSG_DEBUG("FPairTensor::computeForces", "temp = " << temp);

    tensor_t fi;
    tensor_t fj;

//     MSG_DEBUG("FPairTensor::computeForces", "fi before = " << fi);
//     MSG_DEBUG("FPairTensor::computeForces", "fj before = " << fj);

    // compute the particle-expressions
    this->m_1stparticleFactor(&fi, &(*pair));
    this->m_2ndparticleFactor(&fj, &(*pair));

//     MSG_DEBUG("FPairTensor::computeForces", "fi after function = " << fi);
//     MSG_DEBUG("FPairTensor::computeForces", "fj after function = " << fj);

/*    point_t tester;
    double arg[3];
    for (size_t i = 0; i < 3; ++i)
    {
    tester[i] = 0;
    arg[i] = i;
       }
    MSG_DEBUG("FPairTensor::computeForces", "tester before function = " << tester);
    MSG_DEBUG("FPairTensor::computeForces", "velfirst = " << pair->firstPart()->v);
    self->m_fpf(&tester, arg, &(*pair));
    MSG_DEBUG("FPairTensor::computeForces", "tester after function = " << tester);*/

    // loop necessary because operator* of math_tensor_t does scalar product
    fi *= temp;
    fj *= temp;

//     MSG_DEBUG("FPairTensor::computeForces", "fi after temp = " << fi);
//     MSG_DEBUG("FPairTensor::computeForces", "fj after temp = " << fj);


    fi *= this->m_wf->weight(pair, pair->secondPart()->r);
    fj *= this->m_wf->weight(pair, pair->firstPart()->r);

//     MSG_DEBUG("FPairTensor::computeForces", "fi after weight = " << fi);
//     MSG_DEBUG("FPairTensor::computeForces", "fj after weight = " << fj);


// 	 MSG_DEBUG("FPairTensor::computeForces", " second r = " << pair->secondPart()->r << "first r = " << pair->firstPart()->r);

#ifndef _OPENMP
    if (pair->actsOnFirst())
      pair->firstPart()->tag.tensorByOffset(this->m_force_offset[force_index].first) += fi;
    if (pair->actsOnSecond())
      pair->secondPart()->tag.tensorByOffset(this->m_force_offset[force_index].second) += this->m_symmetry*fj;
#else
     if (pair->actsOnFirst()) {
       size_t _i = 0;
       for(size_t a = 0; a < SPACE_DIMS; ++a) {
         for(size_t b = 0; b < SPACE_DIMS; ++b) {
           (*pair->firstPart()->tag.vectorDoubleByOffset(m_offsetToVec[thread_no].first))[m_posInVec.first + _i] += fi(a,b);
           ++_i;
         }
       }
     }
     if (pair->actsOnSecond()) {
       size_t _i = 0;
       for(size_t a = 0; a < SPACE_DIMS; ++a) {
         for(size_t b = 0; b < SPACE_DIMS; ++b) {
           (*pair->secondPart()->tag.vectorDoubleByOffset(m_offsetToVec[thread_no].second))[m_posInVec.second + _i] += this->m_symmetry*fj(a,b);
           ++_i;
         }
       }
     }
#endif

#ifdef ENABLE_PTHREADS
	 pair->secondPart()->unlock();
	 pair->firstPart()->unlock();
#endif
       }
//       );
}