Skip to content

Commit

Permalink
fmk - updating for C assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
fmckenna committed Jul 31, 2024
1 parent dc2190b commit c244241
Show file tree
Hide file tree
Showing 156 changed files with 22,664 additions and 2,453 deletions.
12 changes: 12 additions & 0 deletions assignments/C-Session1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required (VERSION 2.8)

project (C-DAY-1)

add_executable(solveQuadratic solveQuadratic.c)

add_executable(pi pi.c)

add_executable(transformStress transformStress.c)



19 changes: 19 additions & 0 deletions assignments/C-Session1/pi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>


int main(int argc, char **argv) {

if (argc != 2) {
printf("Usage: appName numSteps\n");
exit(-1);
}

int numSteps = atoi(argv[1]);

double pi = 0;

printf("PI = %16.14f, diff(%16.14f)\n",pi, fabs(pi-M_PI));
return 0;
}
32 changes: 32 additions & 0 deletions assignments/C-Session1/solveQuadratic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// program to solve quadratic equation
// ax^2 + bx + c = 0
//
// soln: x = -b/2a +/- sqrt(b^2-4ac)/2a
//
// write a program to take 3 inputs and output the soln
// if two real solutions, printf("%.8f, %.8f\n", x1, x2);
// if only one solution, just ouput a single value, i.e. printf("%.8f\n", x1);
// if complex, output a complex number, i.e. printf("%.8f + %.8fi,%.8f - %.8fi\n", x1, im, x2,im);

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

int main(int argc, char **argv) {

if (argc != 4) {
printf("Usage: appName a b c\n");
exit(-1);
}

float a = atof(argv[1]);
float b = atof(argv[2]);
float c = atof(argv[3]);

float x1 = 0, x2 = 0;

printf("%.8f, %.8f\n", x1, x2);

return 0;
}

28 changes: 28 additions & 0 deletions assignments/C-Session1/transformStress.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// program to transform stress:
//
// sigmaX' = sigmaX * cos^2(theta) + sigmaY * sin^2(theta) + 2 * tauXY Sin(theta)Cos(theta)
// sigmaY' = sigmaX * sin^2(theta) + sigmaY * cos^2(theta) - 2 * tauXY Sin(theta)Cos(theta)
// tauXY' = (sigmaY-sigmaX) * sin(theta)cos(theta) + tauXY(cos^2(theta) - sin^2(theta))
//
// write a program to take:
// 1: 4 inputs: sigmaX, sigmaY, tauXY, theta and output transformed stresses: sigmaX', sigmaY', tauXY'
// 2: 3 inputs: sigmaX, sigmaY, tauXY and output transformed stresses: sigmaX', sigmaY', tauXY' for every 10 degrees
//
// NOTE: perform the transformation inside a function that cannot be named main
//
// Extend to possibly include all outputs for a Mohr circle, were the theta now provided is a deltaTheta

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

void transformStress(float *stressIN, float theta, float *stressTransformed);

int main(int argc, char **argv) {

double sigmaX=0, sigmaY=0, tauXY=0;

printf("%.4f, %.4f, %.4f\n", sigmaX, sigmaY, tauXY);
return 0;
}

2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: dbd60fef3f3505ea96be3cb9252377a9
config: 28c66c38aaed0a9d4651d087a19e23c5
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/.doctrees/.special.doctree
Binary file not shown.
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/index.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/.special.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/GUI.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/TACC.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignmentPreC.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_C1.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_C2.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_C2_solution.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_C3.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_C4.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_C4_solution.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_C5.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_day1.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_day2.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_day3.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_day4.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignment_day5.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/assignments.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/cmake.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/computer.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/emacs.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/git.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/help.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/index.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/install_issues.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/lecture_videos.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/lecture_videos_part0.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/lecture_videos_part1.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/lecture_videos_part1b.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/lecture_videos_part2.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/lecture_videos_part2_FINAL.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/lecture_videos_part3.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/mathematics.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/programming_challenge.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/resources.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/setupInstructions.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/syllabus.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/syllabus_by_day.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/syllabus_by_topic.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/tapis.doctree
Binary file not shown.
Binary file modified docs/.doctrees/source/tools.doctree
Binary file not shown.
162 changes: 132 additions & 30 deletions docs/.special.html
Original file line number Diff line number Diff line change
@@ -1,54 +1,99 @@


