@@ -19,6 +19,7 @@ MDSchismOutput::MDSchismOutput(const std::string a_outputFile,const std::string
1919 m_face_bottom(NULL ),
2020 m_node_bottom(NULL ),
2121 m_edge_bottom(NULL ),
22+ m_prism_bottom(NULL ),
2223 m_face_nodes(NULL ),
2324 m_side_nodes(NULL ),
2425 m_face_bottom_time_id(-1 ),
@@ -105,6 +106,10 @@ MDSchismOutput::~MDSchismOutput()
105106 delete m_edge_bottom;
106107 }
107108
109+ if (m_prism_bottom)
110+ {
111+ delete m_edge_bottom;
112+ }
108113 if (m_side_nodes)
109114 {
110115 delete m_side_nodes;
@@ -341,6 +346,19 @@ void MDSchismOutput::get_face_bottom(int* a_face_bottom,const int& a_time)
341346 a_face_bottom[i]=m_face_bottom[i];
342347 }
343348}
349+
350+ void MDSchismOutput::get_prism_bottom (int * a_prism_bottom, const int & a_time)
351+ {
352+ NcDim * dimFacePtr = m_outputNcFilePtr->get_dim (MeshConstants10::DIM_MESH_FACES .c_str ());
353+ long numMeshFaces = 0 ;
354+ numMeshFaces = dimFacePtr->size ();
355+
356+ for (long i = 0 ; i < numMeshFaces; i++)
357+ {
358+ a_prism_bottom[i] = m_prism_bottom[i];
359+ }
360+ }
361+
344362void MDSchismOutput::get_edge_bottom (int * a_edge_bottom,const int & a_time)
345363{
346364 NcDim * dimEdgePtr = m_outputNcFilePtr->get_dim (MeshConstants10::DIM_MESH_EDGES .c_str ());
@@ -491,6 +509,38 @@ void MDSchismOutput::update_ele_bottom(const int& a_time,int* a_node_bottom)
491509
492510}
493511
512+ void MDSchismOutput::set_prism_bottom (const int & a_time, int * a_prism_bottom)
513+ {
514+ update_prism_bottom (a_time, a_prism_bottom);
515+ }
516+
517+ void MDSchismOutput::update_prism_bottom (const int & a_time, int * a_prism_bottom)
518+ {
519+
520+ NcDim * dimFacePtr = m_outputNcFilePtr->get_dim (MeshConstants10::DIM_MESH_FACES .c_str ());
521+ long numMeshFaces = 0 ;
522+ numMeshFaces = dimFacePtr->size ();
523+ NcDim * dimNodePtr = m_outputNcFilePtr->get_dim (MeshConstants10::DIM_MESH_NODES .c_str ());
524+ long numMeshNodes = 0 ;
525+ numMeshNodes = dimNodePtr->size ();
526+
527+
528+ if (!(m_prism_bottom))
529+ {
530+ m_prism_bottom = new int [numMeshFaces];
531+ }
532+
533+ for (long iface = 0 ; iface < numMeshFaces; iface++)
534+ {
535+
536+ m_prism_bottom[iface] = a_prism_bottom[iface];
537+
538+ }
539+ m_prism_bottom_time_id = a_time;
540+
541+ }
542+
543+
494544
495545bool MDSchismOutput::load_dim_var ()
496546{
@@ -580,13 +630,43 @@ bool MDSchismOutput::load_dim_var()
580630
581631 std::string nc_att_name (att_var->name ());
582632
583- if ((!(nc_att_name.compare (MeshConstants10::CENTER )))||(!(nc_att_name.compare (MeshConstants10::LOCATION ))))
584- {
585- schism_var->set_horizontal_center ((att_var->as_string (0 )));
586- }
587- else if (!(nc_att_name.compare (MeshConstants10::LAYER_CENTER )))
633+ // if ((!(nc_att_name.compare(MeshConstants10::CENTER)))||(!(nc_att_name.compare(MeshConstants10::LOCATION))))
634+ // {
635+ // schism_var->set_horizontal_center((att_var->as_string(0)));
636+ // }
637+ // else if (!(nc_att_name.compare(MeshConstants10::LAYER_CENTER)))
638+ // {
639+ // schism_var->set_vertical_center(att_var->as_string(0));
640+ // }
641+
642+ if (!(nc_att_name.compare (MeshConstants10::I23D )))
588643 {
589- schism_var->set_vertical_center (att_var->as_string (0 ));
644+ int i23d = att_var->as_int (0 );
645+ if (i23d <= 3 )
646+ {
647+ schism_var->set_horizontal_center (MeshConstants10::NODE );
648+ }
649+ else if (i23d <= 6 )
650+ {
651+ schism_var->set_horizontal_center (MeshConstants10::ELEM );
652+ }
653+ else if (i23d <= 9 )
654+ {
655+ schism_var->set_horizontal_center (MeshConstants10::EDGE );
656+ }
657+ else
658+ {
659+ throw SCHISMVarException10 (" i23d is not a valid\n " );
660+ }
661+
662+ if (!(i23d % 3 ))
663+ {
664+ schism_var->set_vertical_center (MeshConstants10::HALF_LAYER );
665+ }
666+ else
667+ {
668+ schism_var->set_vertical_center (MeshConstants10::FULL_LAYER );
669+ }
590670 }
591671
592672 }
@@ -652,7 +732,14 @@ void MDSchismOutputVar::fill_ncVar(NcVar * a_nc_var)
652732 }
653733 else
654734 {
655- m_schismfilePtr->get_face_bottom (a_kbp00,m_current_record);
735+ if (m_vertical_center == MeshConstants10::HALF_LAYER )
736+ {
737+ m_schismfilePtr->get_prism_bottom (a_kbp00, m_current_record);
738+ }
739+ else
740+ {
741+ m_schismfilePtr->get_face_bottom (a_kbp00, m_current_record);
742+ }
656743 }
657744 }
658745
@@ -685,7 +772,7 @@ bool MDSchismOutputVar::get(int * a_buffer)
685772{
686773
687774 int dataSize = computeDataNumPerTIMEStep ();
688- debug1 << " data size is " << dataSize<<" \n " ;
775+ // debug1 << "data size is " << dataSize<<"\n";
689776 if (m_data_cached)
690777 {
691778 // for(int idata=0;idata<dataSize;idata++)
0 commit comments