~tim-greaves/fluidity-launchtesting/trunk

« back to all changes in this revision

Viewing changes to ocean_forcing/NEMOReader.cpp

  • Committer: Mark Filipiak
  • Date: 2012-11-20 10:39:22 UTC
  • mfrom: (4125.2.8 ocean-forcing)
  • Revision ID: mjf@staffmail.ed.ac.uk-20121120103922-f3etzynysyfzgjhy
Input of environmental options (e.g. forcing fields) is moved from
Usage.cpp into ocean_forcing/InitialiseOceanForcing.F90, to be
accessible in flredecomp as well as fluidity. Relevant Fortran-C
interfaces have been converted from using F77_FUNC to use
iso_c_binding.

Show diffs side-by-side

added added

removed removed

Lines of Context:
852
852
NEMOReader NEMOReader_global;
853
853
 
854
854
extern "C" {
855
 
#define nemo_addfieldofinterest_fc F77_FUNC_(nemo_addfieldofinterest, NEMO_ADDFIELDOFINTEREST)
856
 
  void nemo_addfieldofinterest_fc(char *_scalar, int *len){
857
 
    char scalar[1024];
858
 
    assert(*len<1023);
859
 
    strncpy(scalar, _scalar, *len);
860
 
    scalar[*len] = '\0';
 
855
  void nemo_addfieldofinterest_c(const char *scalar){
861
856
    NEMOReader_global.AddFieldOfInterest(string(scalar));
862
857
    return;
863
858
  }
864
859
  
865
 
#define nemo_clearfields_fc F77_FUNC_(nemo_clearfields, NEMO_CLEARFIELDS)
866
 
  void nemo_clearfields_fc(){
 
860
  void nemo_clearfields_c(){
867
861
    NEMOReader_global.ClearFields();
868
862
    return;
869
863
  }
870
864
  
871
 
#define nemo_getscalars_fc F77_FUNC_(nemo_getscalars, NEMO_GETSCALARS)
872
 
  void nemo_getscalars_fc(double *longitude, double *latitude, double *p_depth, double *scalars){
 
865
  void nemo_getscalars_c(const double *longitude, const double *latitude, const double *p_depth, double *scalars){
873
866
    NEMOReader_global.GetScalars(*longitude, *latitude, *p_depth, scalars);
874
867
    return;
875
868
  }
876
869
  
877
 
#define nemo_registerdatafile_fc F77_FUNC_(nemo_registerdatafile, NEMO_REGISTERDATAFILE)
878
 
  void nemo_registerdatafile_fc(char *_filename, int *len){
879
 
    char filename[4096];
880
 
    assert(*len<4095);
881
 
    strncpy(filename, _filename, *len);
882
 
    filename[*len] = '\0';
 
870
  void nemo_registerdatafile_c(const char *filename){
883
871
    NEMOReader_global.RegisterDataFile(string(filename));
884
872
    return;
885
873
  }
886
874
  
887
 
#define nemo_settimeseconds_fc F77_FUNC_(nemo_settimeseconds, NEMO_SETTIMESECONDS)
888
 
  void nemo_settimeseconds_fc(double *_time){
889
 
    NEMOReader_global.SetTimeSeconds(*_time);  
890
 
    return;
891
 
  }
892
 
}
 
 
b'\\ No newline at end of file'
 
875
  void nemo_setsimulationtimeunits_c(const char *units){
 
876
    NEMOReader_global.SetSimulationTimeUnits(string(units));  
 
877
    return;
 
878
  }
 
879
  
 
880
  void nemo_settimeseconds_c(const double *time){
 
881
    NEMOReader_global.SetTimeSeconds(*time);  
 
882
    return;
 
883
  }
 
884
}