<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>&lt;no title&gt; &mdash; Programming Bootcamp 2024 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/css/custom.css?v=079b110e" />
<link rel="stylesheet" type="text/css" href="_static/css/hacks.css?v=6658a5ce" />



<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
<link rel="stylesheet" href="_static/css/hacks.css" type="text/css" />










<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->

<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>

<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>

<script type="text/javascript" src="_static/js/theme.js"></script>


<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>

<body class="wy-body-for-nav">
<body class="wy-body-for-nav">


<div class="wy-grid-for-nav">

<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >



<a href="index.html" class="icon icon-home"> Programming Bootcamp 2024



<a href="index.html" class="icon icon-home">
Programming Bootcamp 2024
</a>







<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">


</div>


<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">






<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="source/syllabus.html">Syllabus</a></li>
<li class="toctree-l1"><a class="reference internal" href="source/setupInstructions.html">Setup Instructions</a></li>
<li class="toctree-l1"><a class="reference internal" href="source/lecture_videos.html">Self-Study Videos</a></li>
<li class="toctree-l1"><a class="reference internal" href="source/assignments.html">Assignments</a></li>
<li class="toctree-l1"><a class="reference internal" href="source/git.html">Git</a></li>
<li class="toctree-l1"><a class="reference internal" href="source/emacs.html">Emacs</a></li>
<li class="toctree-l1"><a class="reference internal" href="source/cmake.html">Cmake</a></li>
Expand All @@ -57,57 +102,114 @@
<li class="toctree-l1"><a class="reference internal" href="source/resources.html">Additional Resources</a></li>
</ul>



</div>

</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">


<nav class="wy-nav-top" aria-label="top navigation">

<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Programming Bootcamp 2024</a>

</nav>


<div class="wy-nav-content">

<div class="rst-content">
<div role="navigation" aria-label="Page navigation">



















<div role="navigation" aria-label="breadcrumbs navigation">

<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">&lt;no title&gt;</li>

<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>

<li>&lt;no title&gt;</li>


<li class="wy-breadcrumbs-aside">


<a href="_sources/.special.rst.txt" rel="nofollow"> View page source</a>


</li>

</ul>


<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">



</div>

</div>
<footer>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2020-2024, Peter Mackenzie-Helnwein, Frank McKenna.</p>
</div>
<p>
&#169; Copyright 2020-2024, Peter Mackenzie-Helnwein, Frank McKenna.

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
</p>
</div>



Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a

<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.


provided by <a href="https://readthedocs.org">Read the Docs</a>.

</footer>
</div>
</div>

</section>

</div>
<script>


<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</script>






</body>
</html>
3 changes: 2 additions & 1 deletion docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ The outline of the workshop is follows.

source/syllabus
source/setupInstructions
source/lecture_videos
source/lecture_videos
source/assignments
source/git
source/emacs
source/cmake
Expand Down
4 changes: 2 additions & 2 deletions docs/_sources/source/assignment_C1.rst.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
C: Assignments Day 1
====================
C: Session 1
============

Today we have three problems for you to tackle.

Expand Down
6 changes: 3 additions & 3 deletions docs/_sources/source/assignment_C2.rst.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
C: Assignments Day 2
====================
C: Assignments Session 2
========================


Today we have several problems for you to tackle. Parts should look and feel familiar from Day 1, though we will add more features as we go.
Some more problems for you to tackle. Parts should look and feel familiar from first session, though we will add more features as we go.



Expand Down
6 changes: 3 additions & 3 deletions docs/_sources/source/assignment_C3.rst.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
C: Assignments Day 3
====================
C: Assignments Session 3
========================


Today we have three problems for you to tackle.
More problems for you to tackle.

Problem 1: Lets switch to C++ syntax
------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docs/_sources/source/assignment_C4.rst.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
C: Assignments Day 4
====================
C: Assignments Session 5
========================

Problem 1: Parallelize **pi.c** using **MPI**
---------------------------------------------
Expand Down
Loading

0 comments on commit c244241

Please sign in to comment.