@@ -202,8 +202,6 @@ void AtmProcDAG::write_dag (const std::string& fname, const int verbosity) const
202
202
id_end = n.id ;
203
203
box_fmt = " color=\" #88621e\"\n fontcolor=\" #88621e\"\n style=filled\n "
204
204
" fillcolor=\" #dccfb9\"\n " ;
205
- } else {
206
- box_fmt = " penwidth=4\n fontsize=30" ;
207
205
}
208
206
209
207
// Write node, with computed/required fields
@@ -216,59 +214,63 @@ void AtmProcDAG::write_dag (const std::string& fname, const int verbosity) const
216
214
<< " label=<\n "
217
215
<< " <table border=\" 0\" >\n "
218
216
<< " <tr><td><b><font point-size=\" 40\" >" << html_fix (n.name )
219
- << " </font></b></td></tr>" ;
217
+ << " </font></b></td></tr>\n " ;
220
218
if (verbosity>1 ) {
221
219
// FieldIntentifier prints bare min with verb 0.
222
220
// DAG starts printing fids with verb 2, so fid verb is verb-2;
223
221
int fid_verb = verbosity-2 ;
224
- ofile << " <hr/>\n " ;
225
-
226
- // Computed fields
227
- if (n.id == id_begin) {
228
- ofile << " <tr><td align=\" left\" ><b><font color=\" #00667E\" >"
229
- << " Atm input fields from previous time step:</font></b></td></tr>\n " ;
230
- } else if (n.id == id_IC) {
231
- ofile << " <tr><td align=\" left\" ><b><font color=\" #00667E\" >"
232
- << " Initial Fields:</font></b></td></tr>\n " ;
233
- } else if (n.id != id_end) {
234
- ofile << " <tr><td align=\" left\" ><b><font color=\" #88621e\" >"
235
- << " Computed Fields:</font></b></td></tr>\n " ;
236
- }
222
+ ofile << " <hr/>\n " ;
237
223
238
- for (const auto & fid : n.computed ) {
239
- std::string fc = " <font color=\" " ;
240
- fc += " black" ;
241
- fc += " \" > " ;
242
- ofile << " <tr><td align=\" left\" >" << fc
243
- << html_fix (print_fid (m_fids[fid],fid_verb))
244
- << " </font></td></tr>\n " ;
245
- }
224
+ if (n.computed .size () > 0 ) {
225
+ // Computed fields
226
+ if (n.id == id_begin) {
227
+ ofile << " <tr><td align=\" left\" ><b><font color=\" #00667E\" >"
228
+ << " Atm input fields from previous time step:</font></b></td></tr>\n " ;
229
+ } else if (n.id == id_IC) {
230
+ ofile << " <tr><td align=\" left\" ><b><font color=\" #00667E\" >"
231
+ << " Initial Fields:</font></b></td></tr>\n " ;
232
+ } else if (n.id != id_end) {
233
+ ofile << " <tr><td align=\" left\" ><b><font color=\" #88621e\" >"
234
+ << " Computed Fields:</font></b></td></tr>\n " ;
235
+ }
246
236
247
- // Required fields
248
- if (n.id == id_end) {
249
- ofile << " <tr><td align=\" left\" ><b><font color=\" #88621e\" >"
250
- << " Atm output fields for next time step:</font></b></td></tr>\n " ;
251
- } else if (n.id != id_begin && n.id != id_IC) {
252
- ofile << " <tr><td align=\" left\" ><b><font color=\" #00667E\" >"
253
- << " Required Fields:</font></b></td></tr>\n " ;
254
- }
255
- for (const auto & fid : n.required ) {
256
- std::string fc = " <font color=\" " ;
257
- if (ekat::contains (unmet, fid)) {
258
- fc += " red" ;
259
- } else if (ekat::contains (unmet, -fid)) {
260
- fc += " #006219" ;
261
- } else {
237
+ for (const auto & fid : n.computed ) {
238
+ std::string fc = " <font color=\" " ;
262
239
fc += " black" ;
240
+ fc += " \" > " ;
241
+ ofile << " <tr><td align=\" left\" >" << fc
242
+ << html_fix (print_fid (m_fids[fid],fid_verb))
243
+ << " </font></td></tr>\n " ;
263
244
}
264
- fc += " \" > " ;
265
- ofile << " <tr><td align=\" left\" >" << fc << html_fix (print_fid (m_fids[fid],fid_verb));
266
- if (ekat::contains (m_unmet_deps.at (n.id ), fid)) {
267
- ofile << " <b> *** MISSING ***</b>" ;
268
- } else if (ekat::contains (m_unmet_deps.at (n.id ), -fid)) {
269
- ofile << " <b> (Init. Cond.)</b>" ;
245
+ }
246
+
247
+ if (n.required .size () > 0 ) {
248
+ // Required fields
249
+ if (n.id == id_end) {
250
+ ofile << " <tr><td align=\" left\" ><b><font color=\" #88621e\" >"
251
+ << " Atm output fields for next time step:</font></b></td></tr>\n " ;
252
+ } else if (n.id != id_begin && n.id != id_IC) {
253
+ ofile << " <tr><td align=\" left\" ><b><font color=\" #00667E\" >"
254
+ << " Required Fields:</font></b></td></tr>\n " ;
255
+ }
256
+ for (const auto & fid : n.required ) {
257
+ std::string fc = " <font color=\" " ;
258
+ if (ekat::contains (unmet, fid)) {
259
+ fc += " red" ;
260
+ } else if (ekat::contains (unmet, -fid)) {
261
+ fc += " #006219" ;
262
+ } else {
263
+ fc += " black" ;
264
+ }
265
+ fc += " \" > " ;
266
+ ofile << " <tr><td align=\" left\" >" << fc << html_fix (print_fid (m_fids[fid],fid_verb));
267
+ if (ekat::contains (m_unmet_deps.at (n.id ), fid)) {
268
+ ofile << " <b> *** MISSING ***</b>" ;
269
+ } else if (ekat::contains (m_unmet_deps.at (n.id ), -fid)) {
270
+ ofile << " <b> (Init. Cond.)</b>" ;
271
+ }
272
+ ofile << " </font></td></tr>\n " ;
270
273
}
271
- ofile << " </font></td></tr>\n " ;
272
274
}
273
275
274
276
// Computed groups
@@ -578,60 +580,12 @@ void AtmProcDAG::add_edges () {
578
580
}
579
581
580
582
void AtmProcDAG::process_initial_conditions (const grid_field_map &ic_inited) {
581
- // return if there's nothing to do
582
- if (ic_inited.size () == 0 ) {
583
- return ;
584
- }
585
- // Create a node for the ICs
586
- int id = m_nodes.size ();
587
- m_nodes.push_back (Node ());
588
- Node& ic_node = m_nodes.back ();
589
- ic_node.id = id;
590
- ic_node.name = " Initial Conditions" ;
591
- m_unmet_deps[id].clear ();
592
- for (auto &node : m_nodes) {
593
- if (m_unmet_deps.at (node.id ).empty ()) {
594
- continue ;
595
- } else {
596
- // NOTE: node_unmet_fields is a std::set<int>
597
- auto &node_unmet_fields = m_unmet_deps.at (node.id );
598
- // add the current node as a child of the IC node
599
- ic_node.children .push_back (node.id );
600
- for (auto um_fid : node_unmet_fields) {
601
- for (auto &it1 : ic_inited) {
602
- const auto &grid_name = it1.first ;
603
- // if this unmet-dependency field's name is in the ic_inited map for
604
- // the provided grid_name key, then we flip its value negative and
605
- // break from the for (ic_inited) and for (node_unmet_fields) loops;
606
- // otherwise, keep trying for the next grid_name
607
- if (ekat::contains (ic_inited.at (grid_name), m_fids[um_fid].name ())) {
608
- auto id_now_met = node_unmet_fields.extract (um_fid);
609
- id_now_met.value () = -id_now_met.value ();
610
- node_unmet_fields.insert (std::move (id_now_met));
611
- // add the fid of the formerly unmet dep to the initial condition
612
- // node's computed list
613
- ic_node.computed .insert (um_fid);
614
- goto endloop;
615
- } else {
616
- continue ;
617
- }
618
- }
619
- endloop:;
620
- }
621
- }
622
- }
623
- m_IC_processed = true ;
624
- }
625
-
626
- void AtmProcDAG::process_IC_alt (const grid_field_map &ic_inited) {
627
583
// First, add the fields that were determined to come from the previous time
628
584
// step => IC for t = 0
629
585
// get the begin_node since the IC is identical at first
630
586
const Node &begin_node = m_nodes[m_nodes.size () - 2 ];
631
587
int id = m_nodes.size ();
632
588
// Create a node for the ICs by copying the begin_node
633
- // FIXME:(?) do we need an explicit copy constructor given that a Node is
634
- // just a struct?
635
589
m_nodes.push_back (Node (begin_node));
636
590
Node& ic_node = m_nodes.back ();
637
591
// now set/clear the basic data for the ic_node
0 commit comments