hw5 - COMPUTER SCIENCE 50100 Computing for Science and...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMPUTER SCIENCE 50100 Computing for Science and Engineering FALL 2014 ASSIGNMENT # 5 (35 points) October 29 Due Wednesday, November 19 at 11:30 am This assignment covers Sections 4.6, 4.7, 5.1 of the class notes. Given in the Appendix is a program, comprising main.c and heat.c , that solves the heat equation at specified points in the unit cube, where the top and bottom face are kept at 100 C and the sides at 0 C. It uses a random walk method (based on the Feynman-Kac formula). This method is chosen because it is simple to program and computationally expensive. Func- tion main calculates the solution on a grid covering an octant of the cross-section z = 1 / 2. It prints a subset of these values and calculates the average temperature (assuming a piecewise bilinear interpolant). Here is a script for compilation and execution: #!/usr/bin/env python # run0.py from subprocess import call if call("gcc -std=c99 main.c heat.c -lm -o main.exe", shell=True): exit(-1) call("./main.exe", shell=True) 1. (7 points) The following script creates a dynamically loadable library for the functions in heat.c : #!/usr/bin/env python # run1.py from subprocess import call if call("gcc -std=c99 heat.c -c", shell=True): exit(-1) if call("gcc -dynamiclib heat.o -lm -o heat.dll", shell=True): exit(-1) if call("gcc -std=c99 main.c wrapDL.c -ldl -o main.exe", shell=True): exit(-1) call("./main.exe", shell=True) You are to write a wrapper wrapDL.c that defines a function temperature having the same prototype as in main.c but containing no code except what is needed to call the function temperature in the file heat.dll
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern