2. P. J. F. Harris - Carbon nanotube composites - International Materials Reviews 2004 VOL 49 NO 1
3. L. Berha, A. M. Sastry - Modeling percolation in high-aspect-ratio fiber systems. I. Soft-core versus hard-core models - PHYSICAL REVIEW E 75, 2007.
4. Z. Ounaiesa, C. Park, K.E. Wise, E.J. Siochi, J.S. Harrison - Electrical properties of single wall carbon nanotube reinforced polyimide composites. Composites Science and Technology 63 (2003) 1637-1646
5. Шлее М. - Qt 4.5. Профессиональное программирование на C++. - СПб.: БХВ-Петербург, 2010 - 896 с.
6. Богачёв К. Ю. - Основы параллельного программирования. - М.: БИНОМ. Лаборатория знаний, 2003. - 342 с.
7. Земсков В.Ю., Программирование на C++ с
использованием библиотеки Qt 4. - СПб.: БХВ-Петербург, 2007. - 272 с.
main.cpp
#include <QCoreApplication>
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <QVector><double> merge(const QVector<double> &pLeft, const QVector<double> &pRight)
{<double> lResult;lLeftIt = 0;lRightIt = 0;(lLeftIt < pLeft.size() && lRightIt < pRight.size())
{(pLeft.at(lLeftIt) < pRight.at(lRightIt))
{.push_back(pLeft.at(lLeftIt));++;
}
{.push_back(pRight.at(lRightIt));++;
}
}(lLeftIt < pLeft.size())
{.push_back(pLeft.at(lLeftIt));++;
}(lRightIt < pRight.size())
{.push_back(pRight.at(lRightIt));++;
}lResult;
}<double> mergesort(QVector<double> &pVec, int threads)
{(pVec.size() == 1)
{pVec;
}mid = pVec.size() / 2;<double> lLeft;(int i = 0; i < mid; i++)
{.append(pVec.at(i));
}<double> lRight;(int i = mid; i < pVec.size(); i++)
{.append(pVec.at(i));
}(threads > 1)
{
#pragma omp parallel sections
{
#pragma omp section
{= mergesort(lLeft, threads / 2);
}
#pragma omp section
{= mergesort(lRight, threads - threads / 2);
}
}
}
{= mergesort(lLeft, 1);= mergesort(lRight, 1);
}merge(lLeft, lRight);
}main(int argc, char *argv[])
{a(argc, argv);n = 0;high = 10000;low = 0;threads = 1;("N = ");("%d", &n);("Threads count = ");("%d", &threads);<double> vec;(int i = 0; i < n; i++)
{.append(qrand() % ((high + 1) - low) + low);
}t_start = omp_get_wtime();= mergesort(vec, threads);t_end = omp_get_wtime();("Time = %lf\n", t_end - t_start);a.exec();
}_example.pro+= core-= gui= openmp_example+= console-=
app_bundle= app_CXXFLAGS += -fopenmp+= -fopenmp+= main.cpp
Додаток Б
програма масив злиття сортування
#include "cengine.h"::CEngine()
{
}CEngine::set_numgroups(int num)
{>numgroups = num;>groups = new CObject[num];
}CEngine::set_numteachers(int num)
{>numteachers = num;>teachers = new CObject[num];
}CEngine::set_numclassrooms(int num)
{>numclassrooms = num;>classrooms = new CObject[num];
}CEngine::set_numsubjects(int num)
{>numsubjects = num;>subjects = new CObject[num];
}CEngine::Start_Sort()
{teach = -1;aud = -1;set = false;(int i = 0; i < numgroups; i++)
{(int j = 0; j < groups[i].task_num; j++)
{(groups[i].task[j] > 0)
{= -1;= -1;= false;(int l = 0; l < 6; l++)
{(int k = 0; k < 5; k++)
{(groups[i].time[k][l] == false)
{(int v = 0; v < numteachers; v++)
{(int w = 0; w < teachers[v].type_num; w++)
{ if((teachers[v].time[k][l] == false)&&(teachers[v].type[w] == groups[i].type[j]))
{= v;() << teachers[v].time[k][l];() << teachers[v].type[w];() << groups[i].type[j];;
}() << teachers[v].time[k][l];() << teachers[v].type[w];() << groups[i].type[j];
}(teach != -1)
{;
}
}(teach == -1)
{;
}(int v = 0; v < numclassrooms; v++)
{(int w = 0; w < classrooms[v].type_num; w++)
{if((classrooms[v].time[k][l] == false)&&(classrooms[v].type[w] == find_subject(groups[i].type[j])))
{= v;;
}
}(aud != -1)
{;
}
}(aud == -1)
{;
}[i].time[k][l] = true;[teach].time[k][l] = true;[aud].time[k][l] = true;[i].scedule_classroom[k][l] = aud;[i].scedule_subj[k][l] = find_subj_id(groups[i].type[j]);[i].scedule_teacher[k][l] = teach;[i].task[j]--;= true;() << "[" << k << "][" << l << "]\t" << groups[i].name << "\t" << groups[i].type[j] << "\t" << teachers[teach].name << "\t" << classrooms[aud].name;(groups[i].task[j] != 0)
{-;
};
}
}(set)
{ break; } } } } }}CEngine::find_subject(QString name)
{(int i = 0; i < this->numsubjects; i++)
{(this->subjects[i].name == name)
{this->subjects[i].type[0];
}
}"";
}CEngine::find_subj_id(QString name)
{(int i = 0; i < this->numsubjects; i++)
{(this->subjects[i].name == name)
{i;
}
}-1;
}CEngine::write_debug(int id)
{(int i = 0; i < 5; i++)
{(int j = 0; j < 6; j++)
{txt[4];[0] = groups[id].name;(groups[id].scedule_classroom[i][j] == -1)
{[1] = "--";
}
{[1] = classrooms[groups[id].scedule_classroom[i][j]].name;
}(groups[id].scedule_subj[i][j] == -1)
{[2] = "--";
}
{[2] = subjects[groups[id].scedule_subj[i][j]].name;
}(groups[id].scedule_teacher[i][j] == -1 )
{[3] = "--";
}
{[3] = teachers[groups[id].scedule_teacher[i][j]].name;
}() << "[" << i << "][" << j << "]\t" << txt[0] << "\t" << txt[1] << "\t" << txt[2] << "\t" << txt[3];
{this->numgroups;
}