讲解:asp、asp、comp20005 Engineering Computation

comp20005 Engineering ComputationSemester 1, 2018Assignment 2Learning OutcomesIn this project you will demonstrate your understanding of structures and arrays of structures, and willdevelop a computational solution for a non-trivial problem. You are also expected to make extensiveuse of functions; and to demonstrate that you have adopted a clear and elegant programming style. Youwill find it difficult to create a working solution unless you plan your program carefully in advance, anddevelop it incrementally.Spatial DataMuch of the data that is used in computing (including engineering) applications is spatiotemporal, anddescribes the layout of objects in space and/or time. In this project we are going to pretend to haveexpert knowledge in the area of forest and tree management, and simulate the possible consequences ofdiffering amounts of rainfall on the ability of a grove of trees to survive. To keep things manageable, andto allow straightforward output formats to be employed, many of the aspects of the required simulationare greatly simplified. Nevertheless the underlying programming principles – use of two dimensionalarrays and graphical output visualizations – are important ones to master.Input file test1.tsv describes five trees in a tab-separated input format with one header line:label xloc yloc liters rootradA 14.8 23.8 18500 8.0G 18.8 28.1 20800 7.0F 24.1 22.2 31000 6.2C 35.3 19.9 28000 7.3E 16.5 10.5 15000 4.2For example, the third tree has the label F, has its trunk at location 24:1 meters east of the origin (positivex direction) and 22:2 meters north of the origin (positive y direction), requires 31;00 liters of water peryear to survive, and sends its roots out in all directions to a radius of 6:2 meters from the location of itstrunk. Each input file will contain at most 52 trees, with labels restricted to the letters ’a’ to ’z’ and’A’ to ’Z’. The trees are in no particular order in the file.Stage 1 – Reading the data (marks up to 6/20)In this stage you should read all of the data into internal structures suitable for use in the later stages.The required output of this stage is:mac: myass2 S1: total data lines = 5 treesS1: total water needed = 0.113 megaliters per yearHint: you should be able to get this stage going quite quickly starting from either your solution to thefirst project, or the sample solution to the first project. In either case you should acknowledge the sourceof any code that you have reused, even if it is your own.1Stage 2 – Multiway processing (marks up to 12/20)Define the catchment zone of a tree to be a circle centered on its trunk, of radius given by its rootradvalue. This is the area from which the tree is able to draw water. Two trees are in conflict if theircatchment zones overlap. In this case their roots may be interlinked and they are competing for rainwater.In this stage you are to check each tree in turn, and for each of them list all of the other trees in theinput with which they are in conflict. The required additional output for test1.tsv is:S2: tree A is in conflict with G FS2: tree G is in conflict with A FS2: tree F is in conflict with A G CS2: tree C is in conflict with FS2: tree E is in conflict withDistances between points should be calculated using the standard Euclidean formula: d(x1;y1;x2;y2) =p(x1 x2)2 +(y1 y2)2. You will need to include math.h, and use the -lm flag when compiling ondimefox: gcc -Wall -lm -o myass2 myass2.cStage 3 – Make a map (marks up to 16/20)Now let’s have some real fun. In order to help the arborists look after the trees, they would like a sketchmap of where the trees are located and where the conflict regions are. Suppose that the region currentlyof interest to the arborists is 70 meters wide (in the east-west direction) and 60 meters tall (north-southdirection), with the (0;0) origin at the south-west corner. To generate the plot, form. a grid that is 70cells/characters wide, and 30 characters tall (because printed characters are approximately twice as tallas they are wide). For example, the bottom-left cell in the grid is to represent the 1 meter wide (thatis, in the east-west direction) by 2 meter tall cell (that is, in the north-south direction) of land from[0 xBy considering the center point of every cell in the grid in turn, and asking (a) which of the trees thatcenter point is closest to, and (b) whether that center point is within the catchment zone of that tree, acharacter plot can be built up showing which tree “claims” that cell as part of its catchment. Note thatwhere there is conflict at the center point of a cell, the nearest tree claims the whole of that cell. Whenall cells have been considered and assigned (or not) to a tree, a plot can be output. For test1.tsv thetop third of the plot is all blanks, and (only) the bottom two thirds of the required output is as shown inFigure 1. Full examples are linked from the Assignment FAQ page.Note carefully the layout of the axes. The numbers that are printed indicate the x and y coordinatesof the lower-left (south-west) corner of the cells. There will thus never be any cell labels plotted in thetop row indicated by the 60 +, and in the right-hand column, above the 70. The character plotted in eachcell is the label of the tree that is closest to the midpoint of that cell, or blank if the midpoint of the cell isnot within the catchment zone of any of the trees. In all cases, it is assumed that if a cell is matched witha tree label, then all of any rainfall into that cell (totaling 2 square meters) is drawn to the correspondingtree by its roots.You should also assume that all of the trees that are specified in any input file will lie fully (includingtheir complete catchment zone) within the designated plot zone of [0 x note that the numbers 60 and 70 should be #define’d, and your program should operate correctly ifthey were altered to other values such as 50 and 60, provided that the input trees all fall in that smallerrectangle.Stage 4 – Let it rain! (marks up to 20/20)If rainfall of one millimeter occurs on one square meter of land, a total of one liter of water is available. Inthis stage, your program should access a total annual rainfall value in millimeters from the commandline2S3: 40 +S3: |S3: |S3: | GGS3: | GGGGGGGGGGS3: 30 + AGGGGGGGGGGGGGS3: | AAAAAGGGGGGGGGGGGS3: | AAAAAAAAAGGGGGGGGFFFF CCCS3: | AAAAAAAAAAAGGGFFFFFFFFFCCCCCCCCCCCS3: | AAAAAAAAAAAAFFFFFFFFFFFCCCCCCCCCCCCS3: 20 + AAAAAAAAAAAAFFFFFFFFFFFCCCCCCCCCCCCCS3: | AAAAAAAAAAAFFFFFFFFFFCCCCCCCCCCCCCCS3: | AAAAAAAA FFFFFF CCCCCCCCCCCCCS3: | CCCCCCCCCCCS3: | EEEEEEE CCCCCS3: 10 + EEEEEEEEES3: | EEEEEEES3: | EEEEES3: |S3: |S3: 0 +S3: +---------+代写asp编程、asp课程设计代写留学生、代做留学生comp20005 Engineering Computation---------+---------+---------+---------+---------+---------+S3: 0 10 20 30 40 50 60 70Figure 1: Partial output for Stage 3 for test1.tsv. See the LMS for full examples.used to run the program, and then check to see (using the reduced catchment zones calculated in Stage 3,including handling the conflicts via the cell-at-a-time approximation process) whether each tree will beable to survive based on that much rainfall. For example, referring again to test1.tsv and Figure 1,tree E has a total of 28 cells associated with it, or 56 square meters. Because tree E has no conflicts, itscomputed catchment zone is a reasonable approximation of the circular area r2 = 55:42 square meters.For the other trees in this example the catchment zones are reduced because of conflicts – for example,tree G has a catchment of 48 cells, or 96 square meters, much less than the circle defined by its root radius(which would be 153:9 square meters). Returning to tree E: it needs 15;000 liters per year, which means(following the calculations you are to perform) it can survive provided the annual rainfall is greater than15;000=56 = 267:9 millimeters. (As indicative reference points, Melbourne’s annual rainfall is about650 millimeters, and Sydney’s is 1200.)Define the stress factor of a tree to be the ratio between the required-for-survival rainfall and therainfall amount provided on the commandline. Trees with a stress factor greater than 1:0 will die; and inour simulation, they are to die in decreasing stress order. That means the death of one tree might reducethe stress on nearby trees once the conflicts are removed, allowing those other trees to shift to a lowerstress factor, and to live.To complete this stage, compute the stress factor for each tree for the rainfall amount given on thecommandline, and if all trees have a stress factor of less than or equal to 1:0, then no trees will die andthe process can finish. But if any trees have stress factors greater than 1:0, your program should identifythe tree with the highest stress factor, and note it as having “died”. You must then recalculate all of thecatchment zones, assuming that dead trees draw no water, and once that is done, all of the stress factors.The process should then be repeated, at each iteration “killing” the tree with the highest stress factorgreater than 1:0, and stopping once either all of the trees are dead, or when every surviving tree has acatchment that allows it to survive on the amount of rainfall that was specified on the commandline.The output of this stage should report the sequence of trees that have died, and then draw anotherplot to illustrate the final tree arrangement. See the examples linked from the FAQ page for full detailsof what is required.3Modifications to the SpecificationThere are bound to be areas where this specification needs clarification or correction. Refer to theFAQ page at http://people.eng.unimelb.edu.au/ammoffat/teaching/20005/ass2/ regularlyfor updates to these instructions. There is already a range of information provided there that you need tobe aware of, with more to follow.The Boring Stuff...This project is worth 20% of your final mark. A rubric explaining the marking expectations will beprovided on the FAQ page.You need to submit your program for assessment; detailed instructions on how to do that will beposted on the LMS once submissions are opened. Submission will not be done via the LMS; instead youwill need to log in to a Unix server and submit your files to a software system known as submit. You can(and should) use submit both early and often – to get used to the way it works, and also to check thatyour program compiles correctly on our test system, which has some different characteristics to the labmachines. Failure to follow this simple advice is highly likely to result in tears. Only the last submissionthat you make before the deadline will be marked.You may discuss your work during your workshop, and with others in the class, but what gets typedinto your program must be individual work, not copied from anyone else. So, do not give hard copyor soft copy of your work to anyone else; do not “lend” your “Uni backup” memory stick to othersfor any reason at all; and do not ask others to give you their programs “just so that I can take a lookand get some ideas, I won’t copy, honest”. The best way to help your friends in this regard is to say avery firm “no” when they ask for a copy of, or to see, your program, pointing out that your “no”, andtheir acceptance of that decision, is the only thing that will preserve your friendship. A sophisticatedprogram that undertakes deep structural analysis of C code identifying regions of similarity will be runover all submissions in “compare every pair” mode. Students whose programs are so identified will bereferred to the Student Center for possible disciplinary action without further warning. This message isthe warning. See https://academicintegrity.unimelb.edu.au for more information. Note alsothat solicitation of solutions via posts to online forums, whether or not there is payment involved, is alsotaken very seriously. In the past students have had their enrolment terminated for such behavior.Deadline: Programs not submitted by 10:00am on Monday 21 May will lose penalty marks at therate of two marks per day or part day late. Students seeking extensions for medical or other “outsidemy control” reasons should email as soon as possible after those circum-stances arise. If you attend a GP or other health care professional as a result of illness, be sure to takea Health Professional Report form. with you (get it from the Special Consideration section of the Stu-dent Portal), you will need this form. to be filled out if your illness develops in to something that laterrequires a Special Consideration application to be lodged. You should scan the HPR form. and send it inconnection with any non-Special Consideration assignment extension requests.Marks and a sample solution should be available on the LMS by Monday 4 June.Disclaimer: None of the “facts” about trees and their water requirements given here are reliable, and itis all just a story I made up to motivate the project. In particular, when it rains, the water runs downhill,making land contours an important additional factor, and different soils and undergrowth have differentabsorption rates. As well, trees need varying amounts of water according to the temperature, and theirsize, and their age, and the growing season, and etc, dozens of different factors; and trees can alsosometimes withstand one or more drought years before becoming eventually threatened. They alsosometimes get too much water and drown to death. Indeed, this project description is misleading inso many different ways that a horticulture student would laugh themselves silly if they read it. Hopefullyyou don’t know any horticulture students, and will just have fun writing the program转自:http://ass.3daixie.com/2018052758777214.html

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 218,607评论 6 507
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,239评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,960评论 0 355
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,750评论 1 294
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,764评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,604评论 1 305
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,347评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,253评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,702评论 1 315
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,893评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,015评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,734评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,352评论 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,934评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,052评论 1 270
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,216评论 3 371
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,969评论 2 355

推荐阅读更多精彩内容

  • Python第四周 多重继承1.子类继承父类(第一个为首要的继承对象,因此下面写继承父类需要按顺序写)2.子类在继...
    信赖_ec3b阅读 271评论 1 0
  • 有一种决定,是,不求我的益处,只求你的益处。———撒雅米 (1) 刚刚把莫陀牵下了楼,现在已经是晚上8:30了,带...
    撒雅米阅读 169评论 0 0
  • 日精进打卡第182天 姓名:李文杰 (四爷) 公司:中国太平人寿 日期:2018.07.15 【知~学习】 《六项...
    纹_阅读 221评论 0 0
  • 沁园春 祖国山河,千种风情,万种妖娆。望长城上下,游客如云,故宫门前,人海滔滔。山筑大门,水建高坝,要想参观掏腰包...
    一船明月阅读 187评论 0 0
  • 2018-1-29 星期一 北京一个角落 亲爱的父母 兄嫂: 你们好!在家已经将近一个月。在此期间给你添...
    学晶阅读 202评论 0 2