Example #1
0
int main(int argc, char** argv) {
    int i, t;
    int n_frames = 10;
    int n_atoms = 5;
    int n_sphere_points = 960;
    int* pairs = calloc(2, sizeof(int));
    pairs[0] = 0;
    pairs[1] = 1;
    int triplets[3] = {0, 1, 2};
    int quartets[4] = {0, 1, 2, 3};
    float * box_matrix = calloc(n_frames*9, sizeof(float));
    for (t = 0; t < n_frames; t++)
        for (i = 0; i < 3; i++)
            box_matrix[t*9 + i*3+i] = 1;
    float * atom_radii = calloc(n_atoms, sizeof(float));
    float * xyzlist = calloc(n_frames*n_atoms*3, sizeof(float));
    float * geom_out = calloc(n_frames, sizeof(float));
    float * displacement_out = calloc(n_frames*1*3, sizeof(float));
    float * array_of_areas = calloc(n_frames*n_atoms, sizeof(float));
    for (i = 0; i < n_frames*n_atoms*3; i++)
        xyzlist[i] = i;

    sasa(n_frames, n_atoms, xyzlist, atom_radii, n_sphere_points, array_of_areas);
    printf("Finished sasa\n");
    dihedral(xyzlist, quartets, geom_out, n_frames, n_atoms, 1);
    printf("finished dihedral\n");
    dist(xyzlist, pairs, geom_out, NULL, n_frames, n_atoms, 1);
    printf("finished dist 1\n");
    dist(xyzlist, pairs, NULL, displacement_out, n_frames, n_atoms, 1);
    printf("finished dist 2\n");
    dist_mic(xyzlist, pairs, box_matrix, geom_out, NULL, n_frames, n_atoms, 1);
    printf("finished mic 1\n");
    dist_mic(xyzlist, pairs, box_matrix, NULL, displacement_out, n_frames, n_atoms, 1);
    printf("finished mic 2\n");
    angle(xyzlist, triplets, geom_out, n_frames, n_atoms, 1);
    printf("finished angle\n");




    // example: this is an invalid read that should trigger valgrid
    // or the clang address tool
    // __m128 f = _mm_loadu_ps(atom_radii+(n_atoms-3));
    
    free(atom_radii);
    free(xyzlist);
    free(array_of_areas);
    free(geom_out);
    free(displacement_out);
    free(pairs);
    free(box_matrix);

    return 0;
}
Example #2
0
 odcore::data::dmcp::ModuleExitCodeMessage::ModuleExitCode Ivrule::body()
{
  while (getModuleStateAndWaitForRemainingTimeInTimeslice() == odcore::data::dmcp::ModuleStateMessage::RUNNING) {
    odcore::data::TimeStamp now;



    if((m_mioValidUntil-now).toMicroseconds() > 0) {
      // Steer to mio
      opendlv::perception::StimulusDirectionOfMovement sdom(now, m_mio.getDirection(),opendlv::model::Direction(0,0));
      odcore::data::Container containerSdom(sdom);
      getConference().send(containerSdom);

      // std::cout << "Sent sdom." << std::endl;


      opendlv::perception::StimulusAngularSizeAlignment sasa(now, m_mio.getDirection(),m_mio.getAngularSize(),m_desiredAngularSize);
      odcore::data::Container containerSasa(sasa);
      getConference().send(containerSasa);

      // std::cout << "Sent sasa."  << std::endl;


      // std::cout 
      //     << " Id: " << m_mio.getObjectId() 
      //     << " Azimuth: " << m_mio.getDirection().getAzimuth() 
      //     << " Distance: " << m_mio.getDistance() 
      //     << " Desired angular size: " << m_desiredAngularSize 
      //     << " Currently: " << m_mio.getAngularSize() 
      //     << std::endl;
    } else {
      opendlv::perception::StimulusGroundSpeed sof(now, m_desiredOpticalFlow, m_speed);
      odcore::data::Container containerSof(sof);
      getConference().send(containerSof);
      // std::cout << "Send sof. Desired OF: " << m_desiredOpticalFlow  << " Current OF: " << m_speed << std::endl;
    }
  }
  return odcore::data::dmcp::ModuleExitCodeMessage::OKAY;
}