Compare commits

..

No commits in common. "9b1872139d41018deb23742f2d3c19608f06897a" and "8c9a1522a09bab03edc24691d2d99b7ec228e67d" have entirely different histories.

16 changed files with 14 additions and 2413 deletions

2
.gitignore vendored
View File

@ -3,5 +3,3 @@
bin/ bin/
compile_commands.json compile_commands.json
build-*/ build-*/
latex.out/
docs/folien/folien.pdf

View File

@ -22,13 +22,6 @@
qt6.full qt6.full
libGL libGL
# presentation
pandoc
texlive.combined.scheme-full
noto-fonts
latexrun
entr
# pre-commit # pre-commit
pre-commit pre-commit
commitizen commitizen

View File

@ -23,7 +23,6 @@ MainWindow::MainWindow(QWidget *parent)
setupAlgorithmSelector(); setupAlgorithmSelector();
setupWordListSourceSelector(); setupWordListSourceSelector();
setupWordList(); setupWordList();
createSelectedFinder();
} }
MainWindow::~MainWindow() { delete ui; } MainWindow::~MainWindow() { delete ui; }
@ -80,7 +79,8 @@ void MainWindow::loadWordList(std::filesystem::path path) {
void MainWindow::search(const QString &search_term) { void MainWindow::search(const QString &search_term) {
if (search_term.isEmpty()) { if (search_term.isEmpty()) {
clearResults(); result_model_.setStringList(QStringList());
ui->mainStatusBar->clearMessage();
return; return;
} }
@ -99,7 +99,6 @@ void MainWindow::search(const QString &search_term) {
void MainWindow::createSelectedFinder() { void MainWindow::createSelectedFinder() {
auto selectedFinder = ui->searchAlgorithmSelector->currentIndex(); auto selectedFinder = ui->searchAlgorithmSelector->currentIndex();
Timer timer;
switch (selectedFinder) { switch (selectedFinder) {
case 0: case 0:
default: default:
@ -121,12 +120,6 @@ void MainWindow::createSelectedFinder() {
finder_ = std::make_unique<GroupedFinder>(word_list_); finder_ = std::make_unique<GroupedFinder>(word_list_);
break; break;
} }
timer.stop();
std::stringstream status_message;
status_message << "finder initialized in " << timer << ", "
<< word_list_.size() << " words loaded";
ui->mainStatusBar->showMessage(QString::fromStdString(status_message.str()));
} }
void MainWindow::showResults(const WordRefList &results) { void MainWindow::showResults(const WordRefList &results) {
@ -138,37 +131,32 @@ void MainWindow::showResults(const WordRefList &results) {
result_model_.setStringList(ui_results); result_model_.setStringList(ui_results);
} }
void MainWindow::clearResults() { result_model_.setStringList({}); }
void MainWindow::on_searchInput_textChanged(const QString &search_term) { void MainWindow::on_searchInput_textChanged(const QString &search_term) {
// QGuiApplication::setOverrideCursor(Qt::WaitCursor); QGuiApplication::setOverrideCursor(Qt::WaitCursor);
// search(search_term); search(search_term);
// QGuiApplication::restoreOverrideCursor(); QGuiApplication::restoreOverrideCursor();
} }
void MainWindow::on_searchAlgorithmSelector_currentIndexChanged(int) { void MainWindow::on_searchAlgorithmSelector_currentIndexChanged(int) {
QGuiApplication::setOverrideCursor(Qt::WaitCursor); QGuiApplication::setOverrideCursor(Qt::WaitCursor);
clearResults();
createSelectedFinder(); createSelectedFinder();
// search(ui->searchInput->displayText()); search(ui->searchInput->displayText());
QGuiApplication::restoreOverrideCursor(); QGuiApplication::restoreOverrideCursor();
} }
void MainWindow::on_wordListSourceSelector_currentIndexChanged(int) { void MainWindow::on_wordListSourceSelector_currentIndexChanged(int) {
QGuiApplication::setOverrideCursor(Qt::WaitCursor); QGuiApplication::setOverrideCursor(Qt::WaitCursor);
clearResults();
setupWordList(); setupWordList();
createSelectedFinder(); createSelectedFinder();
// search(ui->searchInput->displayText()); search(ui->searchInput->displayText());
QGuiApplication::restoreOverrideCursor(); QGuiApplication::restoreOverrideCursor();
} }
void MainWindow::on_wordListSizeSelector_valueChanged(int) { void MainWindow::on_wordListSizeSelector_valueChanged(int) {
QGuiApplication::setOverrideCursor(Qt::WaitCursor); QGuiApplication::setOverrideCursor(Qt::WaitCursor);
clearResults();
setupWordList(); setupWordList();
createSelectedFinder(); createSelectedFinder();
// search(ui->searchInput->displayText()); search(ui->searchInput->displayText());
QGuiApplication::restoreOverrideCursor(); QGuiApplication::restoreOverrideCursor();
} }

View File

@ -37,7 +37,6 @@ private:
void search(const QString &search_term); void search(const QString &search_term);
void createSelectedFinder(); void createSelectedFinder();
void showResults(const WordRefList &results); void showResults(const WordRefList &results);
void clearResults();
private slots: private slots:
void on_searchInput_textChanged(const QString &search_term); void on_searchInput_textChanged(const QString &search_term);

View File

@ -1,34 +0,0 @@
\begin{frame}{Analyse}
{\Large Anforderungen}
\vspace{0.5cm}
\begin{itemize}
\item Datenstruktur für Wortliste
\item Paralleler Such-Algorithmus
\item Abgeleitet: Optimierung der Such-Zeit
\end{itemize}
\end{frame}
\begin{frame}{Analyse}
{\Large Abgeleitete Aufgabenstellung}
\vspace{0.5cm}
\begin{minipage}{0.7\textwidth}
Aufteilung in zwei Blöcke:
\begin{block}{Anwendungs-Schicht (Layer 5 - 7)}
\begin{itemize}
\item Request/Reponse
\item Konkurrierender Zugriff
\item Session Handling
\end{itemize}
\end{block}
\begin{block}{Transport-Schicht (Layer 1 - 4)}
\begin{itemize}
\item Datenübertragung zwischen SG
\item Gleichzeitige Kommunikation
\end{itemize}
\end{block}
\end{minipage}
\end{frame}

View File

@ -1,14 +0,0 @@
\begin{frame}{Aufgabe}
{\Large Entwicklung einer parallelen Suche in einer Liste mit Wörtern}
\vspace{0.5cm}
Es ist eine Datenstruktur in Form einer Liste (Vektor) mit unterschiedlichen Wörtern
gegeben. Ein Suchalgorithmus soll eine Liste mit Wörtern aus dieser Wortliste ermitteln,
deren erste Zeichen mit einem Suchstring übereinstimmen.
Der Algorithmus soll moderne Multi-Core-Prozessoren ausnutzen, die Suche also auf
möglichst viele Cores verteilen.
\end{frame}

View File

@ -1,5 +0,0 @@
\begin{frame}
\begin{center}
\huge Vielen Dank
\end{center}
\end{frame}

View File

@ -1,51 +0,0 @@
\documentclass[aspectratio=169]{beamer}
\title{Fallstudie Wortliste}
\author{Michael Mandl}
\date[v0.1 | 25.03.2024]{25.03.2024}
\usepackage[sfdefault]{noto}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{fontawesome}
\definecolor{vector_red}{RGB}{183, 0, 50}
\definecolor{vector_grey}{RGB}{234, 236, 237}
\usetheme{Boadilla}
\setbeamercolor*{palette primary}{fg=white,bg=vector_red}
\setbeamercolor*{palette secondary}{fg=black,bg=vector_grey}
\setbeamercolor*{palette tertiary}{fg=black,bg=vector_grey}
\setbeamercolor*{palette quaternary}{fg=black,bg=vector_grey}
\setbeamercolor{titlelike}{fg=white, bg=vector_red}
\setbeamercolor{frametitle}{bg=vector_red,fg=white}
\setbeamertemplate{itemize item}[triangle]
\setbeamertemplate{itemize subitem}[circle]
\setbeamercolor{itemize item}{fg=vector_red}
\setbeamercolor{itemize subitem}{fg=vector_red}
\setbeamercolor{itemize subsubitem}{fg=vector_red}
\setbeamercolor{description item}{fg=vector_red}
\setbeamercolor{block title}{fg=white, bg=vector_red}
\setbeamercolor{block body}{fg=black, bg=vector_grey}
\setbeamertemplate{navigation symbols}{}
\setbeamersize
{
text margin left=2cm,
text margin right=2cm
}
\begin{document}
\frame[plain]{\titlepage}
\include{aufgabe}
\include{analyse}
\include{danke}
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
find . -name "*.tex" -o -name "*.png" | entr latexrun folien.tex

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 97 KiB

View File

@ -7,7 +7,7 @@
class Bucket { class Bucket {
private: private:
std::map<char, WordRefList> directory_; std::map<const char, WordRefList> groups_;
public: public:
void insert(const WordList &word_list, size_t first_index, size_t last_index); void insert(const WordList &word_list, size_t first_index, size_t last_index);

View File

@ -6,20 +6,20 @@
void Bucket::insert(const WordList &word_list, size_t first_index, void Bucket::insert(const WordList &word_list, size_t first_index,
size_t last_index) { size_t last_index) {
for (auto index = first_index; index < last_index; ++index) { for (size_t index = first_index; index < last_index; ++index) {
const auto &current_word = word_list[index]; const auto &current_word = word_list[index];
directory_[current_word.front()].push_back(&current_word); groups_[current_word.front()].push_back(&current_word);
} }
} }
WordRefList Bucket::find_prefix(std::string_view search_term) const { WordRefList Bucket::find_prefix(std::string_view search_term) const {
auto directory_it = directory_.find(search_term.front()); auto group_it = groups_.find(search_term.front());
if (directory_it == directory_.cend()) { if (group_it == groups_.cend()) {
return {}; return {};
} }
WordRefList result; WordRefList result;
for (const auto *word : directory_it->second) { for (const auto *word : group_it->second) {
if (word->starts_with(search_term)) { if (word->starts_with(search_term)) {
result.push_back(word); result.push_back(word);
} }